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

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

Issue 7796014: Make cancel remove cancelled download from active queues at time of cancel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix to try to get past main waterfall failure. Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/download_history.h" 5 #include "chrome/browser/download/download_history.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/download/chrome_download_manager_delegate.h" 8 #include "chrome/browser/download/chrome_download_manager_delegate.h"
9 #include "chrome/browser/history/history_marshaling.h" 9 #include "chrome/browser/history/history_marshaling.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const FilePath& new_path) { 109 const FilePath& new_path) {
110 // No update necessary if the download was initiated while in incognito mode. 110 // No update necessary if the download was initiated while in incognito mode.
111 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle) 111 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle)
112 return; 112 return;
113 113
114 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 114 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
115 if (hs) 115 if (hs)
116 hs->UpdateDownloadPath(new_path, download_item->db_handle()); 116 hs->UpdateDownloadPath(new_path, download_item->db_handle());
117 } 117 }
118 118
119 void DownloadHistory::RemoveEntry(DownloadItem* download_item) { 119 void DownloadHistory::RemoveEntry(int64 db_handle) {
120 // No update necessary if the download was initiated while in incognito mode. 120 // No update necessary if the download was initiated while in incognito mode.
121 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle) 121 if (db_handle <= DownloadItem::kUninitializedHandle)
122 return; 122 return;
123 123
124 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 124 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
125 if (hs) 125 if (hs)
126 hs->RemoveDownload(download_item->db_handle()); 126 hs->RemoveDownload(db_handle);
127 } 127 }
128 128
129 void DownloadHistory::RemoveEntriesBetween(const base::Time remove_begin, 129 void DownloadHistory::RemoveEntriesBetween(const base::Time remove_begin,
130 const base::Time remove_end) { 130 const base::Time remove_end) {
131 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 131 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
132 if (hs) 132 if (hs)
133 hs->RemoveDownloadsBetween(remove_begin, remove_end); 133 hs->RemoveDownloadsBetween(remove_begin, remove_end);
134 } 134 }
135 135
136 int64 DownloadHistory::GetNextFakeDbHandle() { 136 int64 DownloadHistory::GetNextFakeDbHandle() {
137 return next_fake_db_handle_--; 137 return next_fake_db_handle_--;
138 } 138 }
139 139
140 void DownloadHistory::OnGotVisitCountToHost(HistoryService::Handle handle, 140 void DownloadHistory::OnGotVisitCountToHost(HistoryService::Handle handle,
141 bool found_visits, 141 bool found_visits,
142 int count, 142 int count,
143 base::Time first_visit) { 143 base::Time first_visit) {
144 VisitedBeforeRequestsMap::iterator request = 144 VisitedBeforeRequestsMap::iterator request =
145 visited_before_requests_.find(handle); 145 visited_before_requests_.find(handle);
146 DCHECK(request != visited_before_requests_.end()); 146 DCHECK(request != visited_before_requests_.end());
147 int32 download_id = request->second.first; 147 int32 download_id = request->second.first;
148 VisitedBeforeDoneCallback* callback = request->second.second; 148 VisitedBeforeDoneCallback* callback = request->second.second;
149 visited_before_requests_.erase(request); 149 visited_before_requests_.erase(request);
150 callback->Run(download_id, found_visits && count && 150 callback->Run(download_id, found_visits && count &&
151 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); 151 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight()));
152 delete callback; 152 delete callback;
153 } 153 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_history.h ('k') | chrome/browser/download/download_item_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698