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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 10805020: Kill DownloadItem::IsOtr() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/chrome_download_manager_delegate.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index fc95cbf4f129ef68b2e2c50d187f02548b1c81d1..b0f67a0693f2013b3a0b057d88fdc67ea8b7827e 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -132,9 +132,11 @@ ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
download_manager_ = dm;
download_history_.reset(new DownloadHistory(profile_));
- download_history_->Load(
- base::Bind(&DownloadManager::OnPersistentStoreQueryComplete,
- base::Unretained(dm)));
+ if (profile_->GetOriginalProfile() == profile_) {
+ download_history_->Load(
+ base::Bind(&DownloadManager::OnPersistentStoreQueryComplete,
+ download_manager_));
+ }
#if !defined(OS_ANDROID)
extension_event_router_.reset(new ExtensionDownloadsEventRouter(
profile_, download_manager_));
@@ -424,9 +426,15 @@ bool ChromeDownloadManagerDelegate::GenerateFileHash() {
void ChromeDownloadManagerDelegate::AddItemToPersistentStore(
DownloadItem* item) {
+ if (profile_->HasOffTheRecordProfile() &&
+ (profile_ == profile_->GetOffTheRecordProfile())) {
asanka 2012/08/01 17:11:35 Why not profile_->IsOffTheRecord() ?
benjhayden 2012/08/01 18:51:55 Done.
+ OnItemAddedToPersistentStore(
+ item->GetId(), download_history_->GetNextFakeDbHandle());
+ return;
+ }
download_history_->AddEntry(item,
base::Bind(&ChromeDownloadManagerDelegate::OnItemAddedToPersistentStore,
- base::Unretained(this)));
+ this));
}
void ChromeDownloadManagerDelegate::UpdateItemInPersistentStore(
@@ -448,6 +456,9 @@ void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore(
void ChromeDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween(
base::Time remove_begin,
base::Time remove_end) {
+ if (profile_->HasOffTheRecordProfile() &&
+ (profile_ == profile_->GetOffTheRecordProfile()))
+ return;
download_history_->RemoveEntriesBetween(remove_begin, remove_end);
}
@@ -578,7 +589,7 @@ void ChromeDownloadManagerDelegate::CheckDownloadUrlDone(
download_history_->CheckVisitedReferrerBefore(
download_id, download->GetReferrerUrl(),
base::Bind(&ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone,
- base::Unretained(this), download_id, callback, danger_type));
+ this, download_id, callback, danger_type));
}
void ChromeDownloadManagerDelegate::CheckClientDownloadDone(

Powered by Google App Engine
This is Rietveld 408576698