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

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

Issue 10827386: DownloadHistory::Load use HistoryServiceFactory::GetForProfile not IfExists (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/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/download_crx_util.h" 8 #include "chrome/browser/download/download_crx_util.h"
9 #include "chrome/browser/history/history_marshaling.h" 9 #include "chrome/browser/history/history_marshaling.h"
10 #include "chrome/browser/history/history_service_factory.h" 10 #include "chrome/browser/history/history_service_factory.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "content/public/browser/download_item.h" 12 #include "content/public/browser/download_item.h"
13 #include "content/public/browser/download_persistent_store_info.h" 13 #include "content/public/browser/download_persistent_store_info.h"
14 14
15 using content::DownloadItem; 15 using content::DownloadItem;
16 using content::DownloadPersistentStoreInfo; 16 using content::DownloadPersistentStoreInfo;
17 17
18 DownloadHistory::DownloadHistory(Profile* profile) 18 DownloadHistory::DownloadHistory(Profile* profile)
19 : profile_(profile), 19 : profile_(profile),
20 next_fake_db_handle_(DownloadItem::kUninitializedHandle - 1) { 20 next_fake_db_handle_(DownloadItem::kUninitializedHandle - 1) {
21 DCHECK(profile); 21 DCHECK(profile);
22 } 22 }
23 23
24 DownloadHistory::~DownloadHistory() {} 24 DownloadHistory::~DownloadHistory() {}
25 25
26 void DownloadHistory::GetNextId( 26 void DownloadHistory::GetNextId(
27 const HistoryService::DownloadNextIdCallback& callback) { 27 const HistoryService::DownloadNextIdCallback& callback) {
28 HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists( 28 HistoryService* hs = HistoryServiceFactory::GetForProfile(
29 profile_, Profile::EXPLICIT_ACCESS); 29 profile_, Profile::EXPLICIT_ACCESS);
30 if (!hs) 30 if (!hs)
31 return; 31 return;
32 32
33 hs->GetNextDownloadId(&history_consumer_, callback); 33 hs->GetNextDownloadId(&history_consumer_, callback);
34 } 34 }
35 35
36 void DownloadHistory::Load( 36 void DownloadHistory::Load(
37 const HistoryService::DownloadQueryCallback& callback) { 37 const HistoryService::DownloadQueryCallback& callback) {
38 HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists( 38 HistoryService* hs = HistoryServiceFactory::GetForProfile(
39 profile_, Profile::EXPLICIT_ACCESS); 39 profile_, Profile::EXPLICIT_ACCESS);
40 if (!hs) 40 if (!hs)
41 return; 41 return;
42 42
43 hs->QueryDownloads(&history_consumer_, callback); 43 hs->QueryDownloads(&history_consumer_, callback);
44 44
45 // This is the initial load, so do a cleanup of corrupt in-progress entries. 45 // This is the initial load, so do a cleanup of corrupt in-progress entries.
46 hs->CleanUpInProgressEntries(); 46 hs->CleanUpInProgressEntries();
47 } 47 }
48 48
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 int count, 145 int count,
146 base::Time first_visit) { 146 base::Time first_visit) {
147 VisitedBeforeRequestsMap::iterator request = 147 VisitedBeforeRequestsMap::iterator request =
148 visited_before_requests_.find(handle); 148 visited_before_requests_.find(handle);
149 DCHECK(request != visited_before_requests_.end()); 149 DCHECK(request != visited_before_requests_.end());
150 VisitedBeforeDoneCallback callback = request->second; 150 VisitedBeforeDoneCallback callback = request->second;
151 visited_before_requests_.erase(request); 151 visited_before_requests_.erase(request);
152 callback.Run(found_visits && count && 152 callback.Run(found_visits && count &&
153 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); 153 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight()));
154 } 154 }
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