diff options
-rw-r--r-- | chrome/browser/bookmarks/bookmark_html_writer_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_index.cc | 6 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_index_unittest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model.cc | 4 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_storage.cc | 3 | ||||
-rw-r--r-- | chrome/browser/download/download_browsertest.cc | 7 | ||||
-rw-r--r-- | chrome/browser/download/download_history.cc | 26 | ||||
-rw-r--r-- | chrome/tools/profiles/generate_profile.cc | 3 |
9 files changed, 45 insertions, 24 deletions
diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc index 2535612..5f2d583 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_html_writer.h" #include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/importer/firefox2_importer.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" @@ -191,8 +192,8 @@ TEST_F(BookmarkHTMLWriterTest, Test) { const BookmarkNode* f1 = model->AddFolder( model->bookmark_bar_node(), 0, f1_title); model->AddURLWithCreationTime(f1, 0, url1_title, url1, t1); - profile.GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage(url1, - history::SOURCE_BROWSED); + HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS)-> + AddPage(url1, history::SOURCE_BROWSED); profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, url1_favicon, icon_data, history::FAVICON); message_loop.RunAllPending(); diff --git a/chrome/browser/bookmarks/bookmark_index.cc b/chrome/browser/bookmarks/bookmark_index.cc index c99c27a..884ef7a 100644 --- a/chrome/browser/bookmarks/bookmark_index.cc +++ b/chrome/browser/bookmarks/bookmark_index.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/history/history_database.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/query_parser.h" #include "chrome/browser/profiles/profile.h" #include "ui/base/l10n/l10n_util.h" @@ -111,7 +112,8 @@ void BookmarkIndex::GetBookmarksWithTitlesMatching( void BookmarkIndex::SortMatches(const Matches& matches, NodeTypedCountPairs* node_typed_counts) const { HistoryService* const history_service = profile_ ? - profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL; + HistoryServiceFactory::GetForProfile(profile_, + Profile::EXPLICIT_ACCESS) : NULL; history::URLDatabase* url_db = history_service ? history_service->InMemoryDatabase() : NULL; diff --git a/chrome/browser/bookmarks/bookmark_index_unittest.cc b/chrome/browser/bookmarks/bookmark_index_unittest.cc index 6a26108..681c5ab 100644 --- a/chrome/browser/bookmarks/bookmark_index_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_index_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,6 +14,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/history/history_database.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/in_memory_database.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" @@ -235,7 +236,7 @@ TEST_F(BookmarkIndexTest, GetResultsSortedByTypedCount) { BookmarkModel* model = profile.GetBookmarkModel(); HistoryService* const history_service = - profile.GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS); history::URLDatabase* url_db = history_service->InMemoryDatabase(); diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index ac38bd4..cf0fe00 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -19,6 +19,7 @@ #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/history/history_notifications.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" @@ -679,7 +680,8 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) { if (profile_) { HistoryService* history = - profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryServiceFactory::GetForProfile(profile_, + Profile::EXPLICIT_ACCESS); if (history) history->URLsNoLongerBookmarked(details.changed_urls); } diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index 03bac25..96619bd 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/browser/bookmarks/bookmark_model_observer.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/history/history_notifications.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" @@ -1061,9 +1062,10 @@ TEST_F(BookmarkModelTestWithProfile2, RemoveNotification) { GURL url("http://www.google.com"); bookmark_utils::AddIfNotBookmarked(bb_model_, url, string16()); - profile_->GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage( - url, NULL, 1, GURL(), content::PAGE_TRANSITION_TYPED, - history::RedirectList(), history::SOURCE_BROWSED, false); + HistoryServiceFactory::GetForProfile( + profile_.get(), Profile::EXPLICIT_ACCESS)->AddPage( + url, NULL, 1, GURL(), content::PAGE_TRANSITION_TYPED, + history::RedirectList(), history::SOURCE_BROWSED, false); // This won't actually delete the URL, rather it'll empty out the visits. // This triggers blocking on the BookmarkModel. diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index a520475..3166088 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -14,6 +14,7 @@ #include "base/time.h" #include "chrome/browser/bookmarks/bookmark_codec.h" #include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_notification_types.h" @@ -144,7 +145,7 @@ void BookmarkStorage::MigrateFromHistory() { // We need to wait until history has finished loading before reading // from generated bookmarks file. HistoryService* history = - profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (!history) { // This happens in unit tests. if (model_) diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index a8fef34..fb35aaa 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -31,6 +31,7 @@ #include "chrome/browser/extensions/extension_install_prompt.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/history/history.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/net/url_request_mock_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" @@ -104,9 +105,9 @@ class DownloadsHistoryDataCollector { DownloadManager* manager) : result_valid_(false), download_db_handle_(download_db_handle) { - HistoryService* hs = - Profile::FromBrowserContext(manager->GetBrowserContext())-> - GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = HistoryServiceFactory::GetForProfile( + Profile::FromBrowserContext(manager->GetBrowserContext()), + Profile::EXPLICIT_ACCESS); DCHECK(hs); hs->QueryDownloads( &callback_consumer_, diff --git a/chrome/browser/download/download_history.cc b/chrome/browser/download/download_history.cc index aa01860..cdce4b8 100644 --- a/chrome/browser/download/download_history.cc +++ b/chrome/browser/download/download_history.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "chrome/browser/download/download_crx_util.h" #include "chrome/browser/history/history_marshaling.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/download_item.h" #include "content/public/browser/download_persistent_store_info.h" @@ -24,7 +25,8 @@ DownloadHistory::~DownloadHistory() {} void DownloadHistory::GetNextId( const HistoryService::DownloadNextIdCallback& callback) { - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (!hs) return; @@ -33,7 +35,8 @@ void DownloadHistory::GetNextId( void DownloadHistory::Load( const HistoryService::DownloadQueryCallback& callback) { - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (!hs) return; @@ -48,7 +51,9 @@ void DownloadHistory::CheckVisitedReferrerBefore( const GURL& referrer_url, const VisitedBeforeDoneCallback& callback) { if (referrer_url.is_valid()) { - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(profile_, + Profile::EXPLICIT_ACCESS); if (hs) { HistoryService::Handle handle = hs->GetVisibleVisitCountToHost(referrer_url, &history_consumer_, @@ -74,7 +79,8 @@ void DownloadHistory::AddEntry( // 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 = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (download_item->IsOtr() || download_crx_util::IsExtensionDownload(*download_item) || download_item->IsTemporary() || !hs) { @@ -94,7 +100,8 @@ void DownloadHistory::UpdateEntry(DownloadItem* download_item) { if (download_item->GetDbHandle() <= DownloadItem::kUninitializedHandle) return; - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (!hs) return; hs->UpdateDownload(download_item->GetPersistentStoreInfo()); @@ -106,7 +113,8 @@ void DownloadHistory::UpdateDownloadPath(DownloadItem* download_item, if (download_item->GetDbHandle() <= DownloadItem::kUninitializedHandle) return; - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (hs) hs->UpdateDownloadPath(new_path, download_item->GetDbHandle()); } @@ -116,14 +124,16 @@ void DownloadHistory::RemoveEntry(DownloadItem* download_item) { if (download_item->GetDbHandle() <= DownloadItem::kUninitializedHandle) return; - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(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 = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryService* hs = + HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (hs) hs->RemoveDownloadsBetween(remove_begin, remove_end); } diff --git a/chrome/tools/profiles/generate_profile.cc b/chrome/tools/profiles/generate_profile.cc index c310879..ab7bbdf 100644 --- a/chrome/tools/profiles/generate_profile.cc +++ b/chrome/tools/profiles/generate_profile.cc @@ -19,6 +19,7 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/history/history.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/top_sites.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/thumbnail_score.h" @@ -114,7 +115,7 @@ void InsertURLBatch(Profile* profile, int batch_size, int types) { HistoryService* history_service = - profile->GetHistoryService(Profile::EXPLICIT_ACCESS); + HistoryServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); // Probability of following a link on the current "page" // (vs randomly jumping to a new page). |