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

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

Issue 10829058: Cleanup ExtensionDownloadsEventRouter on download manager shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | no next file » | 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 base::Unretained(dm))); 137 base::Unretained(dm)));
138 #if !defined(OS_ANDROID) 138 #if !defined(OS_ANDROID)
139 extension_event_router_.reset(new ExtensionDownloadsEventRouter( 139 extension_event_router_.reset(new ExtensionDownloadsEventRouter(
140 profile_, download_manager_)); 140 profile_, download_manager_));
141 #endif 141 #endif
142 } 142 }
143 143
144 void ChromeDownloadManagerDelegate::Shutdown() { 144 void ChromeDownloadManagerDelegate::Shutdown() {
145 download_history_.reset(); 145 download_history_.reset();
146 download_prefs_.reset(); 146 download_prefs_.reset();
147 #if !defined(OS_ANDROID)
148 extension_event_router_.reset();
149 #endif
147 } 150 }
148 151
149 DownloadId ChromeDownloadManagerDelegate::GetNextId() { 152 DownloadId ChromeDownloadManagerDelegate::GetNextId() {
150 if (!profile_->IsOffTheRecord()) 153 if (!profile_->IsOffTheRecord())
151 return DownloadId(this, next_download_id_++); 154 return DownloadId(this, next_download_id_++);
152 155
153 return BrowserContext::GetDownloadManager(profile_->GetOriginalProfile())-> 156 return BrowserContext::GetDownloadManager(profile_->GetOriginalProfile())->
154 GetDelegate()->GetNextId(); 157 GetDelegate()->GetNextId();
155 } 158 }
156 159
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 int32 download_id, int64 db_handle) { 820 int32 download_id, int64 db_handle) {
818 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 821 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
819 // call this function with an invalid |db_handle|. For instance, this can 822 // call this function with an invalid |db_handle|. For instance, this can
820 // happen when the history database is offline. We cannot have multiple 823 // happen when the history database is offline. We cannot have multiple
821 // DownloadItems with the same invalid db_handle, so we need to assign a 824 // DownloadItems with the same invalid db_handle, so we need to assign a
822 // unique |db_handle| here. 825 // unique |db_handle| here.
823 if (db_handle == DownloadItem::kUninitializedHandle) 826 if (db_handle == DownloadItem::kUninitializedHandle)
824 db_handle = download_history_->GetNextFakeDbHandle(); 827 db_handle = download_history_->GetNextFakeDbHandle();
825 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 828 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
826 } 829 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698