| Index: chrome/browser/download/download_history.cc
|
| ===================================================================
|
| --- chrome/browser/download/download_history.cc (revision 147024)
|
| +++ chrome/browser/download/download_history.cc (working copy)
|
| @@ -25,8 +25,8 @@
|
|
|
| void DownloadHistory::GetNextId(
|
| const HistoryService::DownloadNextIdCallback& callback) {
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (!hs)
|
| return;
|
|
|
| @@ -35,8 +35,8 @@
|
|
|
| void DownloadHistory::Load(
|
| const HistoryService::DownloadQueryCallback& callback) {
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (!hs)
|
| return;
|
|
|
| @@ -51,9 +51,8 @@
|
| const GURL& referrer_url,
|
| const VisitedBeforeDoneCallback& callback) {
|
| if (referrer_url.is_valid()) {
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_,
|
| - Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (hs) {
|
| HistoryService::Handle handle =
|
| hs->GetVisibleVisitCountToHost(referrer_url, &history_consumer_,
|
| @@ -79,8 +78,8 @@
|
| // handles, so we use a negative value. Eventually, they could overlap, but
|
| // you'd have to do enough downloading that your ISP would likely stab you in
|
| // the neck first. YMMV.
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (download_item->IsOtr() ||
|
| download_crx_util::IsExtensionDownload(*download_item) ||
|
| download_item->IsTemporary() || !hs) {
|
| @@ -100,8 +99,8 @@
|
| if (download_item->GetDbHandle() <= DownloadItem::kUninitializedHandle)
|
| return;
|
|
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (!hs)
|
| return;
|
| hs->UpdateDownload(download_item->GetPersistentStoreInfo());
|
| @@ -113,8 +112,8 @@
|
| if (download_item->GetDbHandle() <= DownloadItem::kUninitializedHandle)
|
| return;
|
|
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (hs)
|
| hs->UpdateDownloadPath(new_path, download_item->GetDbHandle());
|
| }
|
| @@ -124,16 +123,16 @@
|
| if (download_item->GetDbHandle() <= DownloadItem::kUninitializedHandle)
|
| return;
|
|
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (hs)
|
| hs->RemoveDownload(download_item->GetDbHandle());
|
| }
|
|
|
| void DownloadHistory::RemoveEntriesBetween(const base::Time remove_begin,
|
| const base::Time remove_end) {
|
| - HistoryService* hs =
|
| - HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
|
| + HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
|
| + profile_, Profile::EXPLICIT_ACCESS);
|
| if (hs)
|
| hs->RemoveDownloadsBetween(remove_begin, remove_end);
|
| }
|
|
|