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

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 Ben's comments. 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
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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 658
659 registrar_.Remove(this, 659 registrar_.Remove(this,
660 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 660 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
661 source); 661 source);
662 662
663 scoped_refptr<extensions::CrxInstaller> installer = 663 scoped_refptr<extensions::CrxInstaller> installer =
664 content::Source<extensions::CrxInstaller>(source).ptr(); 664 content::Source<extensions::CrxInstaller>(source).ptr();
665 int download_id = crx_installers_[installer]; 665 int download_id = crx_installers_[installer];
666 crx_installers_.erase(installer.get()); 666 crx_installers_.erase(installer.get());
667 667
668 DownloadItem* item = download_manager_->GetActiveDownloadItem(download_id); 668 DownloadItem* item = download_manager_->GetDownload(download_id);
669 if (item) 669 if (item)
670 item->DelayedDownloadOpened(installer->did_handle_successfully()); 670 item->DelayedDownloadOpened(installer->did_handle_successfully());
671 } 671 }
672 672
673 void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( 673 void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone(
674 int32 download_id, 674 int32 download_id,
675 const content::DownloadTargetCallback& callback, 675 const content::DownloadTargetCallback& callback,
676 content::DownloadDangerType danger_type, 676 content::DownloadDangerType danger_type,
677 bool visited_referrer_before) { 677 bool visited_referrer_before) {
678 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 678 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 int32 download_id, int64 db_handle) { 856 int32 download_id, int64 db_handle) {
857 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 857 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
858 // call this function with an invalid |db_handle|. For instance, this can 858 // call this function with an invalid |db_handle|. For instance, this can
859 // happen when the history database is offline. We cannot have multiple 859 // happen when the history database is offline. We cannot have multiple
860 // DownloadItems with the same invalid db_handle, so we need to assign a 860 // DownloadItems with the same invalid db_handle, so we need to assign a
861 // unique |db_handle| here. 861 // unique |db_handle| here.
862 if (db_handle == DownloadItem::kUninitializedHandle) 862 if (db_handle == DownloadItem::kUninitializedHandle)
863 db_handle = download_history_->GetNextFakeDbHandle(); 863 db_handle = download_history_->GetNextFakeDbHandle();
864 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 864 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
865 } 865 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_browsertest.cc » ('j') | content/public/test/download_test_observer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698