From d6ab8454f79ebdfe73801feaf06054c2480b5faf Mon Sep 17 00:00:00 2001 From: "joi@chromium.org" Date: Sat, 16 Feb 2013 04:20:59 +0000 Subject: Remove PrefServiceBase, since everyone can now depend directly on PrefService. TBR=ben@chromium.org BUG=155525 Review URL: https://chromiumcodereview.appspot.com/12252008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182918 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc | 2 +- chrome/browser/ui/autofill/tab_autofill_manager_delegate.h | 2 +- chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc | 5 ++--- chrome/browser/ui/bookmarks/bookmark_prompt_controller.cc | 2 +- chrome/browser/ui/bookmarks/bookmark_prompt_controller.h | 4 ++-- chrome/browser/ui/bookmarks/bookmark_utils.cc | 6 +++--- chrome/browser/ui/bookmarks/bookmark_utils.h | 4 ++-- chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm | 6 +++--- chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc | 6 +++--- chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc | 6 +++--- chrome/browser/ui/views/bookmarks/bookmark_prompt_view.cc | 4 ++-- chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h | 8 ++++---- chrome/browser/ui/views/home_button.cc | 3 +-- .../ui/webui/options/chromeos/core_chromeos_options_handler.cc | 2 +- .../ui/webui/options/chromeos/core_chromeos_options_handler.h | 2 +- chrome/browser/ui/webui/options/core_options_handler.cc | 2 +- chrome/browser/ui/webui/options/core_options_handler.h | 4 ++-- chrome/browser/ui/webui/options/preferences_browsertest.cc | 4 ++-- 18 files changed, 35 insertions(+), 37 deletions(-) (limited to 'chrome/browser/ui') diff --git a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc index b562fbe..293e826 100644 --- a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc +++ b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc @@ -52,7 +52,7 @@ InfoBarService* TabAutofillManagerDelegate::GetInfoBarService() { return InfoBarService::FromWebContents(web_contents_); } -PrefServiceBase* TabAutofillManagerDelegate::GetPrefs() { +PrefService* TabAutofillManagerDelegate::GetPrefs() { return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> GetPrefs(); } diff --git a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h index 735df82..2337df3 100644 --- a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h +++ b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h @@ -34,7 +34,7 @@ class TabAutofillManagerDelegate virtual content::BrowserContext* GetOriginalBrowserContext() const OVERRIDE; virtual Profile* GetOriginalProfile() const OVERRIDE; virtual InfoBarService* GetInfoBarService() OVERRIDE; - virtual PrefServiceBase* GetPrefs() OVERRIDE; + virtual PrefService* GetPrefs() OVERRIDE; virtual ProfileSyncServiceBase* GetProfileSyncService() OVERRIDE; virtual bool IsSavingPasswordsEnabled() const OVERRIDE; virtual void ShowAutofillSettings() OVERRIDE; diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc index d99b592..47684b3 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc @@ -6,7 +6,6 @@ #include "base/compiler_specific.h" #include "base/prefs/pref_service.h" -#include "base/prefs/public/pref_service_base.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -249,12 +248,12 @@ void BookmarkContextMenuController::ExecuteCommand(int id) { bool BookmarkContextMenuController::IsCommandIdChecked(int command_id) const { DCHECK(command_id == IDC_BOOKMARK_BAR_ALWAYS_SHOW); - PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(profile_); + PrefService* prefs = PrefServiceFromBrowserContext(profile_); return prefs->GetBoolean(prefs::kShowBookmarkBar); } bool BookmarkContextMenuController::IsCommandIdEnabled(int command_id) const { - PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(profile_); + PrefService* prefs = PrefServiceFromBrowserContext(profile_); bool is_root_node = selection_.size() == 1 && selection_[0]->parent() == model_->root_node(); diff --git a/chrome/browser/ui/bookmarks/bookmark_prompt_controller.cc b/chrome/browser/ui/bookmarks/bookmark_prompt_controller.cc index f6bd035a..c58e501 100644 --- a/chrome/browser/ui/bookmarks/bookmark_prompt_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_prompt_controller.cc @@ -202,7 +202,7 @@ void BookmarkPromptController::ClosingBookmarkPrompt() { // static void BookmarkPromptController::DisableBookmarkPrompt( - PrefServiceBase* prefs) { + PrefService* prefs) { UMA_HISTOGRAM_ENUMERATION("BookmarkPrompt.DisabledReason", PROMPT_DISABLED_REASON_BY_MANUAL, PROMPT_DISABLED_REASON_LIMIT); diff --git a/chrome/browser/ui/bookmarks/bookmark_prompt_controller.h b/chrome/browser/ui/bookmarks/bookmark_prompt_controller.h index 36995b9..d0ee151 100644 --- a/chrome/browser/ui/bookmarks/bookmark_prompt_controller.h +++ b/chrome/browser/ui/bookmarks/bookmark_prompt_controller.h @@ -16,7 +16,7 @@ #include "googleurl/src/gurl.h" class Browser; -class PrefServiceBase; +class PrefService; namespace content { class WebContents; @@ -54,7 +54,7 @@ class BookmarkPromptController : public chrome::BrowserListObserver, static void ClosingBookmarkPrompt(); // Disable bookmark prompt feature in a profile in |prefs|. - static void DisableBookmarkPrompt(PrefServiceBase* prefs); + static void DisableBookmarkPrompt(PrefService* prefs); // True if bookmark prompt feature is enabled, otherwise false. static bool IsEnabled(); diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.cc b/chrome/browser/ui/bookmarks/bookmark_utils.cc index bbdd283..d09165c 100644 --- a/chrome/browser/ui/bookmarks/bookmark_utils.cc +++ b/chrome/browser/ui/bookmarks/bookmark_utils.cc @@ -6,7 +6,7 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "base/prefs/public/pref_service_base.h" +#include "base/prefs/pref_service.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" @@ -240,7 +240,7 @@ void GetURLAndTitleToBookmark(content::WebContents* web_contents, } void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { - PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(browser_context); + PrefService* prefs = PrefServiceFromBrowserContext(browser_context); const bool always_show = !prefs->GetBoolean(prefs::kShowBookmarkBar); // The user changed when the bookmark bar is shown, update the preferences. @@ -248,7 +248,7 @@ void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { } string16 FormatBookmarkURLForDisplay(const GURL& url, - const PrefServiceBase* prefs) { + const PrefService* prefs) { std::string languages; if (prefs) languages = prefs->GetString(prefs::kAcceptLanguages); diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.h b/chrome/browser/ui/bookmarks/bookmark_utils.h index 594eaef..23a8d32 100644 --- a/chrome/browser/ui/bookmarks/bookmark_utils.h +++ b/chrome/browser/ui/bookmarks/bookmark_utils.h @@ -14,7 +14,7 @@ class BookmarkNode; class Browser; class GURL; -class PrefServiceBase; +class PrefService; namespace content { class BrowserContext; @@ -78,7 +78,7 @@ void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context); // the given |prefs|, which may be NULL. When re-parsing this URL, clients // should call URLFixerUpper::FixupURL(). string16 FormatBookmarkURLForDisplay(const GURL& url, - const PrefServiceBase* prefs); + const PrefService* prefs); } // namespace chrome diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm index d6a7ab9..c689ac9 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm @@ -4,7 +4,7 @@ #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" -#include "base/prefs/public/pref_service_base.h" +#include "base/prefs/pref_service.h" #include "base/string16.h" #include "base/sys_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" @@ -69,8 +69,8 @@ // arrived here from an "Add Page..." item in a context menu. if (node_) { [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; - PrefServiceBase* prefs = [self profile] ? - PrefServiceBase::FromBrowserContext([self profile]) : + PrefService* prefs = [self profile] ? + PrefServiceFromBrowserContext([self profile]) : NULL; string16 urlString = chrome::FormatBookmarkURLForDisplay(node_->url(), prefs); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc index 403b65b..c3490fc 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "base/prefs/public/pref_service_base.h" +#include "base/prefs/pref_service.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" @@ -359,8 +359,8 @@ void BookmarkEditorGtk::Init(GtkWindow* parent_window) { GtkWidget* table; if (details_.GetNodeType() != BookmarkNode::FOLDER) { url_entry_ = gtk_entry_new(); - PrefServiceBase* prefs = profile_ ? - PrefServiceBase::FromBrowserContext(profile_) : + PrefService* prefs = profile_ ? + PrefServiceFromBrowserContext(profile_) : NULL; gtk_entry_set_text( GTK_ENTRY(url_entry_), diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index 97f480b..2447b07 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "base/logging.h" -#include "base/prefs/public/pref_service_base.h" +#include "base/prefs/pref_service.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -365,8 +365,8 @@ void BookmarkEditorView::Init() { l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); url_tf_ = new views::Textfield; - PrefServiceBase* prefs = profile_ ? - PrefServiceBase::FromBrowserContext(profile_) : + PrefService* prefs = profile_ ? + PrefServiceFromBrowserContext(profile_) : NULL; url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs)); url_tf_->SetController(this); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.cc index 0d2eb34..f210921 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.cc @@ -26,7 +26,7 @@ BookmarkPromptView* BookmarkPromptView::bookmark_bubble_ = NULL; // static void BookmarkPromptView::ShowPrompt(views::View* anchor_view, - PrefServiceBase* prefs) { + PrefService* prefs) { if (bookmark_bubble_) return; bookmark_bubble_ = new BookmarkPromptView(anchor_view, prefs); @@ -35,7 +35,7 @@ void BookmarkPromptView::ShowPrompt(views::View* anchor_view, } BookmarkPromptView::BookmarkPromptView(views::View* anchor_view, - PrefServiceBase* prefs) + PrefService* prefs) : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), dismiss_link_(NULL), prefs_(prefs) { diff --git a/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h b/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h index f171c42..62b308e 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h @@ -9,7 +9,7 @@ #include "ui/views/bubble/bubble_delegate.h" #include "ui/views/controls/link_listener.h" -class PrefServiceBase; +class PrefService; // BookmarkPromptView is a view intended to be used as the content of an // Bubble. BookmarkPromptView provides views for prompting user for action box @@ -19,11 +19,11 @@ class BookmarkPromptView : public views::BubbleDelegateView, public views::LinkListener { public: // Show the prompt bubble. - static void ShowPrompt(views::View* anchor_view, PrefServiceBase* prefs); + static void ShowPrompt(views::View* anchor_view, PrefService* prefs); private: // Creates a BookmarkPromptView. - BookmarkPromptView(views::View* anchor_view, PrefServiceBase* prefs); + BookmarkPromptView(views::View* anchor_view, PrefService* prefs); virtual ~BookmarkPromptView(); @@ -43,7 +43,7 @@ class BookmarkPromptView : public views::BubbleDelegateView, views::Link* dismiss_link_; // The pref service to use disabling bookmark prompt feature. - PrefServiceBase* prefs_; + PrefService* prefs_; DISALLOW_COPY_AND_ASSIGN(BookmarkPromptView); }; diff --git a/chrome/browser/ui/views/home_button.cc b/chrome/browser/ui/views/home_button.cc index d2f2610..9264799 100644 --- a/chrome/browser/ui/views/home_button.cc +++ b/chrome/browser/ui/views/home_button.cc @@ -113,8 +113,7 @@ void HomePageUndoBubble::Init() { } void HomePageUndoBubble::LinkClicked(views::Link* source, int event_flags) { - PrefServiceBase* prefs = - PrefServiceBase::FromBrowserContext(browser_->profile()); + PrefService* prefs = PrefServiceFromBrowserContext(browser_->profile()); prefs->SetBoolean(prefs::kHomePageIsNewTabPage, undo_value_is_ntp_); prefs->SetString(prefs::kHomePage, undo_url_.spec()); diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc index 944e3d3..f8069b8 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc @@ -212,7 +212,7 @@ void CoreChromeOSOptionsHandler::Observe( } void CoreChromeOSOptionsHandler::OnPreferenceChanged( - PrefServiceBase* service, + PrefService* service, const std::string& pref_name) { // Special handling for preferences kUseSharedProxies and kProxy, the latter // controls the former and decides if it's managed by policy/extension. diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h index 1dd319b..7612611 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h @@ -38,7 +38,7 @@ class CoreChromeOSOptionsHandler : public ::options::CoreOptionsHandler { const content::NotificationDetails& details) OVERRIDE; private: - virtual void OnPreferenceChanged(PrefServiceBase* service, + virtual void OnPreferenceChanged(PrefService* service, const std::string& pref_name) OVERRIDE; // Notifies registered JS callbacks on ChromeOS setting change. diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc index b09463d..2032167 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.cc +++ b/chrome/browser/ui/webui/options/core_options_handler.cc @@ -143,7 +143,7 @@ void CoreOptionsHandler::Uninitialize() { } } -void CoreOptionsHandler::OnPreferenceChanged(PrefServiceBase* service, +void CoreOptionsHandler::OnPreferenceChanged(PrefService* service, const std::string& pref_name) { if (pref_name == prefs::kClearPluginLSODataEnabled) { // This preference is stored in Local State, not in the user preferences. diff --git a/chrome/browser/ui/webui/options/core_options_handler.h b/chrome/browser/ui/webui/options/core_options_handler.h index ea32445..bd01a7e 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.h +++ b/chrome/browser/ui/webui/options/core_options_handler.h @@ -65,10 +65,10 @@ class CoreOptionsHandler : public OptionsPageUIHandler { const std::string& metric); // Virtual dispatch is needed as handling of some prefs may be - // finessed in subclasses. The PrefServiceBase pointer is included + // finessed in subclasses. The PrefService pointer is included // so that subclasses can know whether the observed pref is from the // local state or not. - virtual void OnPreferenceChanged(PrefServiceBase* service, + virtual void OnPreferenceChanged(PrefService* service, const std::string& pref_name); // Notifies registered JS callbacks on change in |pref_name| preference. diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc index f987527..98022af 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.cc +++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc @@ -10,7 +10,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" -#include "base/prefs/public/pref_service_base.h" +#include "base/prefs/pref_service.h" #include "base/stl_util.h" #include "base/values.h" #include "chrome/browser/policy/browser_policy_connector.h" @@ -82,7 +82,7 @@ void PreferencesBrowserTest::SetUpOnMainThread() { render_view_host_ = web_contents->GetRenderViewHost(); ASSERT_TRUE(render_view_host_); pref_change_registrar_.Init( - PrefServiceBase::FromBrowserContext(browser()->profile())); + PrefServiceFromBrowserContext(browser()->profile())); pref_service_ = browser()->profile()->GetPrefs(); ASSERT_TRUE(content::ExecuteScript(render_view_host_, "function TestEnv() {" -- cgit v1.1