Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 10918136: Make web store resilient against download completion happening before opening. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comment. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 682
683 registrar_.Remove(this, 683 registrar_.Remove(this,
684 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 684 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
685 source); 685 source);
686 686
687 scoped_refptr<extensions::CrxInstaller> installer = 687 scoped_refptr<extensions::CrxInstaller> installer =
688 content::Source<extensions::CrxInstaller>(source).ptr(); 688 content::Source<extensions::CrxInstaller>(source).ptr();
689 int download_id = crx_installers_[installer]; 689 int download_id = crx_installers_[installer];
690 crx_installers_.erase(installer.get()); 690 crx_installers_.erase(installer.get());
691 691
692 DownloadItem* item = download_manager_->GetActiveDownloadItem(download_id); 692 DownloadItem* item = download_manager_->GetDownload(download_id);
693 if (item) 693 if (item)
694 item->DelayedDownloadOpened(installer->did_handle_successfully()); 694 item->DelayedDownloadOpened(installer->did_handle_successfully());
695 } 695 }
696 696
697 void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( 697 void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone(
698 int32 download_id, 698 int32 download_id,
699 const content::DownloadTargetCallback& callback, 699 const content::DownloadTargetCallback& callback,
700 content::DownloadDangerType danger_type, 700 content::DownloadDangerType danger_type,
701 bool visited_referrer_before) { 701 bool visited_referrer_before) {
702 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 702 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 int32 download_id, int64 db_handle) { 888 int32 download_id, int64 db_handle) {
889 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 889 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
890 // call this function with an invalid |db_handle|. For instance, this can 890 // call this function with an invalid |db_handle|. For instance, this can
891 // happen when the history database is offline. We cannot have multiple 891 // happen when the history database is offline. We cannot have multiple
892 // DownloadItems with the same invalid db_handle, so we need to assign a 892 // DownloadItems with the same invalid db_handle, so we need to assign a
893 // unique |db_handle| here. 893 // unique |db_handle| here.
894 if (db_handle == DownloadItem::kUninitializedHandle) 894 if (db_handle == DownloadItem::kUninitializedHandle)
895 db_handle = download_history_->GetNextFakeDbHandle(); 895 db_handle = download_history_->GetNextFakeDbHandle();
896 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 896 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
897 } 897 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698