summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 09:43:08 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 09:43:08 +0000
commit052313bd2f8ef1f994d65be5a5615bb2e9aa19f9 (patch)
tree883e79cee1112b90bd82890f6bffaf84688bb15f /chrome/browser
parentf98f581eb3999563a71e8cf35c68420951c9f4e1 (diff)
downloadchromium_src-052313bd2f8ef1f994d65be5a5615bb2e9aa19f9.zip
chromium_src-052313bd2f8ef1f994d65be5a5615bb2e9aa19f9.tar.gz
chromium_src-052313bd2f8ef1f994d65be5a5615bb2e9aa19f9.tar.bz2
Move pref_{member,service} and important_file_writer from chrome/common
to chrome/browser. This is a part of an effort to remove bad dependency of chrome/common on chrome/browser. TEST=unit_tests and ui_tests, just moving code BUG=none Review URL: http://codereview.chromium.org/621004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/app_controller_mac.mm4
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc2
-rw-r--r--chrome/browser/autocomplete/history_url_provider.cc2
-rw-r--r--chrome/browser/autocomplete/search_provider.cc2
-rw-r--r--chrome/browser/autofill/autofill_infobar_delegate.cc2
-rw-r--r--chrome/browser/autofill/autofill_manager.cc2
-rw-r--r--chrome/browser/automation/automation_provider.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_context_menu_controller.cc2
-rwxr-xr-xchrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc4
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_storage.h2
-rw-r--r--chrome/browser/bookmarks/bookmark_table_model.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc2
-rw-r--r--chrome/browser/browser.cc2
-rw-r--r--chrome/browser/browser.h2
-rw-r--r--chrome/browser/browser_about_handler.cc2
-rw-r--r--chrome/browser/browser_init.cc2
-rw-r--r--chrome/browser/browser_main.cc2
-rw-r--r--chrome/browser/browser_process_impl.cc2
-rw-r--r--chrome/browser/browser_shutdown.cc2
-rw-r--r--chrome/browser/browser_theme_provider.cc2
-rw-r--r--chrome/browser/chromeos/login/user_manager.cc2
-rw-r--r--chrome/browser/chromeos/options/system_page_view.cc2
-rw-r--r--chrome/browser/chromeos/preferences.cc4
-rw-r--r--chrome/browser/chromeos/preferences.h2
-rwxr-xr-xchrome/browser/chromeos/status/browser_status_area_view.cc2
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.mm2
-rw-r--r--chrome/browser/cocoa/bookmark_manager_controller.mm2
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.mm4
-rw-r--r--chrome/browser/cocoa/browser_window_controller_private.mm2
-rw-r--r--chrome/browser/cocoa/browser_window_controller_unittest.mm2
-rw-r--r--chrome/browser/cocoa/clear_browsing_data_controller.mm4
-rw-r--r--chrome/browser/cocoa/clear_browsing_data_controller_unittest.mm2
-rw-r--r--chrome/browser/cocoa/font_language_settings_controller.h2
-rw-r--r--chrome/browser/cocoa/font_language_settings_controller.mm2
-rw-r--r--chrome/browser/cocoa/keystone_infobar.mm4
-rw-r--r--chrome/browser/cocoa/keyword_editor_cocoa_controller.mm2
-rw-r--r--chrome/browser/cocoa/page_info_window_controller.mm2
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.h2
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.mm2
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.mm2
-rw-r--r--chrome/browser/cocoa/toolbar_controller.h2
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm2
-rw-r--r--chrome/browser/cocoa/toolbar_controller_unittest.mm2
-rw-r--r--chrome/browser/cocoa/window_size_autosaver.mm4
-rw-r--r--chrome/browser/cocoa/window_size_autosaver_unittest.mm2
-rw-r--r--chrome/browser/cookie_modal_dialog.cc2
-rw-r--r--chrome/browser/debugger/devtools_manager.cc2
-rw-r--r--chrome/browser/debugger/devtools_window.cc2
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.cc2
-rw-r--r--chrome/browser/dom_ui/new_tab_page_sync_handler.cc2
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc4
-rw-r--r--chrome/browser/dom_ui/new_tab_ui_uitest.cc2
-rw-r--r--chrome/browser/dom_ui/ntp_resource_cache.cc2
-rw-r--r--chrome/browser/dom_ui/shown_sections_handler.cc2
-rw-r--r--chrome/browser/dom_ui/shown_sections_handler_unittest.cc2
-rw-r--r--chrome/browser/download/download_manager.cc2
-rw-r--r--chrome/browser/download/download_manager.h2
-rw-r--r--chrome/browser/download/save_package.cc2
-rw-r--r--chrome/browser/encoding_menu_controller.cc2
-rw-r--r--chrome/browser/extensions/extension_bookmarks_module.cc2
-rw-r--r--chrome/browser/extensions/extension_dom_ui.cc2
-rw-r--r--chrome/browser/extensions/extension_host.cc2
-rw-r--r--chrome/browser/extensions/extension_i18n_api.cc2
-rw-r--r--chrome/browser/extensions/extension_prefs.h2
-rw-r--r--chrome/browser/extensions/extension_updater.cc2
-rw-r--r--chrome/browser/extensions/extension_updater_unittest.cc2
-rw-r--r--chrome/browser/extensions/extensions_service.cc2
-rw-r--r--chrome/browser/extensions/extensions_ui.cc2
-rw-r--r--chrome/browser/external_protocol_handler.cc2
-rw-r--r--chrome/browser/first_run.cc2
-rw-r--r--chrome/browser/first_run_win.cc2
-rw-r--r--chrome/browser/form_field_history_manager.cc2
-rw-r--r--chrome/browser/form_field_history_manager.h2
-rw-r--r--chrome/browser/geolocation/access_token_store.cc2
-rw-r--r--chrome/browser/google_url_tracker.cc2
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc2
-rw-r--r--chrome/browser/gtk/bookmark_editor_gtk_unittest.cc4
-rw-r--r--chrome/browser/gtk/bookmark_manager_gtk.cc2
-rw-r--r--chrome/browser/gtk/browser_titlebar.cc2
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc2
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.h2
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc2
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h2
-rw-r--r--chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc2
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.cc2
-rw-r--r--chrome/browser/gtk/options/advanced_contents_gtk.cc2
-rw-r--r--chrome/browser/gtk/options/advanced_page_gtk.h2
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.cc2
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.h2
-rw-r--r--chrome/browser/gtk/options/content_settings_window_gtk.cc2
-rw-r--r--chrome/browser/gtk/options/content_settings_window_gtk.h2
-rw-r--r--chrome/browser/gtk/options/cookie_filter_page_gtk.h2
-rw-r--r--chrome/browser/gtk/options/fonts_page_gtk.h2
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.cc2
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.h2
-rw-r--r--chrome/browser/gtk/options/languages_page_gtk.h2
-rw-r--r--chrome/browser/gtk/options/options_window_gtk.cc4
-rw-r--r--chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc2
-rw-r--r--chrome/browser/gtk/options/passwords_page_gtk.cc2
-rw-r--r--chrome/browser/gtk/options/url_picker_dialog_gtk.cc2
-rw-r--r--chrome/browser/gtk/task_manager_gtk.cc2
-rw-r--r--chrome/browser/host_content_settings_map.cc2
-rw-r--r--chrome/browser/host_zoom_map.cc2
-rw-r--r--chrome/browser/important_file_writer.cc143
-rw-r--r--chrome/browser/important_file_writer.h104
-rw-r--r--chrome/browser/important_file_writer_unittest.cc113
-rw-r--r--chrome/browser/importer/importer.cc2
-rw-r--r--chrome/browser/intranet_redirect_detector.cc2
-rw-r--r--chrome/browser/language_combobox_model.cc2
-rw-r--r--chrome/browser/metrics/metrics_log.cc2
-rw-r--r--chrome/browser/metrics/metrics_service.cc2
-rw-r--r--chrome/browser/metrics/metrics_service_uitest.cc2
-rw-r--r--chrome/browser/net/chrome_url_request_context.h2
-rw-r--r--chrome/browser/net/dns_global.cc2
-rw-r--r--chrome/browser/net/ssl_config_service_manager_pref.cc4
-rw-r--r--chrome/browser/notifications/desktop_notification_service.cc2
-rw-r--r--chrome/browser/notifications/notifications_prefs_cache.cc2
-rw-r--r--chrome/browser/omnibox_search_hint.cc4
-rw-r--r--chrome/browser/options_page_base.cc2
-rw-r--r--chrome/browser/options_util.cc2
-rw-r--r--chrome/browser/page_info_model.cc2
-rw-r--r--chrome/browser/password_manager/password_manager.cc2
-rw-r--r--chrome/browser/password_manager/password_manager.h2
-rw-r--r--chrome/browser/possible_url_model.cc2
-rw-r--r--chrome/browser/pref_member.cc87
-rw-r--r--chrome/browser/pref_member.h176
-rw-r--r--chrome/browser/pref_member_unittest.cc193
-rw-r--r--chrome/browser/pref_service.cc684
-rw-r--r--chrome/browser/pref_service.h222
-rw-r--r--chrome/browser/pref_service_uitest.cc133
-rw-r--r--chrome/browser/pref_service_unittest.cc270
-rw-r--r--chrome/browser/privacy_blacklist/blacklist.cc2
-rw-r--r--chrome/browser/privacy_blacklist/blacklist_unittest.cc2
-rw-r--r--chrome/browser/profile_manager.cc2
-rw-r--r--chrome/browser/profile_manager_unittest.cc2
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc2
-rw-r--r--chrome/browser/renderer_host/web_cache_manager.cc2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc2
-rw-r--r--chrome/browser/search_engines/keyword_editor_controller.cc2
-rw-r--r--chrome/browser/search_engines/template_url_model.cc2
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.cc2
-rw-r--r--chrome/browser/session_startup_pref.cc2
-rw-r--r--chrome/browser/spellcheck_host.cc2
-rw-r--r--chrome/browser/ssl/ssl_blocking_page.cc2
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc2
-rw-r--r--chrome/browser/ssl/ssl_manager.cc2
-rw-r--r--chrome/browser/ssl/ssl_policy.cc2
-rw-r--r--chrome/browser/sync/glue/preference_change_processor.h2
-rw-r--r--chrome/browser/sync/glue/preference_model_associator.cc2
-rw-r--r--chrome/browser/sync/glue/preference_model_associator.h2
-rw-r--r--chrome/browser/sync/profile_sync_service.cc2
-rwxr-xr-xchrome/browser/sync/sync_setup_flow.cc2
-rw-r--r--chrome/browser/sync/sync_setup_wizard.cc4
-rw-r--r--chrome/browser/sync/sync_setup_wizard_unittest.cc2
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc2
-rw-r--r--chrome/browser/tab_contents/navigation_entry.cc2
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc2
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc2
-rw-r--r--chrome/browser/tab_contents/web_contents_unittest.cc2
-rw-r--r--chrome/browser/tabs/tab_strip_model_order_controller.h2
-rw-r--r--chrome/browser/task_manager.cc2
-rw-r--r--chrome/browser/thumbnail_store.cc2
-rw-r--r--chrome/browser/toolbar_model.cc2
-rw-r--r--chrome/browser/translate/translate_manager.cc2
-rw-r--r--chrome/browser/translate/translate_prefs.cc2
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc2
-rw-r--r--chrome/browser/views/bookmark_bar_view_test.cc2
-rw-r--r--chrome/browser/views/bookmark_context_menu_controller_views.cc2
-rw-r--r--chrome/browser/views/bookmark_context_menu_test.cc6
-rw-r--r--chrome/browser/views/bookmark_editor_view.cc2
-rw-r--r--chrome/browser/views/bookmark_editor_view_unittest.cc2
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc2
-rw-r--r--chrome/browser/views/bookmark_table_view.cc2
-rw-r--r--chrome/browser/views/bug_report_view.cc2
-rw-r--r--chrome/browser/views/chrome_views_delegate.cc8
-rw-r--r--chrome/browser/views/clear_browsing_data.cc2
-rw-r--r--chrome/browser/views/constrained_window_win.cc2
-rw-r--r--chrome/browser/views/cookie_prompt_view.cc2
-rw-r--r--chrome/browser/views/create_application_shortcut_view.cc2
-rw-r--r--chrome/browser/views/first_run_view_base.cc2
-rw-r--r--chrome/browser/views/frame/browser_view.cc2
-rw-r--r--chrome/browser/views/keyword_editor_view.cc2
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc4
-rw-r--r--chrome/browser/views/options/content_filter_page_view.h2
-rw-r--r--chrome/browser/views/options/content_page_view.h2
-rw-r--r--chrome/browser/views/options/content_settings_window_view.cc2
-rw-r--r--chrome/browser/views/options/content_settings_window_view.h2
-rw-r--r--chrome/browser/views/options/cookie_filter_page_view.cc2
-rw-r--r--chrome/browser/views/options/cookie_filter_page_view.h2
-rw-r--r--chrome/browser/views/options/exceptions_page_view.cc2
-rw-r--r--chrome/browser/views/options/fonts_languages_window_view.cc2
-rw-r--r--chrome/browser/views/options/fonts_page_view.cc2
-rw-r--r--chrome/browser/views/options/fonts_page_view.h4
-rw-r--r--chrome/browser/views/options/general_page_view.cc2
-rw-r--r--chrome/browser/views/options/general_page_view.h2
-rw-r--r--chrome/browser/views/options/languages_page_view.cc2
-rw-r--r--chrome/browser/views/options/languages_page_view.h2
-rw-r--r--chrome/browser/views/options/options_page_view.cc2
-rw-r--r--chrome/browser/views/options/options_window_view.cc2
-rw-r--r--chrome/browser/views/options/passwords_page_view.cc2
-rw-r--r--chrome/browser/views/tabs/side_tab_strip.cc2
-rw-r--r--chrome/browser/views/task_manager_view.cc2
-rw-r--r--chrome/browser/views/toolbar_view.cc2
-rw-r--r--chrome/browser/views/toolbar_view.h2
-rw-r--r--chrome/browser/views/url_picker.cc2
-rw-r--r--chrome/browser/web_resource/web_resource_service.h2
-rw-r--r--chrome/browser/window_sizer.cc2
209 files changed, 2344 insertions, 219 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index bfd0e4c..acf1480 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -34,6 +34,8 @@
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/options_window.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/browser/profile_manager.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_ui_util.h"
@@ -42,8 +44,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
-#include "chrome/browser/profile_manager.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "net/base/net_util.h"
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index 1b0340d2..eca1038 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -18,10 +18,10 @@
#include "chrome/browser/dom_ui/history_ui.h"
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_canon_ip.h"
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc
index a1d971a..2708d47 100644
--- a/chrome/browser/autocomplete/history_url_provider.cc
+++ b/chrome/browser/autocomplete/history_url_provider.cc
@@ -14,9 +14,9 @@
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/history/history_database.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/sqlite_utils.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 704e077..2683e2c 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -14,11 +14,11 @@
#include "chrome/browser/google_util.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/url_util.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/autofill/autofill_infobar_delegate.cc b/chrome/browser/autofill/autofill_infobar_delegate.cc
index 0263cca..3e6582f 100644
--- a/chrome/browser/autofill/autofill_infobar_delegate.cc
+++ b/chrome/browser/autofill/autofill_infobar_delegate.cc
@@ -7,10 +7,10 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "chrome/browser/autofill/autofill_manager.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 33f7dcb0..31ae160 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -10,12 +10,12 @@
#include "chrome/browser/autofill/autofill_dialog.h"
#include "chrome/browser/autofill/autofill_infobar_delegate.h"
#include "chrome/browser/autofill/form_structure.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "webkit/glue/form_field.h"
#include "webkit/glue/form_field_values.h"
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index e7a51432..4fc54ea 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -47,6 +47,7 @@
#include "chrome/browser/login_prompt.h"
#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/net/url_request_mock_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -60,7 +61,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/test/automation/tab_proxy.h"
diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
index 6853d6a..007aeba 100644
--- a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
+++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
@@ -12,10 +12,10 @@
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/input_window_dialog.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
namespace {
diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc
index b6c0f46..50b8187 100755
--- a/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc
@@ -7,10 +7,10 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/browser/tab_contents/page_navigator.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/testing_profile.h"
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index 3ea7171..ad180b2 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -15,9 +15,9 @@
#include "chrome/browser/bookmarks/bookmark_storage.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_notifications.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
using base::Time;
diff --git a/chrome/browser/bookmarks/bookmark_storage.h b/chrome/browser/bookmarks/bookmark_storage.h
index 0edf5a0..033a849 100644
--- a/chrome/browser/bookmarks/bookmark_storage.h
+++ b/chrome/browser/bookmarks/bookmark_storage.h
@@ -9,7 +9,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/bookmarks/bookmark_index.h"
-#include "chrome/common/important_file_writer.h"
+#include "chrome/browser/important_file_writer.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
diff --git a/chrome/browser/bookmarks/bookmark_table_model.cc b/chrome/browser/bookmarks/bookmark_table_model.cc
index 9b4fd82..4d8b01a 100644
--- a/chrome/browser/bookmarks/bookmark_table_model.cc
+++ b/chrome/browser/bookmarks/bookmark_table_model.cc
@@ -13,9 +13,9 @@
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index accec3c..fe4ae6e 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -20,12 +20,12 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/history/query_parser.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_strings.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 8bfb10c6..ac41f0b 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -49,6 +49,7 @@
#include "chrome/browser/net/browser_url_util.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/options_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/site_instance.h"
@@ -72,7 +73,6 @@
#include "chrome/common/page_transition_types.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index bee4138..1dbf26e 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -14,6 +14,7 @@
#include "base/scoped_ptr.h"
#include "base/task.h"
#include "chrome/browser/command_updater.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/browser/tabs/tab_strip_model.h"
@@ -22,7 +23,6 @@
#include "chrome/browser/toolbar_model.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/page_zoom.h"
-#include "chrome/common/pref_member.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class BrowserWindow;
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index f2095c5..039d6d4 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/google_service_auth_error.h"
#include "chrome/browser/memory_details.h"
#include "chrome/browser/net/dns_global.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -37,7 +38,6 @@
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "chrome/renderer/about_handler.h"
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index 1c06693..a7589c7 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/first_run.h"
#include "chrome/browser/net/dns_global.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/search_engines/template_url_model.h"
@@ -37,7 +38,6 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/result_codes.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 3fb5ce9..57dd2d9 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -42,6 +42,7 @@
#include "chrome/browser/net/sdch_dictionary_fetcher.h"
#include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h"
#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
@@ -56,7 +57,6 @@
#include "chrome/common/main_function_params.h"
#include "chrome/common/net/net_resource_provider.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/result_codes.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/master_preferences.h"
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 590e0a9..cb4a529 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/net/sqlite_persistent_cookie_store.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -42,7 +43,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "ipc/ipc_logging.h"
#include "webkit/database/database_tracker.h"
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index 5b583b2..50342e1 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -20,13 +20,13 @@
#include "chrome/browser/jankometer.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/plugin_process_host.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "net/dns_global.h"
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc
index 5655a6d..b96e653 100644
--- a/chrome/browser/browser_theme_provider.cc
+++ b/chrome/browser/browser_theme_provider.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/browser_window.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/theme_resources_util.h"
#include "chrome/common/chrome_constants.h"
@@ -25,7 +26,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/theme_resources.h"
#include "net/base/file_stream.h"
diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc
index f8938fc..994de9f4 100644
--- a/chrome/browser/chromeos/login/user_manager.cc
+++ b/chrome/browser/chromeos/login/user_manager.cc
@@ -5,8 +5,8 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_service.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc
index d9aaaa1..3c21a1e 100644
--- a/chrome/browser/chromeos/options/system_page_view.cc
+++ b/chrome/browser/chromeos/options/system_page_view.cc
@@ -10,8 +10,8 @@
#include "app/combobox_model.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/chromeos/cros/language_library.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
#include "grit/generated_resources.h"
#include "unicode/timezone.h"
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index b3628b6..6bb2a70 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -6,10 +6,10 @@
#include "base/string_util.h"
#include "chrome/browser/chromeos/cros/synaptics_library.h"
+#include "chrome/browser/pref_member.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "unicode/timezone.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h
index b4a01be..0613335 100644
--- a/chrome/browser/chromeos/preferences.h
+++ b/chrome/browser/chromeos/preferences.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_CHROMEOS_PREFERENCES_H_
#define CHROME_BROWSER_CHROMEOS_PREFERENCES_H_
+#include "chrome/browser/pref_member.h"
#include "chrome/common/notification_observer.h"
-#include "chrome/common/pref_member.h"
class PrefService;
diff --git a/chrome/browser/chromeos/status/browser_status_area_view.cc b/chrome/browser/chromeos/status/browser_status_area_view.cc
index ead0eae..681c761 100755
--- a/chrome/browser/chromeos/status/browser_status_area_view.cc
+++ b/chrome/browser/chromeos/status/browser_status_area_view.cc
@@ -15,11 +15,11 @@
#include "chrome/browser/chromeos/frame/browser_view.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
#include "chrome/browser/chromeos/status/status_area_view.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/theme_background.h"
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm
index f2de2ee..f2a5687 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller.mm
@@ -28,11 +28,11 @@
#import "chrome/browser/cocoa/toolbar_controller.h"
#import "chrome/browser/cocoa/view_resizer.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/cocoa/bookmark_manager_controller.mm b/chrome/browser/cocoa/bookmark_manager_controller.mm
index da0ea67..99f57b0 100644
--- a/chrome/browser/cocoa/bookmark_manager_controller.mm
+++ b/chrome/browser/cocoa/bookmark_manager_controller.mm
@@ -16,9 +16,9 @@
#import "chrome/browser/cocoa/bookmark_item.h"
#import "chrome/browser/cocoa/bookmark_tree_controller.h"
#import "chrome/browser/cocoa/browser_window_controller.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm
index 47bdfac..4e5aaaf 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/cocoa/browser_window_cocoa.mm
@@ -29,11 +29,11 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/global_keyboard_shortcuts_mac.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
-#include "chrome/browser/profile.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/cocoa/browser_window_controller_private.mm b/chrome/browser/cocoa/browser_window_controller_private.mm
index 70a0b53..4b1ddd8 100644
--- a/chrome/browser/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/cocoa/browser_window_controller_private.mm
@@ -19,11 +19,11 @@
#import "chrome/browser/cocoa/tab_strip_controller.h"
#import "chrome/browser/cocoa/tab_strip_view.h"
#import "chrome/browser/cocoa/toolbar_controller.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
namespace {
diff --git a/chrome/browser/cocoa/browser_window_controller_unittest.mm b/chrome/browser/cocoa/browser_window_controller_unittest.mm
index e1318d1..47b8bea 100644
--- a/chrome/browser/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/browser_window_controller_unittest.mm
@@ -13,9 +13,9 @@
#include "chrome/browser/cocoa/browser_window_controller.h"
#include "chrome/browser/cocoa/cocoa_test_helper.h"
#include "chrome/browser/cocoa/find_bar_bridge.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/testing_browser_process.h"
#include "chrome/test/testing_profile.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/cocoa/clear_browsing_data_controller.mm b/chrome/browser/cocoa/clear_browsing_data_controller.mm
index 8f157f4..cc7bd92 100644
--- a/chrome/browser/cocoa/clear_browsing_data_controller.mm
+++ b/chrome/browser/cocoa/clear_browsing_data_controller.mm
@@ -8,9 +8,9 @@
#include "base/scoped_nsobject.h"
#include "base/singleton.h"
#include "chrome/browser/browsing_data_remover.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/pref_names.h"
NSString* const kClearBrowsingDataControllerDidDelete =
@"kClearBrowsingDataControllerDidDelete";
diff --git a/chrome/browser/cocoa/clear_browsing_data_controller_unittest.mm b/chrome/browser/cocoa/clear_browsing_data_controller_unittest.mm
index 48e1c81..cdb3fd4 100644
--- a/chrome/browser/cocoa/clear_browsing_data_controller_unittest.mm
+++ b/chrome/browser/cocoa/clear_browsing_data_controller_unittest.mm
@@ -9,9 +9,9 @@
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/clear_browsing_data_controller.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#import "third_party/ocmock/OCMock/OCMock.h"
diff --git a/chrome/browser/cocoa/font_language_settings_controller.h b/chrome/browser/cocoa/font_language_settings_controller.h
index 81c5d4b..173df84 100644
--- a/chrome/browser/cocoa/font_language_settings_controller.h
+++ b/chrome/browser/cocoa/font_language_settings_controller.h
@@ -6,7 +6,7 @@
#include "base/cocoa_protocols_mac.h"
#include "base/scoped_nsobject.h"
-#include "chrome/common/pref_member.h"
+#include "chrome/browser/pref_member.h"
class Profile;
diff --git a/chrome/browser/cocoa/font_language_settings_controller.mm b/chrome/browser/cocoa/font_language_settings_controller.mm
index 480653c..b7642c3 100644
--- a/chrome/browser/cocoa/font_language_settings_controller.mm
+++ b/chrome/browser/cocoa/font_language_settings_controller.mm
@@ -9,9 +9,9 @@
#include "base/sys_string_conversions.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/fonts_languages_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
NSString* const kCharacterInfoEncoding = @"encoding";
NSString* const kCharacterInfoName = @"name";
diff --git a/chrome/browser/cocoa/keystone_infobar.mm b/chrome/browser/cocoa/keystone_infobar.mm
index 0da4846..2cf13e5 100644
--- a/chrome/browser/cocoa/keystone_infobar.mm
+++ b/chrome/browser/cocoa/keystone_infobar.mm
@@ -17,13 +17,13 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/first_run.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm b/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm
index 5495235..c5dc4ec 100644
--- a/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm
+++ b/chrome/browser/cocoa/keyword_editor_cocoa_controller.mm
@@ -11,10 +11,10 @@
#import "chrome/browser/cocoa/edit_search_engine_cocoa_controller.h"
#import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h"
#import "chrome/browser/cocoa/window_size_autosaver.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_table_model.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "skia/ext/skia_utils_mac.h"
#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
diff --git a/chrome/browser/cocoa/page_info_window_controller.mm b/chrome/browser/cocoa/page_info_window_controller.mm
index 144cfcb..988f6b9 100644
--- a/chrome/browser/cocoa/page_info_window_controller.mm
+++ b/chrome/browser/cocoa/page_info_window_controller.mm
@@ -10,8 +10,8 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/cocoa/page_info_window_mac.h"
#include "chrome/browser/cocoa/window_size_autosaver.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/theme_resources.h"
@implementation PageInfoWindowController
diff --git a/chrome/browser/cocoa/preferences_window_controller.h b/chrome/browser/cocoa/preferences_window_controller.h
index 167ca94..0fd7d5c 100644
--- a/chrome/browser/cocoa/preferences_window_controller.h
+++ b/chrome/browser/cocoa/preferences_window_controller.h
@@ -7,7 +7,7 @@
#include "base/scoped_ptr.h"
#include "base/scoped_nsobject.h"
#include "chrome/browser/options_window.h"
-#include "chrome/common/pref_member.h"
+#include "chrome/browser/pref_member.h"
class PersonalDataManagerObserver;
@class CookiesWindowController;
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index 08720c7..af59f2d 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -31,6 +31,7 @@
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/options_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/session_startup_pref.h"
@@ -42,7 +43,6 @@
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "chrome/installer/util/google_update_settings.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm
index b86186f..131d38c 100644
--- a/chrome/browser/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/cocoa/tab_contents_controller.mm
@@ -8,10 +8,10 @@
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
// Default offset of the contents splitter in pixels.
static const int kDefaultContentsSplitOffset = 400;
diff --git a/chrome/browser/cocoa/toolbar_controller.h b/chrome/browser/cocoa/toolbar_controller.h
index 51ef250..efce7e1 100644
--- a/chrome/browser/cocoa/toolbar_controller.h
+++ b/chrome/browser/cocoa/toolbar_controller.h
@@ -13,7 +13,7 @@
#import "chrome/browser/cocoa/delayedmenu_button.h"
#import "chrome/browser/cocoa/url_drop_target.h"
#import "chrome/browser/cocoa/view_resizer.h"
-#include "chrome/common/pref_member.h"
+#include "chrome/browser/pref_member.h"
class AppMenuModel;
@class AutocompleteTextField;
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index 09080cb..f7a441c 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -31,6 +31,7 @@
#import "chrome/browser/cocoa/toolbar_view.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/page_menu_model.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -39,7 +40,6 @@
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/cocoa/toolbar_controller_unittest.mm b/chrome/browser/cocoa/toolbar_controller_unittest.mm
index d2cc1d2..dab5cba 100644
--- a/chrome/browser/cocoa/toolbar_controller_unittest.mm
+++ b/chrome/browser/cocoa/toolbar_controller_unittest.mm
@@ -11,8 +11,8 @@
#import "chrome/browser/cocoa/gradient_button_cell.h"
#import "chrome/browser/cocoa/toolbar_controller.h"
#import "chrome/browser/cocoa/view_resizer_pong.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/chrome/browser/cocoa/window_size_autosaver.mm b/chrome/browser/cocoa/window_size_autosaver.mm
index d8c0f77..4db6f28 100644
--- a/chrome/browser/cocoa/window_size_autosaver.mm
+++ b/chrome/browser/cocoa/window_size_autosaver.mm
@@ -6,7 +6,7 @@
#import "chrome/browser/cocoa/window_size_autosaver.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
@interface WindowSizeAutosaver (Private)
- (void)save:(NSNotification*)notification;
@@ -25,7 +25,7 @@
path_ = path;
state_ = state;
- [self restore];
+ [self restore];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(save:)
diff --git a/chrome/browser/cocoa/window_size_autosaver_unittest.mm b/chrome/browser/cocoa/window_size_autosaver_unittest.mm
index e5460d4..6507a85 100644
--- a/chrome/browser/cocoa/window_size_autosaver_unittest.mm
+++ b/chrome/browser/cocoa/window_size_autosaver_unittest.mm
@@ -9,7 +9,7 @@
#include "base/scoped_nsobject.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/chrome/browser/cookie_modal_dialog.cc b/chrome/browser/cookie_modal_dialog.cc
index c953fb5..1200d3f 100644
--- a/chrome/browser/cookie_modal_dialog.cc
+++ b/chrome/browser/cookie_modal_dialog.cc
@@ -5,11 +5,11 @@
#include "chrome/browser/cookie_modal_dialog.h"
#include "chrome/browser/host_content_settings_map.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/cookie_prompt_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
// Cookies
CookiePromptModalDialog::CookiePromptModalDialog(
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc
index 4bf9825..f55dbba 100644
--- a/chrome/browser/debugger/devtools_manager.cc
+++ b/chrome/browser/debugger/devtools_manager.cc
@@ -13,13 +13,13 @@
#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/debugger/devtools_window.h"
#include "chrome/browser/debugger/devtools_client_host.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/devtools_messages.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
// static
diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc
index aa1e638..90bbf212 100644
--- a/chrome/browser/debugger/devtools_window.cc
+++ b/chrome/browser/debugger/devtools_window.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/browser_window.h"
#include "chrome/browser/debugger/devtools_manager.h"
#include "chrome/browser/debugger/devtools_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
@@ -20,7 +21,6 @@
#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index 805852e..9e82aec6 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -18,11 +18,11 @@
#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/browser/history/page_usage_data.h"
#include "chrome/browser/history/history.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/notification_source.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
index 30c3172..f711709 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -10,11 +10,11 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
#include "net/base/cookie_monster.h"
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 2eb5702..7b01684 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -23,16 +23,16 @@
#include "chrome/browser/dom_ui/shown_sections_handler.h"
#include "chrome/browser/dom_ui/tips_handler.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/sessions/session_types.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
index 46996d1..d2ad788 100644
--- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc
+++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
@@ -7,8 +7,8 @@
#include "base/file_path.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc
index 9ff8799..85b8e18 100644
--- a/chrome/browser/dom_ui/ntp_resource_cache.cc
+++ b/chrome/browser/dom_ui/ntp_resource_cache.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/browser/google_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/user_data_manager.h"
#include "chrome/common/chrome_switches.h"
@@ -26,7 +27,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc
index b9c63ef..6b92a9a 100644
--- a/chrome/browser/dom_ui/shown_sections_handler.cc
+++ b/chrome/browser/dom_ui/shown_sections_handler.cc
@@ -7,9 +7,9 @@
#include "base/callback.h"
#include "base/string_util.h"
#include "base/values.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
void ShownSectionsHandler::RegisterMessages() {
dom_ui_->RegisterMessageCallback("getShownSections",
diff --git a/chrome/browser/dom_ui/shown_sections_handler_unittest.cc b/chrome/browser/dom_ui/shown_sections_handler_unittest.cc
index 6b77e01..64cbba6 100644
--- a/chrome/browser/dom_ui/shown_sections_handler_unittest.cc
+++ b/chrome/browser/dom_ui/shown_sections_handler_unittest.cc
@@ -6,8 +6,8 @@
#include "base/file_path.h"
#include "base/scoped_ptr.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
class ShownSectionsHandlerTest : public testing::Test {
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 5696cd3..2eb8f54 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -43,7 +44,6 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index 3ab0a53..bd51c0e 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -50,8 +50,8 @@
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/history/download_types.h"
#include "chrome/browser/history/history.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/shell_dialogs.h"
-#include "chrome/common/pref_member.h"
class DownloadFileManager;
class DownloadItemView;
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 3f45115..36b090f 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/download/save_file_manager.h"
#include "chrome/browser/download/save_item.h"
#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -35,7 +36,6 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
#include "net/base/io_buffer.h"
diff --git a/chrome/browser/encoding_menu_controller.cc b/chrome/browser/encoding_menu_controller.cc
index 72b086f..69871a1 100644
--- a/chrome/browser/encoding_menu_controller.cc
+++ b/chrome/browser/encoding_menu_controller.cc
@@ -8,9 +8,9 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/character_encoding.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
const int EncodingMenuController::kValidEncodingIds[] = {
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
index 9385ff1..993cb05 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.cc
+++ b/chrome/browser/extensions/extension_bookmarks_module.cc
@@ -15,10 +15,10 @@
#include "chrome/browser/extensions/extension_bookmarks_module_constants.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/extensions/extensions_quota_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
namespace keys = extension_bookmarks_module_constants;
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
index 3428869..d3da8cc 100644
--- a/chrome/browser/extensions/extension_dom_ui.cc
+++ b/chrome/browser/extensions/extension_dom_ui.cc
@@ -8,11 +8,11 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/extensions/extensions_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/bindings_policy.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
namespace {
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 4ca6e18..c3fdeae 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/in_process_webkit/dom_storage_context.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/browser/message_box_handler.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -37,7 +38,6 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/view_types.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/extensions/extension_i18n_api.cc b/chrome/browser/extensions/extension_i18n_api.cc
index 7789c52..c39b5d9 100644
--- a/chrome/browser/extensions/extension_i18n_api.cc
+++ b/chrome/browser/extensions/extension_i18n_api.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/extensions/extension_i18n_api.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
namespace {
// Errors.
diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h
index 77f64901..1d16631 100644
--- a/chrome/browser/extensions/extension_prefs.h
+++ b/chrome/browser/extensions/extension_prefs.h
@@ -12,8 +12,8 @@
#include "base/linked_ptr.h"
#include "base/task.h"
#include "base/time.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
// Class for managing global and per-extension preferences.
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index e6472d5..8480ac2 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -19,13 +19,13 @@
#include "base/version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extensions_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/utility_process_host.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_error_reporter.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc
index 9439638..bc28387 100644
--- a/chrome/browser/extensions/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/extension_updater_unittest.cc
@@ -13,11 +13,11 @@
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/net/test_url_fetcher_factory.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_error_reporter.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 476f640..7b98410 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/extensions/external_extension_provider.h"
#include "chrome/browser/extensions/external_pref_extension_provider.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/common/child_process_logging.h"
@@ -36,7 +37,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#if defined(OS_WIN)
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 14ab20c..a177f59 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/google_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
@@ -39,7 +40,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/external_protocol_handler.cc b/chrome/browser/external_protocol_handler.cc
index 6855bdc..80b60e2 100644
--- a/chrome/browser/external_protocol_handler.cc
+++ b/chrome/browser/external_protocol_handler.cc
@@ -14,8 +14,8 @@
#include "base/thread.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process_impl.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/platform_util.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/pref_names.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc
index da9e324..d9ca211 100644
--- a/chrome/browser/first_run.cc
+++ b/chrome/browser/first_run.cc
@@ -14,9 +14,9 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
namespace {
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 288fd56..3d2c86a 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -31,13 +31,13 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/hang_monitor/hung_window_detector.h"
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/views/first_run_view.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/result_codes.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
diff --git a/chrome/browser/form_field_history_manager.cc b/chrome/browser/form_field_history_manager.cc
index d4d64fe..12450e9 100644
--- a/chrome/browser/form_field_history_manager.cc
+++ b/chrome/browser/form_field_history_manager.cc
@@ -7,11 +7,11 @@
#include <vector>
#include "base/string_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "webkit/glue/form_field_values.h"
// Limit on the number of suggestions to appear in the pop-up menu under an
diff --git a/chrome/browser/form_field_history_manager.h b/chrome/browser/form_field_history_manager.h
index 3672253..0c6e945 100644
--- a/chrome/browser/form_field_history_manager.h
+++ b/chrome/browser/form_field_history_manager.h
@@ -7,9 +7,9 @@
#include <string>
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/webdata/web_data_service.h"
-#include "chrome/common/pref_member.h"
namespace webkit_glue {
class FormFieldValues;
diff --git a/chrome/browser/geolocation/access_token_store.cc b/chrome/browser/geolocation/access_token_store.cc
index 9c5388f..d037887 100644
--- a/chrome/browser/geolocation/access_token_store.cc
+++ b/chrome/browser/geolocation/access_token_store.cc
@@ -8,8 +8,8 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
namespace {
diff --git a/chrome/browser/google_url_tracker.cc b/chrome/browser/google_url_tracker.cc
index 8b60ae4..07f7103d 100644
--- a/chrome/browser/google_url_tracker.cc
+++ b/chrome/browser/google_url_tracker.cc
@@ -7,10 +7,10 @@
#include "base/compiler_specific.h"
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index b4f48b8..18e4766 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/gtk/view_id_util.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/ntp_background_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -41,7 +42,6 @@
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc b/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc
index 4945715..db6547b 100644
--- a/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc
+++ b/chrome/browser/gtk/bookmark_editor_gtk_unittest.cc
@@ -7,11 +7,11 @@
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/profile.h"
#include "chrome/browser/gtk/bookmark_editor_gtk.h"
#include "chrome/browser/gtk/bookmark_tree_model.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc
index 73031b5..8eb2104 100644
--- a/chrome/browser/gtk/bookmark_manager_gtk.cc
+++ b/chrome/browser/gtk/bookmark_manager_gtk.cc
@@ -23,12 +23,12 @@
#include "chrome/browser/gtk/bookmark_utils_gtk.h"
#include "chrome/browser/gtk/menu_gtk.h"
#include "chrome/browser/importer/importer.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/gtk/browser_titlebar.cc
index 8047b60..2f51106 100644
--- a/chrome/browser/gtk/browser_titlebar.cc
+++ b/chrome/browser/gtk/browser_titlebar.cc
@@ -28,12 +28,12 @@
#include "chrome/browser/gtk/standard_menus.h"
#include "chrome/browser/gtk/tabs/tab_strip_gtk.h"
#include "chrome/browser/page_menu_model.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index 8976e52..af78212 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -37,6 +37,7 @@
#include "chrome/browser/gtk/toolbar_star_toggle_gtk.h"
#include "chrome/browser/gtk/view_id_util.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -45,7 +46,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h
index 33480cb..8624659 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_toolbar_gtk.h
@@ -16,11 +16,11 @@
#include "chrome/browser/gtk/menu_bar_helper.h"
#include "chrome/browser/gtk/menu_gtk.h"
#include "chrome/browser/page_menu_model.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/owned_widget_gtk.h"
-#include "chrome/common/pref_member.h"
class BackForwardButtonGtk;
class Browser;
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 2f9e737..e0c965e 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -69,6 +69,7 @@
#include "chrome/browser/gtk/toolbar_star_toggle_gtk.h"
#include "chrome/browser/location_bar.h"
#include "chrome/browser/page_info_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
@@ -79,7 +80,6 @@
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index 0cf15a6..69805c7 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -15,9 +15,9 @@
#include "base/timer.h"
#include "build/build_config.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/common/notification_registrar.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/x11_util.h"
class BookmarkBarGtk;
diff --git a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
index aec7f1b..1e2e533 100644
--- a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
+++ b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
@@ -10,10 +10,10 @@
#include "chrome/browser/browsing_data_remover.h"
#include "chrome/browser/gtk/browser_window_gtk.h"
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc
index dbf01c1..16adcdb 100644
--- a/chrome/browser/gtk/gtk_theme_provider.cc
+++ b/chrome/browser/gtk/gtk_theme_provider.cc
@@ -16,8 +16,8 @@
#include "chrome/browser/gtk/cairo_cached_surface.h"
#include "chrome/browser/gtk/gtk_chrome_button.h"
#include "chrome/browser/gtk/meta_frames.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_source.h"
diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc
index 1ce4889..35d3856 100644
--- a/chrome/browser/gtk/options/advanced_contents_gtk.cc
+++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc
@@ -26,12 +26,12 @@
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/options_page_base.h"
#include "chrome/browser/options_util.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/gtk_util.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/process_watcher.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/gtk/options/advanced_page_gtk.h b/chrome/browser/gtk/options/advanced_page_gtk.h
index 151502b..5ead33c 100644
--- a/chrome/browser/gtk/options/advanced_page_gtk.h
+++ b/chrome/browser/gtk/options/advanced_page_gtk.h
@@ -9,7 +9,7 @@
#include "chrome/browser/gtk/options/advanced_contents_gtk.h"
#include "chrome/browser/options_page_base.h"
-#include "chrome/common/pref_member.h"
+#include "chrome/browser/pref_member.h"
class Profile;
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc
index 901c70a..18ea8c2 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_page_gtk.cc
@@ -16,11 +16,11 @@
#include "chrome/browser/gtk/import_dialog_gtk.h"
#include "chrome/browser/gtk/options/options_layout_gtk.h"
#include "chrome/browser/gtk/options/passwords_exceptions_window_gtk.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/gtk/options/content_page_gtk.h b/chrome/browser/gtk/options/content_page_gtk.h
index 1dbab9c..8552ec0 100644
--- a/chrome/browser/gtk/options/content_page_gtk.h
+++ b/chrome/browser/gtk/options/content_page_gtk.h
@@ -9,9 +9,9 @@
#include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/options_page_base.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/common/pref_member.h"
class ContentPageGtk : public OptionsPageBase,
public ProfileSyncServiceObserver,
diff --git a/chrome/browser/gtk/options/content_settings_window_gtk.cc b/chrome/browser/gtk/options/content_settings_window_gtk.cc
index 4b2b0c7..eeaecd5 100644
--- a/chrome/browser/gtk/options/content_settings_window_gtk.cc
+++ b/chrome/browser/gtk/options/content_settings_window_gtk.cc
@@ -9,12 +9,12 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/gtk/browser_window_gtk.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/content_settings_types.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/gtk/options/content_settings_window_gtk.h b/chrome/browser/gtk/options/content_settings_window_gtk.h
index 40d5789..d6a1b91 100644
--- a/chrome/browser/gtk/options/content_settings_window_gtk.h
+++ b/chrome/browser/gtk/options/content_settings_window_gtk.h
@@ -11,8 +11,8 @@
#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
#include "chrome/browser/gtk/options/cookie_filter_page_gtk.h"
#include "chrome/browser/gtk/options/content_filter_page_gtk.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/common/content_settings_types.h"
-#include "chrome/common/pref_member.h"
class AccessibleWidgetHelper;
diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.h b/chrome/browser/gtk/options/cookie_filter_page_gtk.h
index e18f6db..7d805ca 100644
--- a/chrome/browser/gtk/options/cookie_filter_page_gtk.h
+++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.h
@@ -10,7 +10,7 @@
#include <string>
#include "chrome/browser/options_page_base.h"
-#include "chrome/common/pref_member.h"
+#include "chrome/browser/pref_member.h"
class Profile;
diff --git a/chrome/browser/gtk/options/fonts_page_gtk.h b/chrome/browser/gtk/options/fonts_page_gtk.h
index 017d8f5..31e3fd3 100644
--- a/chrome/browser/gtk/options/fonts_page_gtk.h
+++ b/chrome/browser/gtk/options/fonts_page_gtk.h
@@ -12,8 +12,8 @@
#include <vector>
#include "chrome/browser/character_encoding.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/options_page_base.h"
-#include "chrome/common/pref_member.h"
class FontsPageGtk : public OptionsPageBase {
public:
diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc
index 1396314..78aa693 100644
--- a/chrome/browser/gtk/options/general_page_gtk.cc
+++ b/chrome/browser/gtk/options/general_page_gtk.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/gtk/options/options_layout_gtk.h"
#include "chrome/browser/gtk/options/url_picker_dialog_gtk.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/session_startup_pref.h"
@@ -20,7 +21,6 @@
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/gtk/options/general_page_gtk.h b/chrome/browser/gtk/options/general_page_gtk.h
index efbf8d0..b394e6f 100644
--- a/chrome/browser/gtk/options/general_page_gtk.h
+++ b/chrome/browser/gtk/options/general_page_gtk.h
@@ -12,9 +12,9 @@
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/options_page_base.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/shell_integration.h"
-#include "chrome/common/pref_member.h"
#include "googleurl/src/gurl.h"
class Profile;
diff --git a/chrome/browser/gtk/options/languages_page_gtk.h b/chrome/browser/gtk/options/languages_page_gtk.h
index 32ac703..4c396f3 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.h
+++ b/chrome/browser/gtk/options/languages_page_gtk.h
@@ -17,9 +17,9 @@
#include <string>
#include "base/scoped_ptr.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/options_page_base.h"
#include "chrome/common/gtk_tree.h"
-#include "chrome/common/pref_member.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class LanguageComboboxModel;
diff --git a/chrome/browser/gtk/options/options_window_gtk.cc b/chrome/browser/gtk/options/options_window_gtk.cc
index 82d868f..80b5642 100644
--- a/chrome/browser/gtk/options/options_window_gtk.cc
+++ b/chrome/browser/gtk/options/options_window_gtk.cc
@@ -16,14 +16,14 @@
#include "chrome/browser/gtk/options/advanced_page_gtk.h"
#include "chrome/browser/gtk/options/content_page_gtk.h"
#include "chrome/browser/gtk/options/general_page_gtk.h"
+#include "chrome/browser/pref_member.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/window_sizer.h"
#include "chrome/common/accessibility_events.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
index 7d77726..265289e 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
+++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
@@ -7,10 +7,10 @@
#include "app/gfx/gtk_util.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/gtk_tree.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/gtk/options/passwords_page_gtk.cc b/chrome/browser/gtk/options/passwords_page_gtk.cc
index 834fdbe..023ebb0 100644
--- a/chrome/browser/gtk/options/passwords_page_gtk.cc
+++ b/chrome/browser/gtk/options/passwords_page_gtk.cc
@@ -7,10 +7,10 @@
#include "app/gfx/gtk_util.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/gtk_tree.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
index 026c29f..b08eef7 100644
--- a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
+++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
@@ -10,11 +10,11 @@
#include "chrome/browser/gtk/options/url_picker_dialog_gtk.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/possible_url_model.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/gtk_tree.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc
index 361b4fa..af80035 100644
--- a/chrome/browser/gtk/task_manager_gtk.cc
+++ b/chrome/browser/gtk/task_manager_gtk.cc
@@ -19,10 +19,10 @@
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/menu_gtk.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/gtk_tree.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc
index 9ae31a3..096566d 100644
--- a/chrome/browser/host_content_settings_map.cc
+++ b/chrome/browser/host_content_settings_map.cc
@@ -6,11 +6,11 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "net/base/static_cookie_policy.h"
diff --git a/chrome/browser/host_zoom_map.cc b/chrome/browser/host_zoom_map.cc
index a60bf97..f912ac4 100644
--- a/chrome/browser/host_zoom_map.cc
+++ b/chrome/browser/host_zoom_map.cc
@@ -6,9 +6,9 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
HostZoomMap::HostZoomMap(Profile* profile) : profile_(profile) {
const DictionaryValue* host_zoom_dictionary =
diff --git a/chrome/browser/important_file_writer.cc b/chrome/browser/important_file_writer.cc
new file mode 100644
index 0000000..9dd8f9e
--- /dev/null
+++ b/chrome/browser/important_file_writer.cc
@@ -0,0 +1,143 @@
+// Copyright (c) 2009 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.
+
+#include "chrome/browser/important_file_writer.h"
+
+#include <stdio.h>
+
+#include <ostream>
+#include <string>
+
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/logging.h"
+#include "base/string_util.h"
+#include "base/task.h"
+#include "base/thread.h"
+#include "base/time.h"
+#include "chrome/browser/chrome_thread.h"
+
+using base::TimeDelta;
+
+namespace {
+
+const int kDefaultCommitIntervalMs = 10000;
+
+class WriteToDiskTask : public Task {
+ public:
+ WriteToDiskTask(const FilePath& path, const std::string& data)
+ : path_(path),
+ data_(data) {
+ }
+
+ virtual void Run() {
+ // Write the data to a temp file then rename to avoid data loss if we crash
+ // while writing the file. Ensure that the temp file is on the same volume
+ // as target file, so it can be moved in one step, and that the temp file
+ // is securely created.
+ FilePath tmp_file_path;
+ FILE* tmp_file = file_util::CreateAndOpenTemporaryFileInDir(
+ path_.DirName(), &tmp_file_path);
+ if (!tmp_file) {
+ LogFailure("could not create temporary file");
+ return;
+ }
+
+ size_t bytes_written = fwrite(data_.data(), 1, data_.length(), tmp_file);
+ if (!file_util::CloseFile(tmp_file)) {
+ file_util::Delete(tmp_file_path, false);
+ LogFailure("failed to close temporary file");
+ return;
+ }
+ if (bytes_written < data_.length()) {
+ file_util::Delete(tmp_file_path, false);
+ LogFailure("error writing, bytes_written=" + UintToString(bytes_written));
+ return;
+ }
+
+ if (file_util::ReplaceFile(tmp_file_path, path_)) {
+ LogSuccess();
+ return;
+ }
+
+ file_util::Delete(tmp_file_path, false);
+ LogFailure("could not rename temporary file");
+ }
+
+ private:
+ void LogSuccess() {
+ LOG(INFO) << "successfully saved " << path_.value();
+ }
+
+ void LogFailure(const std::string& message) {
+ LOG(WARNING) << "failed to write " << path_.value()
+ << ": " << message;
+ }
+
+ const FilePath path_;
+ const std::string data_;
+
+ DISALLOW_COPY_AND_ASSIGN(WriteToDiskTask);
+};
+
+} // namespace
+
+ImportantFileWriter::ImportantFileWriter(const FilePath& path)
+ : path_(path),
+ serializer_(NULL),
+ commit_interval_(TimeDelta::FromMilliseconds(kDefaultCommitIntervalMs)) {
+ DCHECK(CalledOnValidThread());
+}
+
+ImportantFileWriter::~ImportantFileWriter() {
+ // We're usually a member variable of some other object, which also tends
+ // to be our serializer. It may not be safe to call back to the parent object
+ // being destructed.
+ DCHECK(!HasPendingWrite());
+}
+
+bool ImportantFileWriter::HasPendingWrite() const {
+ DCHECK(CalledOnValidThread());
+ return timer_.IsRunning();
+}
+
+void ImportantFileWriter::WriteNow(const std::string& data) {
+ DCHECK(CalledOnValidThread());
+
+ if (HasPendingWrite())
+ timer_.Stop();
+
+ ChromeThread::PostTask(
+ ChromeThread::FILE, FROM_HERE, new WriteToDiskTask(path_, data));
+}
+
+void ImportantFileWriter::ScheduleWrite(DataSerializer* serializer) {
+ DCHECK(CalledOnValidThread());
+
+ DCHECK(serializer);
+ serializer_ = serializer;
+
+ if (!MessageLoop::current()) {
+ // Happens in unit tests.
+ DoScheduledWrite();
+ return;
+ }
+
+ if (!timer_.IsRunning()) {
+ timer_.Start(commit_interval_, this,
+ &ImportantFileWriter::DoScheduledWrite);
+ }
+}
+
+void ImportantFileWriter::DoScheduledWrite() {
+ DCHECK(serializer_);
+ std::string data;
+ if (serializer_->SerializeData(&data)) {
+ WriteNow(data);
+ } else {
+ LOG(WARNING) << "failed to serialize data to be saved in "
+ << path_.value();
+ }
+ serializer_ = NULL;
+}
diff --git a/chrome/browser/important_file_writer.h b/chrome/browser/important_file_writer.h
new file mode 100644
index 0000000..c78d250
--- /dev/null
+++ b/chrome/browser/important_file_writer.h
@@ -0,0 +1,104 @@
+// Copyright (c) 2009 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.
+
+#ifndef CHROME_BROWSER_IMPORTANT_FILE_WRITER_H_
+#define CHROME_BROWSER_IMPORTANT_FILE_WRITER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "base/non_thread_safe.h"
+#include "base/time.h"
+#include "base/timer.h"
+
+namespace base {
+class Thread;
+}
+
+// Helper to ensure that a file won't be corrupted by the write (for example on
+// application crash). Consider a naive way to save an important file F:
+//
+// 1. Open F for writing, truncating it.
+// 2. Write new data to F.
+//
+// It's good when it works, but it gets very bad if step 2. doesn't complete.
+// It can be caused by a crash, a computer hang, or a weird I/O error. And you
+// end up with a broken file.
+//
+// To be safe, we don't start with writing directly to F. Instead, we write to
+// to a temporary file. Only after that write is successful, we rename the
+// temporary file to target filename.
+//
+// If you want to know more about this approach and ext3/ext4 fsync issues, see
+// http://valhenson.livejournal.com/37921.html
+class ImportantFileWriter : public NonThreadSafe {
+ public:
+ // Used by ScheduleSave to lazily provide the data to be saved. Allows us
+ // to also batch data serializations.
+ class DataSerializer {
+ public:
+ virtual ~DataSerializer() {}
+
+ // Should put serialized string in |data| and return true on successful
+ // serialization. Will be called on the same thread on which
+ // ImportantFileWriter has been created.
+ virtual bool SerializeData(std::string* data) = 0;
+ };
+
+ // Initialize the writer.
+ // |path| is the name of file to write.
+ // All non-const methods, ctor and dtor must be called on the same thread.
+ explicit ImportantFileWriter(const FilePath& path);
+
+ // You have to ensure that there are no pending writes at the moment
+ // of destruction.
+ ~ImportantFileWriter();
+
+ FilePath path() const { return path_; }
+
+ // Returns true if there is a scheduled write pending which has not yet
+ // been started.
+ bool HasPendingWrite() const;
+
+ // Save |data| to target filename. Does not block. If there is a pending write
+ // scheduled by ScheduleWrite, it is cancelled.
+ void WriteNow(const std::string& data);
+
+ // Schedule a save to target filename. Data will be serialized and saved
+ // to disk after the commit interval. If another ScheduleWrite is issued
+ // before that, only one serialization and write to disk will happen, and
+ // the most recent |serializer| will be used. This operation does not block.
+ // |serializer| should remain valid through the lifetime of
+ // ImportantFileWriter.
+ void ScheduleWrite(DataSerializer* serializer);
+
+ // Serialize data pending to be saved and execute write on backend thread.
+ void DoScheduledWrite();
+
+ base::TimeDelta commit_interval() const {
+ return commit_interval_;
+ }
+
+ void set_commit_interval(const base::TimeDelta& interval) {
+ commit_interval_ = interval;
+ }
+
+ private:
+ // Path being written to.
+ const FilePath path_;
+
+ // Timer used to schedule commit after ScheduleWrite.
+ base::OneShotTimer<ImportantFileWriter> timer_;
+
+ // Serializer which will provide the data to be saved.
+ DataSerializer* serializer_;
+
+ // Time delta after which scheduled data will be written to disk.
+ base::TimeDelta commit_interval_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImportantFileWriter);
+};
+
+#endif // CHROME_BROWSER_IMPORTANT_FILE_WRITER_H_
diff --git a/chrome/browser/important_file_writer_unittest.cc b/chrome/browser/important_file_writer_unittest.cc
new file mode 100644
index 0000000..69bb00a
--- /dev/null
+++ b/chrome/browser/important_file_writer_unittest.cc
@@ -0,0 +1,113 @@
+// Copyright (c) 2009 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.
+
+#include "chrome/browser/important_file_writer.h"
+
+#include "base/compiler_specific.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/logging.h"
+#include "base/message_loop.h"
+#include "base/scoped_temp_dir.h"
+#include "base/thread.h"
+#include "base/time.h"
+#include "chrome/browser/chrome_thread.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+std::string GetFileContent(const FilePath& path) {
+ std::string content;
+ if (!file_util::ReadFileToString(path, &content)) {
+ NOTREACHED();
+ }
+ return content;
+}
+
+class DataSerializer : public ImportantFileWriter::DataSerializer {
+ public:
+ explicit DataSerializer(const std::string& data) : data_(data) {
+ }
+
+ virtual bool SerializeData(std::string* output) {
+ output->assign(data_);
+ return true;
+ }
+
+ private:
+ const std::string data_;
+};
+
+} // namespace
+
+class ImportantFileWriterTest : public testing::Test {
+ public:
+ ImportantFileWriterTest() : file_thread_(ChromeThread::FILE, &loop_) { }
+ virtual void SetUp() {
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ file_ = temp_dir_.path().AppendASCII("test-file");
+ }
+
+ protected:
+ FilePath file_;
+ MessageLoop loop_;
+
+ private:
+ ChromeThread file_thread_;
+ ScopedTempDir temp_dir_;
+};
+
+TEST_F(ImportantFileWriterTest, Basic) {
+ ImportantFileWriter writer(file_);
+ EXPECT_FALSE(file_util::PathExists(writer.path()));
+ writer.WriteNow("foo");
+ loop_.RunAllPending();
+
+ ASSERT_TRUE(file_util::PathExists(writer.path()));
+ EXPECT_EQ("foo", GetFileContent(writer.path()));
+}
+
+TEST_F(ImportantFileWriterTest, ScheduleWrite) {
+ ImportantFileWriter writer(file_);
+ writer.set_commit_interval(base::TimeDelta::FromMilliseconds(25));
+ EXPECT_FALSE(writer.HasPendingWrite());
+ DataSerializer serializer("foo");
+ writer.ScheduleWrite(&serializer);
+ EXPECT_TRUE(writer.HasPendingWrite());
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ new MessageLoop::QuitTask(), 100);
+ MessageLoop::current()->Run();
+ EXPECT_FALSE(writer.HasPendingWrite());
+ ASSERT_TRUE(file_util::PathExists(writer.path()));
+ EXPECT_EQ("foo", GetFileContent(writer.path()));
+}
+
+TEST_F(ImportantFileWriterTest, DoScheduledWrite) {
+ ImportantFileWriter writer(file_);
+ EXPECT_FALSE(writer.HasPendingWrite());
+ DataSerializer serializer("foo");
+ writer.ScheduleWrite(&serializer);
+ EXPECT_TRUE(writer.HasPendingWrite());
+ writer.DoScheduledWrite();
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ new MessageLoop::QuitTask(), 100);
+ MessageLoop::current()->Run();
+ EXPECT_FALSE(writer.HasPendingWrite());
+ ASSERT_TRUE(file_util::PathExists(writer.path()));
+ EXPECT_EQ("foo", GetFileContent(writer.path()));
+}
+
+TEST_F(ImportantFileWriterTest, BatchingWrites) {
+ ImportantFileWriter writer(file_);
+ writer.set_commit_interval(base::TimeDelta::FromMilliseconds(25));
+ DataSerializer foo("foo"), bar("bar"), baz("baz");
+ writer.ScheduleWrite(&foo);
+ writer.ScheduleWrite(&bar);
+ writer.ScheduleWrite(&baz);
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ new MessageLoop::QuitTask(), 100);
+ MessageLoop::current()->Run();
+ ASSERT_TRUE(file_util::PathExists(writer.path()));
+ EXPECT_EQ("baz", GetFileContent(writer.path()));
+}
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 359790b..e903f77 100644
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -15,12 +15,12 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/importer/firefox_profile_lock.h"
#include "chrome/browser/importer/importer_bridge.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "skia/ext/image_operations.h"
#include "webkit/glue/image_decoder.h"
diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc
index 04b0a5a..3a527f6 100644
--- a/chrome/browser/intranet_redirect_detector.cc
+++ b/chrome/browser/intranet_redirect_detector.cc
@@ -8,10 +8,10 @@
#include "base/stl_util-inl.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/registry_controlled_domain.h"
diff --git a/chrome/browser/language_combobox_model.cc b/chrome/browser/language_combobox_model.cc
index 6114573..922e5b84 100644
--- a/chrome/browser/language_combobox_model.cc
+++ b/chrome/browser/language_combobox_model.cc
@@ -8,7 +8,7 @@
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/user_metrics.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
#include "grit/generated_resources.h"
#include "unicode/uloc.h"
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 4ce5273..6ddb61e 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -15,9 +15,9 @@
#include "base/third_party/nspr/prtime.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name)
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index a1b8903..dbd48fa 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -174,6 +174,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/load_notification_details.h"
#include "chrome/browser/memory_details.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/search_engines/template_url_model.h"
@@ -182,7 +183,6 @@
#include "chrome/common/histogram_synchronizer.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "webkit/glue/plugins/plugin_list.h"
diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc
index 0e85654..2dc71da 100644
--- a/chrome/browser/metrics/metrics_service_uitest.cc
+++ b/chrome/browser/metrics/metrics_service_uitest.cc
@@ -13,10 +13,10 @@
#include "base/platform_thread.h"
#include "base/process_util.h"
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/ui/ui_test.h"
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index c4f8221..c4a5023 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -11,13 +11,13 @@
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/host_zoom_map.h"
#include "chrome/browser/io_thread.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/privacy_blacklist/blacklist.h"
#include "chrome/browser/net/chrome_cookie_policy.h"
#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/common/appcache/chrome_appcache_service.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_registrar.h"
-#include "chrome/common/pref_service.h"
#include "net/url_request/url_request_context.h"
class CommandLine;
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index cf78357..a61b85d 100644
--- a/chrome/browser/net/dns_global.cc
+++ b/chrome/browser/net/dns_global.cc
@@ -19,12 +19,12 @@
#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/dns_host_info.h"
#include "chrome/browser/net/referrer.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/session_startup_pref.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "net/base/host_resolver.h"
#include "net/base/host_resolver_impl.h"
diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc
index 822e4ac..a89f025 100644
--- a/chrome/browser/net/ssl_config_service_manager_pref.cc
+++ b/chrome/browser/net/ssl_config_service_manager_pref.cc
@@ -7,11 +7,11 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/ssl_config_service_manager.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
#include "net/base/ssl_config_service.h"
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index a06255b..5ab1ef1 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/notifications/notification_object_proxy.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/notifications/notifications_prefs_cache.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -24,7 +25,6 @@
#include "chrome/browser/worker_host/worker_process_host.h"
#include "chrome/common/child_process_host.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
diff --git a/chrome/browser/notifications/notifications_prefs_cache.cc b/chrome/browser/notifications/notifications_prefs_cache.cc
index d9a4dae..67edeb6 100644
--- a/chrome/browser/notifications/notifications_prefs_cache.cc
+++ b/chrome/browser/notifications/notifications_prefs_cache.cc
@@ -7,7 +7,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h"
NotificationsPrefsCache::NotificationsPrefsCache(
diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc
index 6abc5aa..7445306 100644
--- a/chrome/browser/omnibox_search_hint.cc
+++ b/chrome/browser/omnibox_search_hint.cc
@@ -9,10 +9,11 @@
#include "app/resource_bundle.h"
#include "base/command_line.h"
#include "base/task.h"
+#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/location_bar.h"
-#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
@@ -21,7 +22,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/options_page_base.cc b/chrome/browser/options_page_base.cc
index 7f664eb5..f46b74e 100644
--- a/chrome/browser/options_page_base.cc
+++ b/chrome/browser/options_page_base.cc
@@ -5,8 +5,8 @@
#include "chrome/browser/options_page_base.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_service.h"
///////////////////////////////////////////////////////////////////////////////
// OptionsPageBase
diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc
index 77c9fa6..7b78051 100644
--- a/chrome/browser/options_util.cc
+++ b/chrome/browser/options_util.cc
@@ -10,8 +10,8 @@
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/host_zoom_map.h"
#include "chrome/browser/metrics/metrics_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/installer/util/google_update_settings.h"
// static
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc
index 1766824..b8defaa 100644
--- a/chrome/browser/page_info_model.cc
+++ b/chrome/browser/page_info_model.cc
@@ -8,10 +8,10 @@
#include "base/callback.h"
#include "base/i18n/time_formatting.h"
#include "chrome/browser/cert_store.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/ssl/ssl_manager.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "net/base/cert_status_flags.h"
#include "net/base/x509_certificate.h"
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index 94c2bb8..e7b49b2 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -9,13 +9,13 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "chrome/browser/password_manager/password_form_manager.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h
index 285b459..002cb29 100644
--- a/chrome/browser/password_manager/password_manager.h
+++ b/chrome/browser/password_manager/password_manager.h
@@ -8,8 +8,8 @@
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/login_model.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
-#include "chrome/common/pref_member.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/password_form_dom_manager.h"
diff --git a/chrome/browser/possible_url_model.cc b/chrome/browser/possible_url_model.cc
index 2c85a99..1f5fada 100644
--- a/chrome/browser/possible_url_model.cc
+++ b/chrome/browser/possible_url_model.cc
@@ -11,9 +11,9 @@
#include "base/callback.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/favicon_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/pref_member.cc b/chrome/browser/pref_member.cc
new file mode 100644
index 0000000..3e6cc87
--- /dev/null
+++ b/chrome/browser/pref_member.cc
@@ -0,0 +1,87 @@
+// Copyright (c) 2006-2008 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.
+
+#include "chrome/browser/pref_member.h"
+
+#include "base/logging.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/common/notification_type.h"
+
+namespace subtle {
+
+PrefMemberBase::PrefMemberBase()
+ : observer_(NULL),
+ prefs_(NULL),
+ is_synced_(false),
+ setting_value_(false) {
+}
+
+PrefMemberBase::~PrefMemberBase() {
+ if (!pref_name_.empty())
+ prefs_->RemovePrefObserver(pref_name_.c_str(), this);
+}
+
+
+void PrefMemberBase::Init(const wchar_t* pref_name, PrefService* prefs,
+ NotificationObserver* observer) {
+ DCHECK(pref_name);
+ DCHECK(prefs);
+ DCHECK(pref_name_.empty()); // Check that Init is only called once.
+ observer_ = observer;
+ prefs_ = prefs;
+ pref_name_ = pref_name;
+ DCHECK(!pref_name_.empty());
+
+ // Add ourself as a pref observer so we can keep our local value in sync.
+ prefs_->AddPrefObserver(pref_name, this);
+}
+
+void PrefMemberBase::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(!pref_name_.empty());
+ DCHECK(NotificationType::PREF_CHANGED == type);
+ UpdateValueFromPref();
+ is_synced_ = true;
+ if (!setting_value_ && observer_)
+ observer_->Observe(type, source, details);
+}
+
+void PrefMemberBase::VerifyValuePrefName() {
+ DCHECK(!pref_name_.empty());
+}
+
+} // namespace subtle
+
+void BooleanPrefMember::UpdateValueFromPref() {
+ value_ = prefs()->GetBoolean(pref_name().c_str());
+}
+
+void BooleanPrefMember::UpdatePref(const bool& value) {
+ prefs()->SetBoolean(pref_name().c_str(), value);
+}
+
+void IntegerPrefMember::UpdateValueFromPref() {
+ value_ = prefs()->GetInteger(pref_name().c_str());
+}
+
+void IntegerPrefMember::UpdatePref(const int& value) {
+ prefs()->SetInteger(pref_name().c_str(), value);
+}
+
+void RealPrefMember::UpdateValueFromPref() {
+ value_ = prefs()->GetReal(pref_name().c_str());
+}
+
+void RealPrefMember::UpdatePref(const double& value) {
+ prefs()->SetReal(pref_name().c_str(), value);
+}
+
+void StringPrefMember::UpdateValueFromPref() {
+ value_ = prefs()->GetString(pref_name().c_str());
+}
+
+void StringPrefMember::UpdatePref(const std::wstring& value) {
+ prefs()->SetString(pref_name().c_str(), value);
+}
diff --git a/chrome/browser/pref_member.h b/chrome/browser/pref_member.h
new file mode 100644
index 0000000..6f7bffb
--- /dev/null
+++ b/chrome/browser/pref_member.h
@@ -0,0 +1,176 @@
+// Copyright (c) 2006-2008 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.
+//
+// A helper class that stays in sync with a preference (bool, int, real, or
+// string). For example:
+//
+// class MyClass {
+// public:
+// MyClass(PrefService* prefs) {
+// my_string_.Init(prefs::kHomePage, prefs, NULL /* no observer */);
+// }
+// private:
+// StringPrefMember my_string_;
+// };
+//
+// my_string_ should stay in sync with the prefs::kHomePage pref and will
+// update if either the pref changes or if my_string_.SetValue is called.
+//
+// An optional observer can be passed into the Init method which can be used to
+// notify MyClass of changes. Note that if you use SetValue(), the observer
+// will not be notified.
+
+#ifndef CHROME_BROWSER_PREF_MEMBER_H_
+#define CHROME_BROWSER_PREF_MEMBER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "chrome/common/notification_observer.h"
+
+class PrefService;
+
+namespace subtle {
+
+class PrefMemberBase : public NotificationObserver {
+ protected:
+ PrefMemberBase();
+ virtual ~PrefMemberBase();
+
+ // See PrefMember<> for description.
+ void Init(const wchar_t* pref_name, PrefService* prefs,
+ NotificationObserver* observer);
+
+ // NotificationObserver
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ void VerifyValuePrefName();
+
+ // This methods is used to do the actual sync with pref of the specified type.
+ virtual void UpdateValueFromPref() = 0;
+
+ const std::wstring& pref_name() const { return pref_name_; }
+ PrefService* prefs() { return prefs_; }
+
+ // Ordered the members to compact the class instance.
+ private:
+ std::wstring pref_name_;
+ NotificationObserver* observer_;
+ PrefService* prefs_;
+
+ protected:
+ bool is_synced_;
+ bool setting_value_;
+};
+
+} // namespace subtle
+
+
+template <typename ValueType>
+class PrefMember : public subtle::PrefMemberBase {
+ public:
+ // Defer initialization to an Init method so it's easy to make this class be
+ // a member variable.
+ PrefMember() { }
+ virtual ~PrefMember() { }
+
+ // Do the actual initialization of the class. |observer| may be null if you
+ // don't want any notifications of changes.
+ void Init(const wchar_t* pref_name, PrefService* prefs,
+ NotificationObserver* observer) {
+ subtle::PrefMemberBase::Init(pref_name, prefs, observer);
+ }
+
+ // Retrieve the value of the member variable.
+ ValueType GetValue() {
+ VerifyValuePrefName();
+ // We lazily fetch the value from the pref service the first time GetValue
+ // is called.
+ if (!is_synced_) {
+ UpdateValueFromPref();
+ is_synced_ = true;
+ }
+ return value_;
+ }
+
+ // Provided as a convenience.
+ ValueType operator*() {
+ return GetValue();
+ }
+
+ // Set the value of the member variable.
+ void SetValue(const ValueType& value) {
+ VerifyValuePrefName();
+ setting_value_ = true;
+ UpdatePref(value);
+ setting_value_ = false;
+ }
+
+ protected:
+ // This methods is used to do the actual sync with pref of the specified type.
+ virtual void UpdatePref(const ValueType& value) = 0;
+
+ // We cache the value of the pref so we don't have to keep walking the pref
+ // tree.
+ ValueType value_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Implementations of Boolean, Integer, Real, and String PrefMember below.
+
+class BooleanPrefMember : public PrefMember<bool> {
+ public:
+ BooleanPrefMember() : PrefMember<bool>() { }
+ virtual ~BooleanPrefMember() { }
+
+ protected:
+ virtual void UpdateValueFromPref();
+ virtual void UpdatePref(const bool& value);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BooleanPrefMember);
+};
+
+class IntegerPrefMember : public PrefMember<int> {
+ public:
+ IntegerPrefMember() : PrefMember<int>() { }
+ virtual ~IntegerPrefMember() { }
+
+ protected:
+ virtual void UpdateValueFromPref();
+ virtual void UpdatePref(const int& value);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(IntegerPrefMember);
+};
+
+class RealPrefMember : public PrefMember<double> {
+ public:
+ RealPrefMember() : PrefMember<double>() { }
+ virtual ~RealPrefMember() { }
+
+ protected:
+ virtual void UpdateValueFromPref();
+ virtual void UpdatePref(const double& value);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(RealPrefMember);
+};
+
+class StringPrefMember : public PrefMember<std::wstring> {
+ public:
+ StringPrefMember() : PrefMember<std::wstring>() { }
+ virtual ~StringPrefMember() { }
+
+ protected:
+ virtual void UpdateValueFromPref();
+ virtual void UpdatePref(const std::wstring& value);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StringPrefMember);
+};
+
+#endif // CHROME_BROWSER_PREF_MEMBER_H_
diff --git a/chrome/browser/pref_member_unittest.cc b/chrome/browser/pref_member_unittest.cc
new file mode 100644
index 0000000..96cf68d
--- /dev/null
+++ b/chrome/browser/pref_member_unittest.cc
@@ -0,0 +1,193 @@
+// Copyright (c) 2006-2008 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.
+
+#include "base/file_path.h"
+#include "chrome/browser/pref_member.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/common/notification_service.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+static const wchar_t kBoolPref[] = L"bool";
+static const wchar_t kIntPref[] = L"int";
+static const wchar_t kRealPref[] = L"real";
+static const wchar_t kStringPref[] = L"string";
+
+void RegisterTestPrefs(PrefService* prefs) {
+ prefs->RegisterBooleanPref(kBoolPref, false);
+ prefs->RegisterIntegerPref(kIntPref, 0);
+ prefs->RegisterRealPref(kRealPref, 0.0);
+ prefs->RegisterStringPref(kStringPref, L"default");
+}
+
+class PrefMemberTestClass : public NotificationObserver {
+ public:
+ explicit PrefMemberTestClass(PrefService* prefs)
+ : observe_cnt_(0), prefs_(prefs) {
+ str_.Init(kStringPref, prefs, this);
+ }
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(NotificationType::PREF_CHANGED == type);
+ PrefService* prefs_in = Source<PrefService>(source).ptr();
+ EXPECT_EQ(prefs_in, prefs_);
+ std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
+ EXPECT_EQ(*pref_name_in, kStringPref);
+ EXPECT_EQ(str_.GetValue(), prefs_->GetString(kStringPref));
+ ++observe_cnt_;
+ }
+
+ StringPrefMember str_;
+ int observe_cnt_;
+
+ private:
+ PrefService* prefs_;
+};
+
+} // anonymous namespace
+
+TEST(PrefMemberTest, BasicGetAndSet) {
+ PrefService prefs((FilePath()));
+ RegisterTestPrefs(&prefs);
+
+ // Test bool
+ BooleanPrefMember boolean;
+ boolean.Init(kBoolPref, &prefs, NULL);
+
+ // Check the defaults
+ EXPECT_FALSE(prefs.GetBoolean(kBoolPref));
+ EXPECT_FALSE(boolean.GetValue());
+ EXPECT_FALSE(*boolean);
+
+ // Try changing through the member variable.
+ boolean.SetValue(true);
+ EXPECT_TRUE(boolean.GetValue());
+ EXPECT_TRUE(prefs.GetBoolean(kBoolPref));
+ EXPECT_TRUE(*boolean);
+
+ // Try changing back through the pref.
+ prefs.SetBoolean(kBoolPref, false);
+ EXPECT_FALSE(prefs.GetBoolean(kBoolPref));
+ EXPECT_FALSE(boolean.GetValue());
+ EXPECT_FALSE(*boolean);
+
+ // Test int
+ IntegerPrefMember integer;
+ integer.Init(kIntPref, &prefs, NULL);
+
+ // Check the defaults
+ EXPECT_EQ(0, prefs.GetInteger(kIntPref));
+ EXPECT_EQ(0, integer.GetValue());
+ EXPECT_EQ(0, *integer);
+
+ // Try changing through the member variable.
+ integer.SetValue(5);
+ EXPECT_EQ(5, integer.GetValue());
+ EXPECT_EQ(5, prefs.GetInteger(kIntPref));
+ EXPECT_EQ(5, *integer);
+
+ // Try changing back through the pref.
+ prefs.SetInteger(kIntPref, 2);
+ EXPECT_EQ(2, prefs.GetInteger(kIntPref));
+ EXPECT_EQ(2, integer.GetValue());
+ EXPECT_EQ(2, *integer);
+
+ // Test real (double)
+ RealPrefMember real;
+ real.Init(kRealPref, &prefs, NULL);
+
+ // Check the defaults
+ EXPECT_EQ(0.0, prefs.GetReal(kRealPref));
+ EXPECT_EQ(0.0, real.GetValue());
+ EXPECT_EQ(0.0, *real);
+
+ // Try changing through the member variable.
+ real.SetValue(1.0);
+ EXPECT_EQ(1.0, real.GetValue());
+ EXPECT_EQ(1.0, prefs.GetReal(kRealPref));
+ EXPECT_EQ(1.0, *real);
+
+ // Try changing back through the pref.
+ prefs.SetReal(kRealPref, 3.0);
+ EXPECT_EQ(3.0, prefs.GetReal(kRealPref));
+ EXPECT_EQ(3.0, real.GetValue());
+ EXPECT_EQ(3.0, *real);
+
+ // Test string
+ StringPrefMember string;
+ string.Init(kStringPref, &prefs, NULL);
+
+ // Check the defaults
+ EXPECT_EQ(L"default", prefs.GetString(kStringPref));
+ EXPECT_EQ(L"default", string.GetValue());
+ EXPECT_EQ(L"default", *string);
+
+ // Try changing through the member variable.
+ string.SetValue(L"foo");
+ EXPECT_EQ(L"foo", string.GetValue());
+ EXPECT_EQ(L"foo", prefs.GetString(kStringPref));
+ EXPECT_EQ(L"foo", *string);
+
+ // Try changing back through the pref.
+ prefs.SetString(kStringPref, L"bar");
+ EXPECT_EQ(L"bar", prefs.GetString(kStringPref));
+ EXPECT_EQ(L"bar", string.GetValue());
+ EXPECT_EQ(L"bar", *string);
+}
+
+TEST(PrefMemberTest, TwoPrefs) {
+ // Make sure two RealPrefMembers stay in sync.
+ PrefService prefs((FilePath()));
+ RegisterTestPrefs(&prefs);
+
+ RealPrefMember pref1;
+ pref1.Init(kRealPref, &prefs, NULL);
+ RealPrefMember pref2;
+ pref2.Init(kRealPref, &prefs, NULL);
+
+ pref1.SetValue(2.3);
+ EXPECT_EQ(2.3, *pref2);
+
+ pref2.SetValue(3.5);
+ EXPECT_EQ(3.5, *pref1);
+
+ prefs.SetReal(kRealPref, 4.2);
+ EXPECT_EQ(4.2, *pref1);
+ EXPECT_EQ(4.2, *pref2);
+}
+
+TEST(PrefMemberTest, Observer) {
+ PrefService prefs((FilePath()));
+ RegisterTestPrefs(&prefs);
+
+ PrefMemberTestClass test_obj(&prefs);
+ EXPECT_EQ(L"default", *test_obj.str_);
+
+ // Calling SetValue should not fire the observer.
+ test_obj.str_.SetValue(L"hello");
+ EXPECT_EQ(0, test_obj.observe_cnt_);
+ EXPECT_EQ(L"hello", prefs.GetString(kStringPref));
+
+ // Changing the pref does fire the observer.
+ prefs.SetString(kStringPref, L"world");
+ EXPECT_EQ(1, test_obj.observe_cnt_);
+ EXPECT_EQ(L"world", *(test_obj.str_));
+
+ // Not changing the value should not fire the observer.
+ prefs.SetString(kStringPref, L"world");
+ EXPECT_EQ(1, test_obj.observe_cnt_);
+ EXPECT_EQ(L"world", *(test_obj.str_));
+
+ prefs.SetString(kStringPref, L"hello");
+ EXPECT_EQ(2, test_obj.observe_cnt_);
+ EXPECT_EQ(L"hello", prefs.GetString(kStringPref));
+}
+
+TEST(PrefMemberTest, NoInit) {
+ // Make sure not calling Init on a PrefMember doesn't cause problems.
+ IntegerPrefMember pref;
+}
diff --git a/chrome/browser/pref_service.cc b/chrome/browser/pref_service.cc
new file mode 100644
index 0000000..430077c6
--- /dev/null
+++ b/chrome/browser/pref_service.cc
@@ -0,0 +1,684 @@
+// Copyright (c) 2009 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.
+
+#include "chrome/browser/pref_service.h"
+
+#include "app/l10n_util.h"
+#include "base/logging.h"
+#include "base/message_loop.h"
+#include "base/stl_util-inl.h"
+#include "base/string_util.h"
+#include "base/sys_string_conversions.h"
+#include "build/build_config.h"
+#include "chrome/common/json_value_serializer.h"
+#include "chrome/common/notification_service.h"
+#include "grit/generated_resources.h"
+
+namespace {
+
+// A helper function for RegisterLocalized*Pref that creates a Value* based on
+// the string value in the locale dll. Because we control the values in a
+// locale dll, this should always return a Value of the appropriate type.
+Value* CreateLocaleDefaultValue(Value::ValueType type, int message_id) {
+ std::wstring resource_string = l10n_util::GetString(message_id);
+ DCHECK(!resource_string.empty());
+ switch (type) {
+ case Value::TYPE_BOOLEAN: {
+ if (L"true" == resource_string)
+ return Value::CreateBooleanValue(true);
+ if (L"false" == resource_string)
+ return Value::CreateBooleanValue(false);
+ break;
+ }
+
+ case Value::TYPE_INTEGER: {
+ return Value::CreateIntegerValue(
+ StringToInt(WideToUTF16Hack(resource_string)));
+ break;
+ }
+
+ case Value::TYPE_REAL: {
+ return Value::CreateRealValue(
+ StringToDouble(WideToUTF16Hack(resource_string)));
+ break;
+ }
+
+ case Value::TYPE_STRING: {
+ return Value::CreateStringValue(resource_string);
+ break;
+ }
+
+ default: {
+ NOTREACHED() <<
+ "list and dictionary types can not have default locale values";
+ }
+ }
+ NOTREACHED();
+ return Value::CreateNullValue();
+}
+
+} // namespace
+
+PrefService::PrefService(const FilePath& pref_filename)
+ : persistent_(new DictionaryValue),
+ writer_(pref_filename) {
+ ReloadPersistentPrefs();
+}
+
+PrefService::~PrefService() {
+ DCHECK(CalledOnValidThread());
+
+ // Verify that there are no pref observers when we shut down.
+ for (PrefObserverMap::iterator it = pref_observers_.begin();
+ it != pref_observers_.end(); ++it) {
+ NotificationObserverList::Iterator obs_iterator(*(it->second));
+ if (obs_iterator.GetNext()) {
+ LOG(WARNING) << "pref observer found at shutdown " << it->first;
+ }
+ }
+
+ STLDeleteContainerPointers(prefs_.begin(), prefs_.end());
+ prefs_.clear();
+ STLDeleteContainerPairSecondPointers(pref_observers_.begin(),
+ pref_observers_.end());
+ pref_observers_.clear();
+
+ if (writer_.HasPendingWrite())
+ writer_.DoScheduledWrite();
+}
+
+bool PrefService::ReloadPersistentPrefs() {
+ DCHECK(CalledOnValidThread());
+
+ JSONFileValueSerializer serializer(writer_.path());
+ scoped_ptr<Value> root(serializer.Deserialize(NULL));
+ if (!root.get())
+ return false;
+
+ // Preferences should always have a dictionary root.
+ if (!root->IsType(Value::TYPE_DICTIONARY))
+ return false;
+
+ persistent_.reset(static_cast<DictionaryValue*>(root.release()));
+ for (PreferenceSet::iterator it = prefs_.begin();
+ it != prefs_.end(); ++it) {
+ (*it)->root_pref_ = persistent_.get();
+ }
+
+ return true;
+}
+
+bool PrefService::SavePersistentPrefs() {
+ DCHECK(CalledOnValidThread());
+
+ std::string data;
+ if (!SerializeData(&data))
+ return false;
+
+ writer_.WriteNow(data);
+ return true;
+}
+
+void PrefService::ScheduleSavePersistentPrefs() {
+ DCHECK(CalledOnValidThread());
+ writer_.ScheduleWrite(this);
+}
+
+void PrefService::RegisterBooleanPref(const wchar_t* path,
+ bool default_value) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ Value::CreateBooleanValue(default_value));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterIntegerPref(const wchar_t* path,
+ int default_value) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ Value::CreateIntegerValue(default_value));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterRealPref(const wchar_t* path,
+ double default_value) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ Value::CreateRealValue(default_value));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterStringPref(const wchar_t* path,
+ const std::wstring& default_value) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ Value::CreateStringValue(default_value));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterFilePathPref(const wchar_t* path,
+ const FilePath& default_value) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ Value::CreateStringValue(default_value.value()));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterListPref(const wchar_t* path) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ new ListValue);
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterDictionaryPref(const wchar_t* path) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ new DictionaryValue());
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterLocalizedBooleanPref(const wchar_t* path,
+ int locale_default_message_id) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ CreateLocaleDefaultValue(Value::TYPE_BOOLEAN, locale_default_message_id));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterLocalizedIntegerPref(const wchar_t* path,
+ int locale_default_message_id) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ CreateLocaleDefaultValue(Value::TYPE_INTEGER, locale_default_message_id));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterLocalizedRealPref(const wchar_t* path,
+ int locale_default_message_id) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ CreateLocaleDefaultValue(Value::TYPE_REAL, locale_default_message_id));
+ RegisterPreference(pref);
+}
+
+void PrefService::RegisterLocalizedStringPref(const wchar_t* path,
+ int locale_default_message_id) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ CreateLocaleDefaultValue(Value::TYPE_STRING, locale_default_message_id));
+ RegisterPreference(pref);
+}
+
+bool PrefService::GetBoolean(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ bool result = false;
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return result;
+ }
+ bool rv = pref->GetValue()->GetAsBoolean(&result);
+ DCHECK(rv);
+ return result;
+}
+
+int PrefService::GetInteger(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ int result = 0;
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return result;
+ }
+ bool rv = pref->GetValue()->GetAsInteger(&result);
+ DCHECK(rv);
+ return result;
+}
+
+double PrefService::GetReal(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ double result = 0.0;
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return result;
+ }
+ bool rv = pref->GetValue()->GetAsReal(&result);
+ DCHECK(rv);
+ return result;
+}
+
+std::wstring PrefService::GetString(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ std::wstring result;
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return result;
+ }
+ bool rv = pref->GetValue()->GetAsString(&result);
+ DCHECK(rv);
+ return result;
+}
+
+FilePath PrefService::GetFilePath(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ FilePath::StringType result;
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return FilePath(result);
+ }
+ bool rv = pref->GetValue()->GetAsString(&result);
+ DCHECK(rv);
+#if defined(OS_POSIX)
+ // We store filepaths as UTF8, so convert it back to the system type.
+ result = base::SysWideToNativeMB(UTF8ToWide(result));
+#endif
+ return FilePath(result);
+}
+
+bool PrefService::HasPrefPath(const wchar_t* path) const {
+ Value* value = NULL;
+ return persistent_->Get(path, &value);
+}
+
+const PrefService::Preference* PrefService::FindPreference(
+ const wchar_t* pref_name) const {
+ DCHECK(CalledOnValidThread());
+ Preference p(NULL, pref_name, NULL);
+ PreferenceSet::const_iterator it = prefs_.find(&p);
+ return it == prefs_.end() ? NULL : *it;
+}
+
+const DictionaryValue* PrefService::GetDictionary(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return NULL;
+ }
+ const Value* value = pref->GetValue();
+ if (value->GetType() == Value::TYPE_NULL)
+ return NULL;
+ return static_cast<const DictionaryValue*>(value);
+}
+
+const ListValue* PrefService::GetList(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return NULL;
+ }
+ const Value* value = pref->GetValue();
+ if (value->GetType() == Value::TYPE_NULL)
+ return NULL;
+ return static_cast<const ListValue*>(value);
+}
+
+void PrefService::AddPrefObserver(const wchar_t* path,
+ NotificationObserver* obs) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to add an observer for an unregistered pref: "
+ << path;
+ return;
+ }
+
+ // Get the pref observer list associated with the path.
+ NotificationObserverList* observer_list = NULL;
+ PrefObserverMap::iterator observer_iterator = pref_observers_.find(path);
+ if (observer_iterator == pref_observers_.end()) {
+ observer_list = new NotificationObserverList;
+ pref_observers_[path] = observer_list;
+ } else {
+ observer_list = observer_iterator->second;
+ }
+
+ // Verify that this observer doesn't already exist.
+ NotificationObserverList::Iterator it(*observer_list);
+ NotificationObserver* existing_obs;
+ while ((existing_obs = it.GetNext()) != NULL) {
+ DCHECK(existing_obs != obs) << path << " observer already registered";
+ if (existing_obs == obs)
+ return;
+ }
+
+ // Ok, safe to add the pref observer.
+ observer_list->AddObserver(obs);
+}
+
+void PrefService::RemovePrefObserver(const wchar_t* path,
+ NotificationObserver* obs) {
+ DCHECK(CalledOnValidThread());
+
+ PrefObserverMap::iterator observer_iterator = pref_observers_.find(path);
+ if (observer_iterator == pref_observers_.end()) {
+ return;
+ }
+
+ NotificationObserverList* observer_list = observer_iterator->second;
+ observer_list->RemoveObserver(obs);
+}
+
+void PrefService::RegisterPreference(Preference* pref) {
+ DCHECK(CalledOnValidThread());
+
+ if (FindPreference(pref->name().c_str())) {
+ NOTREACHED() << "Tried to register duplicate pref " << pref->name();
+ delete pref;
+ return;
+ }
+ prefs_.insert(pref);
+}
+
+void PrefService::ClearPref(const wchar_t* path) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to clear an unregistered pref: " << path;
+ return;
+ }
+
+ Value* value;
+ bool has_old_value = persistent_->Get(path, &value);
+ persistent_->Remove(path, NULL);
+
+ if (has_old_value)
+ FireObservers(path);
+}
+
+void PrefService::Set(const wchar_t* path, const Value& value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != value.GetType()) {
+ NOTREACHED() << "Wrong type for Set: " << path;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+ persistent_->Set(path, value.DeepCopy());
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
+void PrefService::SetBoolean(const wchar_t* path, bool value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != Value::TYPE_BOOLEAN) {
+ NOTREACHED() << "Wrong type for SetBoolean: " << path;
+ return;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+ persistent_->SetBoolean(path, value);
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
+void PrefService::SetInteger(const wchar_t* path, int value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != Value::TYPE_INTEGER) {
+ NOTREACHED() << "Wrong type for SetInteger: " << path;
+ return;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+ persistent_->SetInteger(path, value);
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
+void PrefService::SetReal(const wchar_t* path, double value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != Value::TYPE_REAL) {
+ NOTREACHED() << "Wrong type for SetReal: " << path;
+ return;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+ persistent_->SetReal(path, value);
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
+void PrefService::SetString(const wchar_t* path, const std::wstring& value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != Value::TYPE_STRING) {
+ NOTREACHED() << "Wrong type for SetString: " << path;
+ return;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+ persistent_->SetString(path, value);
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
+void PrefService::SetFilePath(const wchar_t* path, const FilePath& value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != Value::TYPE_STRING) {
+ NOTREACHED() << "Wrong type for SetFilePath: " << path;
+ return;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+#if defined(OS_POSIX)
+ // Value::SetString only knows about UTF8 strings, so convert the path from
+ // the system native value to UTF8.
+ std::string path_utf8 = WideToUTF8(base::SysNativeMBToWide(value.value()));
+ persistent_->SetString(path, path_utf8);
+#else
+ persistent_->SetString(path, value.value());
+#endif
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
+void PrefService::SetInt64(const wchar_t* path, int64 value) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to write an unregistered pref: " << path;
+ return;
+ }
+ if (pref->type() != Value::TYPE_STRING) {
+ NOTREACHED() << "Wrong type for SetInt64: " << path;
+ return;
+ }
+
+ scoped_ptr<Value> old_value(GetPrefCopy(path));
+ persistent_->SetString(path, Int64ToWString(value));
+
+ FireObserversIfChanged(path, old_value.get());
+}
+
+int64 PrefService::GetInt64(const wchar_t* path) const {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to read an unregistered pref: " << path;
+ return 0;
+ }
+ std::wstring result(L"0");
+ bool rv = pref->GetValue()->GetAsString(&result);
+ DCHECK(rv);
+ return StringToInt64(WideToUTF16Hack(result));
+}
+
+void PrefService::RegisterInt64Pref(const wchar_t* path, int64 default_value) {
+ Preference* pref = new Preference(persistent_.get(), path,
+ Value::CreateStringValue(Int64ToWString(default_value)));
+ RegisterPreference(pref);
+}
+
+DictionaryValue* PrefService::GetMutableDictionary(const wchar_t* path) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to get an unregistered pref: " << path;
+ return NULL;
+ }
+ if (pref->type() != Value::TYPE_DICTIONARY) {
+ NOTREACHED() << "Wrong type for GetMutableDictionary: " << path;
+ return NULL;
+ }
+
+ DictionaryValue* dict = NULL;
+ if (!persistent_->GetDictionary(path, &dict)) {
+ dict = new DictionaryValue;
+ persistent_->Set(path, dict);
+ }
+ return dict;
+}
+
+ListValue* PrefService::GetMutableList(const wchar_t* path) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ if (!pref) {
+ NOTREACHED() << "Trying to get an unregistered pref: " << path;
+ return NULL;
+ }
+ if (pref->type() != Value::TYPE_LIST) {
+ NOTREACHED() << "Wrong type for GetMutableList: " << path;
+ return NULL;
+ }
+
+ ListValue* list = NULL;
+ if (!persistent_->GetList(path, &list)) {
+ list = new ListValue;
+ persistent_->Set(path, list);
+ }
+ return list;
+}
+
+Value* PrefService::GetPrefCopy(const wchar_t* path) {
+ DCHECK(CalledOnValidThread());
+
+ const Preference* pref = FindPreference(path);
+ DCHECK(pref);
+ return pref->GetValue()->DeepCopy();
+}
+
+void PrefService::FireObserversIfChanged(const wchar_t* path,
+ const Value* old_value) {
+ Value* new_value = NULL;
+ persistent_->Get(path, &new_value);
+ if (!old_value->Equals(new_value))
+ FireObservers(path);
+}
+
+void PrefService::FireObservers(const wchar_t* path) {
+ DCHECK(CalledOnValidThread());
+
+ // Convert path to a std::wstring because the Details constructor requires a
+ // class.
+ std::wstring path_str(path);
+ PrefObserverMap::iterator observer_iterator = pref_observers_.find(path_str);
+ if (observer_iterator == pref_observers_.end())
+ return;
+
+ NotificationObserverList::Iterator it(*(observer_iterator->second));
+ NotificationObserver* observer;
+ while ((observer = it.GetNext()) != NULL) {
+ observer->Observe(NotificationType::PREF_CHANGED,
+ Source<PrefService>(this),
+ Details<std::wstring>(&path_str));
+ }
+}
+
+bool PrefService::SerializeData(std::string* output) {
+ // TODO(tc): Do we want to prune webkit preferences that match the default
+ // value?
+ JSONStringValueSerializer serializer(output);
+ serializer.set_pretty_print(true);
+ scoped_ptr<DictionaryValue> copy(persistent_->DeepCopyWithoutEmptyChildren());
+ return serializer.Serialize(*(copy.get()));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// PrefService::Preference
+
+PrefService::Preference::Preference(DictionaryValue* root_pref,
+ const wchar_t* name,
+ Value* default_value)
+ : type_(Value::TYPE_NULL),
+ name_(name),
+ default_value_(default_value),
+ root_pref_(root_pref) {
+ DCHECK(name);
+
+ if (default_value) {
+ type_ = default_value->GetType();
+ DCHECK(type_ != Value::TYPE_NULL && type_ != Value::TYPE_BINARY) <<
+ "invalid preference type: " << type_;
+ }
+
+ // We set the default value of lists and dictionaries to be null so it's
+ // easier for callers to check for empty list/dict prefs.
+ if (Value::TYPE_LIST == type_ || Value::TYPE_DICTIONARY == type_)
+ default_value_.reset(Value::CreateNullValue());
+}
+
+const Value* PrefService::Preference::GetValue() const {
+ DCHECK(NULL != root_pref_) <<
+ "Must register pref before getting its value";
+
+ Value* temp_value = NULL;
+ if (root_pref_->Get(name_.c_str(), &temp_value) &&
+ temp_value->GetType() == type_) {
+ return temp_value;
+ }
+
+ // Pref not found, just return the app default.
+ return default_value_.get();
+}
+
+bool PrefService::Preference::IsDefaultValue() const {
+ DCHECK(default_value_.get());
+ return default_value_->Equals(GetValue());
+}
diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h
new file mode 100644
index 0000000..85dd42c
--- /dev/null
+++ b/chrome/browser/pref_service.h
@@ -0,0 +1,222 @@
+// Copyright (c) 2006-2008 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.
+
+// This provides a way to access the application's current preferences.
+// This service has two preference stores, one for "persistent" preferences,
+// which get serialized for use in the next session, and one for "transient"
+// preferences, which are in effect for only the current session
+// (this usually encodes things like command-line switches).
+//
+// Calling the getter functions in this class basically looks at both the
+// persistent and transient stores, where any corresponding value in the
+// transient store overrides the one in the persistent store.
+
+#ifndef CHROME_BROWSER_PREF_SERVICE_H_
+#define CHROME_BROWSER_PREF_SERVICE_H_
+
+#include <set>
+
+#include "base/file_path.h"
+#include "base/hash_tables.h"
+#include "base/non_thread_safe.h"
+#include "base/observer_list.h"
+#include "base/scoped_ptr.h"
+#include "base/values.h"
+#include "chrome/browser/important_file_writer.h"
+
+class NotificationObserver;
+class Preference;
+
+class PrefService : public NonThreadSafe,
+ public ImportantFileWriter::DataSerializer {
+ public:
+
+ // A helper class to store all the information associated with a preference.
+ class Preference {
+ public:
+
+ // The type of the preference is determined by the type of |default_value|.
+ // Therefore, the type needs to be a boolean, integer, real, string,
+ // dictionary (a branch), or list. You shouldn't need to construct this on
+ // your own, use the PrefService::Register*Pref methods instead.
+ // |default_value| will be owned by the Preference object.
+ Preference(DictionaryValue* root_pref,
+ const wchar_t* name,
+ Value* default_value);
+ ~Preference() {}
+
+ Value::ValueType type() const { return type_; }
+
+ // Returns the name of the Preference (i.e., the key, e.g.,
+ // browser.window_placement).
+ const std::wstring name() const { return name_; }
+
+ // Returns the value of the Preference. If there is no user specified
+ // value, it returns the default value.
+ const Value* GetValue() const;
+
+ // Returns true if the current value matches the default value.
+ bool IsDefaultValue() const;
+
+ private:
+ friend class PrefService;
+
+ Value::ValueType type_;
+ std::wstring name_;
+ scoped_ptr<Value> default_value_;
+
+ // A reference to the pref service's persistent prefs.
+ DictionaryValue* root_pref_;
+
+ DISALLOW_COPY_AND_ASSIGN(Preference);
+ };
+
+ // |pref_filename| is the path to the prefs file we will try to load or save
+ // to. Saves will be executed on the file thread.
+ explicit PrefService(const FilePath& pref_filename);
+ ~PrefService();
+
+ // Reloads the data from file. This should only be called when the importer
+ // is running during first run, and the main process may not change pref
+ // values while the importer process is running. Returns true on success.
+ bool ReloadPersistentPrefs();
+
+ // Writes the data to disk. The return value only reflects whether
+ // serialization was successful; we don't know whether the data actually made
+ // it on disk (since it's on a different thread). This should only be used if
+ // we need to save immediately (basically, during shutdown). Otherwise, you
+ // should use ScheduleSavePersistentPrefs.
+ bool SavePersistentPrefs();
+
+ // Serializes the data and schedules save using ImportantFileWriter.
+ void ScheduleSavePersistentPrefs();
+
+ // Make the PrefService aware of a pref.
+ void RegisterBooleanPref(const wchar_t* path,
+ bool default_value);
+ void RegisterIntegerPref(const wchar_t* path,
+ int default_value);
+ void RegisterRealPref(const wchar_t* path,
+ double default_value);
+ void RegisterStringPref(const wchar_t* path,
+ const std::wstring& default_value);
+ void RegisterFilePathPref(const wchar_t* path,
+ const FilePath& default_value);
+ void RegisterListPref(const wchar_t* path);
+ void RegisterDictionaryPref(const wchar_t* path);
+
+ // These varients use a default value from the locale dll instead.
+ void RegisterLocalizedBooleanPref(const wchar_t* path,
+ int locale_default_message_id);
+ void RegisterLocalizedIntegerPref(const wchar_t* path,
+ int locale_default_message_id);
+ void RegisterLocalizedRealPref(const wchar_t* path,
+ int locale_default_message_id);
+ void RegisterLocalizedStringPref(const wchar_t* path,
+ int locale_default_message_id);
+
+ // If the path is valid and the value at the end of the path matches the type
+ // specified, it will return the specified value. Otherwise, the default
+ // value (set when the pref was registered) will be returned.
+ bool GetBoolean(const wchar_t* path) const;
+ int GetInteger(const wchar_t* path) const;
+ double GetReal(const wchar_t* path) const;
+ std::wstring GetString(const wchar_t* path) const;
+ FilePath GetFilePath(const wchar_t* path) const;
+
+ // Returns the branch if it exists. If it's not a branch or the branch does
+ // not exist, returns NULL.
+ const DictionaryValue* GetDictionary(const wchar_t* path) const;
+ const ListValue* GetList(const wchar_t* path) const;
+
+ // If the pref at the given path changes, we call the observer's Observe
+ // method with NOTIFY_PREF_CHANGED.
+ void AddPrefObserver(const wchar_t* path, NotificationObserver* obs);
+ void RemovePrefObserver(const wchar_t* path, NotificationObserver* obs);
+
+ // Removes a user pref and restores the pref to its default value.
+ void ClearPref(const wchar_t* path);
+
+ // If the path is valid (i.e., registered), update the pref value.
+ void Set(const wchar_t* path, const Value& value);
+ void SetBoolean(const wchar_t* path, bool value);
+ void SetInteger(const wchar_t* path, int value);
+ void SetReal(const wchar_t* path, double value);
+ void SetString(const wchar_t* path, const std::wstring& value);
+ void SetFilePath(const wchar_t* path, const FilePath& value);
+
+ // Int64 helper methods that actually store the given value as a string.
+ // Note that if obtaining the named value via GetDictionary or GetList, the
+ // Value type will be TYPE_STRING.
+ void SetInt64(const wchar_t* path, int64 value);
+ int64 GetInt64(const wchar_t* path) const;
+ void RegisterInt64Pref(const wchar_t* path, int64 default_value);
+
+ // Used to set the value of dictionary or list values in the pref tree. This
+ // will create a dictionary or list if one does not exist in the pref tree.
+ // This method returns NULL only if you're requesting an unregistered pref or
+ // a non-dict/non-list pref.
+ // WARNING: Changes to the dictionary or list will not automatically notify
+ // pref observers. TODO(tc): come up with a way to still fire observers.
+ DictionaryValue* GetMutableDictionary(const wchar_t* path);
+ ListValue* GetMutableList(const wchar_t* path);
+
+ // Returns true if a value has been set for the specified path.
+ // NOTE: this is NOT the same as FindPreference. In particular
+ // FindPreference returns whether RegisterXXX has been invoked, where as
+ // this checks if a value exists for the path.
+ bool HasPrefPath(const wchar_t* path) const;
+
+ class PreferencePathComparator {
+ public:
+ bool operator() (Preference* lhs, Preference* rhs) const {
+ return lhs->name() < rhs->name();
+ }
+ };
+ typedef std::set<Preference*, PreferencePathComparator> PreferenceSet;
+ const PreferenceSet& preference_set() const { return prefs_; }
+
+ // A helper method to quickly look up a preference. Returns NULL if the
+ // preference is not registered.
+ const Preference* FindPreference(const wchar_t* pref_name) const;
+
+ // ImportantFileWriter::DataSerializer
+ virtual bool SerializeData(std::string* output);
+
+ private:
+ // Add a preference to the PreferenceMap. If the pref already exists, return
+ // false. This method takes ownership of |pref|.
+ void RegisterPreference(Preference* pref);
+
+ // Returns a copy of the current pref value. The caller is responsible for
+ // deleting the returned object.
+ Value* GetPrefCopy(const wchar_t* pref_name);
+
+ // For the given pref_name, fire any observer of the pref.
+ void FireObservers(const wchar_t* pref_name);
+
+ // For the given pref_name, fire any observer of the pref only if |old_value|
+ // is different from the current value.
+ void FireObserversIfChanged(const wchar_t* pref_name,
+ const Value* old_value);
+
+ scoped_ptr<DictionaryValue> persistent_;
+
+ // Helper for safe writing pref data.
+ ImportantFileWriter writer_;
+
+ // A set of all the registered Preference objects.
+ PreferenceSet prefs_;
+
+ // A map from pref names to a list of observers. Observers get fired in the
+ // order they are added.
+ typedef ObserverList<NotificationObserver> NotificationObserverList;
+ typedef base::hash_map<std::wstring, NotificationObserverList*>
+ PrefObserverMap;
+ PrefObserverMap pref_observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefService);
+};
+
+#endif // CHROME_BROWSER_PREF_SERVICE_H_
diff --git a/chrome/browser/pref_service_uitest.cc b/chrome/browser/pref_service_uitest.cc
new file mode 100644
index 0000000..04430b5
--- /dev/null
+++ b/chrome/browser/pref_service_uitest.cc
@@ -0,0 +1,133 @@
+// Copyright (c) 2009 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.
+
+#include <string>
+
+#include "base/command_line.h"
+#include "base/file_util.h"
+#include "base/gfx/rect.h"
+#include "base/test/test_file_util.h"
+#include "base/values.h"
+#include "build/build_config.h"
+#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/json_value_serializer.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/test/automation/browser_proxy.h"
+#include "chrome/test/automation/window_proxy.h"
+#include "chrome/test/ui/ui_test.h"
+
+class PreferenceServiceTest : public UITest {
+public:
+ void SetUp() {
+ PathService::Get(base::DIR_TEMP, &tmp_profile_);
+ tmp_profile_ = tmp_profile_.AppendASCII("tmp_profile");
+
+ // Create a fresh, empty copy of this directory.
+ file_util::Delete(tmp_profile_, true);
+ file_util::CreateDirectory(tmp_profile_);
+
+ FilePath reference_pref_file =
+ test_data_directory_
+ .AppendASCII("profiles")
+ .AppendASCII("window_placement")
+ .Append(chrome::kLocalStateFilename);
+
+ tmp_pref_file_ = tmp_profile_.Append(chrome::kLocalStateFilename);
+
+ ASSERT_TRUE(file_util::PathExists(reference_pref_file));
+
+ // Copy only the Local State file, the rest will be automatically created
+ ASSERT_TRUE(file_util::CopyFile(reference_pref_file, tmp_pref_file_));
+
+#if defined(OS_WIN)
+ // Make the copy writable. On POSIX we assume the umask allows files
+ // we create to be writable.
+ ASSERT_TRUE(::SetFileAttributesW(tmp_pref_file_.value().c_str(),
+ FILE_ATTRIBUTE_NORMAL));
+#endif
+
+ launch_arguments_.AppendSwitchWithValue(switches::kUserDataDir,
+ tmp_profile_.ToWStringHack());
+ }
+
+ bool LaunchAppWithProfile() {
+ if (!file_util::PathExists(tmp_pref_file_))
+ return false;
+ UITest::SetUp();
+ return true;
+ }
+
+ void TearDown() {
+ UITest::TearDown();
+
+ EXPECT_TRUE(file_util::DieFileDie(tmp_profile_, true));
+ }
+
+public:
+ FilePath tmp_pref_file_;
+ FilePath tmp_profile_;
+};
+
+#if defined(OS_WIN)
+// This test verifies that the window position from the prefs file is restored
+// when the app restores. This doesn't really make sense on Linux, where
+// the window manager might fight with you over positioning. However, we
+// might be able to make this work on buildbots.
+// Also, not sure what should happen on the mac. In any case, the code below
+// (minus the Windows bits) compiles fine on my Linux box now.
+// TODO(port): revisit this.
+TEST_F(PreferenceServiceTest, PreservedWindowPlacementIsLoaded) {
+ // The window should open with the reference profile
+ ASSERT_TRUE(LaunchAppWithProfile());
+
+ ASSERT_TRUE(file_util::PathExists(tmp_pref_file_));
+
+ JSONFileValueSerializer deserializer(tmp_pref_file_);
+ scoped_ptr<Value> root(deserializer.Deserialize(NULL));
+
+ ASSERT_TRUE(root.get());
+ ASSERT_TRUE(root->IsType(Value::TYPE_DICTIONARY));
+
+ DictionaryValue* root_dict = static_cast<DictionaryValue*>(root.get());
+
+ // Retrieve the screen rect for the launched window
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+ scoped_refptr<WindowProxy> window(browser->GetWindow());
+
+ gfx::Rect bounds;
+ ASSERT_TRUE(window->GetBounds(&bounds));
+
+ // Retrieve the expected rect values from "Preferences"
+ int bottom = 0;
+ std::wstring kBrowserWindowPlacement(prefs::kBrowserWindowPlacement);
+ EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".bottom",
+ &bottom));
+ EXPECT_EQ(bottom, bounds.y() + bounds.height());
+
+ int top = 0;
+ EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".top",
+ &top));
+ EXPECT_EQ(top, bounds.y());
+
+ int left = 0;
+ EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".left",
+ &left));
+ EXPECT_EQ(left, bounds.x());
+
+ int right = 0;
+ EXPECT_TRUE(root_dict->GetInteger(kBrowserWindowPlacement + L".right",
+ &right));
+ EXPECT_EQ(right, bounds.x() + bounds.width());
+
+ // Find if launched window is maximized.
+ bool is_window_maximized = false;
+ ASSERT_TRUE(window->IsMaximized(&is_window_maximized));
+ bool is_maximized = false;
+ EXPECT_TRUE(root_dict->GetBoolean(kBrowserWindowPlacement + L".maximized",
+ &is_maximized));
+ EXPECT_EQ(is_maximized, is_window_maximized);
+}
+#endif
diff --git a/chrome/browser/pref_service_unittest.cc b/chrome/browser/pref_service_unittest.cc
new file mode 100644
index 0000000..aac27b9
--- /dev/null
+++ b/chrome/browser/pref_service_unittest.cc
@@ -0,0 +1,270 @@
+// Copyright (c) 2009 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.
+
+#include "app/test/data/resource.h"
+#include "base/file_util.h"
+#include "base/message_loop.h"
+#include "base/path_service.h"
+#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/pref_service.h"
+#include "chrome/common/chrome_paths.h"
+#include "chrome/common/json_value_serializer.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_type.h"
+#include "chrome/common/pref_names.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class PrefServiceTest : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ // Name a subdirectory of the temp directory.
+ ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_));
+ test_dir_ = test_dir_.AppendASCII("PrefServiceTest");
+
+ // Create a fresh, empty copy of this directory.
+ file_util::Delete(test_dir_, true);
+ file_util::CreateDirectory(test_dir_);
+
+ ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_));
+ data_dir_ = data_dir_.AppendASCII("pref_service");
+ ASSERT_TRUE(file_util::PathExists(data_dir_));
+ }
+ virtual void TearDown() {
+ // Clean up test directory
+ ASSERT_TRUE(file_util::Delete(test_dir_, true));
+ ASSERT_FALSE(file_util::PathExists(test_dir_));
+ }
+
+ // the path to temporary directory used to contain the test operations
+ FilePath test_dir_;
+ // the path to the directory where the test data is stored
+ FilePath data_dir_;
+};
+
+class TestPrefObserver : public NotificationObserver {
+ public:
+ TestPrefObserver(const PrefService* prefs, const std::wstring& pref_name,
+ const std::wstring& new_pref_value)
+ : observer_fired_(false),
+ prefs_(prefs),
+ pref_name_(pref_name),
+ new_pref_value_(new_pref_value) {
+ }
+ virtual ~TestPrefObserver() {}
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ EXPECT_EQ(type.value, NotificationType::PREF_CHANGED);
+ PrefService* prefs_in = Source<PrefService>(source).ptr();
+ EXPECT_EQ(prefs_in, prefs_);
+ std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
+ EXPECT_EQ(*pref_name_in, pref_name_);
+ EXPECT_EQ(new_pref_value_, prefs_in->GetString(L"homepage"));
+ observer_fired_ = true;
+ }
+
+ bool observer_fired() { return observer_fired_; }
+
+ void Reset(const std::wstring& new_pref_value) {
+ observer_fired_ = false;
+ new_pref_value_ = new_pref_value;
+ }
+
+ private:
+ bool observer_fired_;
+ const PrefService* prefs_;
+ const std::wstring pref_name_;
+ std::wstring new_pref_value_;
+};
+
+TEST_F(PrefServiceTest, Basic) {
+ {
+ // Test that it fails on nonexistent file.
+ FilePath bogus_input_file = data_dir_.AppendASCII("read.txt");
+ PrefService prefs(bogus_input_file);
+ EXPECT_FALSE(prefs.ReloadPersistentPrefs());
+ }
+
+ ASSERT_TRUE(file_util::CopyFile(data_dir_.AppendASCII("read.json"),
+ test_dir_.AppendASCII("write.json")));
+
+ // Test that the persistent value can be loaded.
+ FilePath input_file = test_dir_.AppendASCII("write.json");
+ ASSERT_TRUE(file_util::PathExists(input_file));
+ PrefService prefs(input_file);
+ ASSERT_TRUE(prefs.ReloadPersistentPrefs());
+
+ // Register test prefs.
+ const wchar_t kNewWindowsInTabs[] = L"tabs.new_windows_in_tabs";
+ const wchar_t kMaxTabs[] = L"tabs.max_tabs";
+ const wchar_t kLongIntPref[] = L"long_int.pref";
+ prefs.RegisterStringPref(prefs::kHomePage, L"");
+ prefs.RegisterBooleanPref(kNewWindowsInTabs, false);
+ prefs.RegisterIntegerPref(kMaxTabs, 0);
+ prefs.RegisterStringPref(kLongIntPref, L"2147483648");
+
+ std::wstring microsoft(L"http://www.microsoft.com");
+ std::wstring cnn(L"http://www.cnn.com");
+ std::wstring homepage(L"http://www.example.com");
+
+ EXPECT_EQ(cnn, prefs.GetString(prefs::kHomePage));
+
+ const wchar_t kSomeDirectory[] = L"some_directory";
+ FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/"));
+ prefs.RegisterFilePathPref(kSomeDirectory, FilePath());
+
+ // Test reading some other data types from sub-dictionaries, and
+ // writing to the persistent store.
+ EXPECT_TRUE(prefs.GetBoolean(kNewWindowsInTabs));
+ prefs.SetBoolean(kNewWindowsInTabs, false);
+ EXPECT_FALSE(prefs.GetBoolean(kNewWindowsInTabs));
+
+ EXPECT_EQ(20, prefs.GetInteger(kMaxTabs));
+ prefs.SetInteger(kMaxTabs, 10);
+ EXPECT_EQ(10, prefs.GetInteger(kMaxTabs));
+
+ EXPECT_EQ(2147483648LL, prefs.GetInt64(kLongIntPref));
+ prefs.SetInt64(kLongIntPref, 214748364842LL);
+ EXPECT_EQ(214748364842LL, prefs.GetInt64(kLongIntPref));
+
+ EXPECT_EQ(FilePath::StringType(FILE_PATH_LITERAL("/usr/local/")),
+ prefs.GetFilePath(kSomeDirectory).value());
+ prefs.SetFilePath(kSomeDirectory, some_path);
+ EXPECT_EQ(some_path.value(), prefs.GetFilePath(kSomeDirectory).value());
+
+ // Serialize and compare to expected output.
+ // SavePersistentPrefs uses ImportantFileWriter which needs a file thread.
+ MessageLoop message_loop;
+ ChromeThread file_thread(ChromeThread::FILE, &message_loop);
+ FilePath output_file = test_dir_.AppendASCII("write.json");
+ FilePath golden_output_file = data_dir_.AppendASCII("write.golden.json");
+ ASSERT_TRUE(file_util::PathExists(golden_output_file));
+ ASSERT_TRUE(prefs.SavePersistentPrefs());
+ MessageLoop::current()->RunAllPending();
+ EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file));
+ ASSERT_TRUE(file_util::Delete(output_file, false));
+}
+
+TEST_F(PrefServiceTest, Observers) {
+ FilePath input_file = data_dir_.AppendASCII("read.json");
+ EXPECT_TRUE(file_util::PathExists(input_file));
+
+ PrefService prefs(input_file);
+
+ EXPECT_TRUE(prefs.ReloadPersistentPrefs());
+
+ const wchar_t pref_name[] = L"homepage";
+ prefs.RegisterStringPref(pref_name, L"");
+ EXPECT_EQ(std::wstring(L"http://www.cnn.com"), prefs.GetString(pref_name));
+
+ const std::wstring new_pref_value(L"http://www.google.com/");
+ TestPrefObserver obs(&prefs, pref_name, new_pref_value);
+ prefs.AddPrefObserver(pref_name, &obs);
+ // This should fire the checks in TestPrefObserver::Observe.
+ prefs.SetString(pref_name, new_pref_value);
+
+ // Make sure the tests were actually run.
+ EXPECT_TRUE(obs.observer_fired());
+
+ // Now try adding a second pref observer.
+ const std::wstring new_pref_value2(L"http://www.youtube.com/");
+ obs.Reset(new_pref_value2);
+ TestPrefObserver obs2(&prefs, pref_name, new_pref_value2);
+ prefs.AddPrefObserver(pref_name, &obs2);
+ // This should fire the checks in obs and obs2.
+ prefs.SetString(pref_name, new_pref_value2);
+ EXPECT_TRUE(obs.observer_fired());
+ EXPECT_TRUE(obs2.observer_fired());
+
+ // Make sure obs2 still works after removing obs.
+ prefs.RemovePrefObserver(pref_name, &obs);
+ obs.Reset(L"");
+ obs2.Reset(new_pref_value);
+ // This should only fire the observer in obs2.
+ prefs.SetString(pref_name, new_pref_value);
+ EXPECT_FALSE(obs.observer_fired());
+ EXPECT_TRUE(obs2.observer_fired());
+
+ // Ok, clean up.
+ prefs.RemovePrefObserver(pref_name, &obs2);
+}
+
+// TODO(port): port this test to POSIX.
+#if defined(OS_WIN)
+TEST_F(PrefServiceTest, LocalizedPrefs) {
+ PrefService prefs((FilePath()));
+ const wchar_t kBoolean[] = L"boolean";
+ const wchar_t kInteger[] = L"integer";
+ const wchar_t kString[] = L"string";
+ prefs.RegisterLocalizedBooleanPref(kBoolean, IDS_LOCALE_BOOL);
+ prefs.RegisterLocalizedIntegerPref(kInteger, IDS_LOCALE_INT);
+ prefs.RegisterLocalizedStringPref(kString, IDS_LOCALE_STRING);
+
+ // The locale default should take preference over the user default.
+ EXPECT_FALSE(prefs.GetBoolean(kBoolean));
+ EXPECT_EQ(1, prefs.GetInteger(kInteger));
+ EXPECT_EQ(L"hello", prefs.GetString(kString));
+
+ prefs.SetBoolean(kBoolean, true);
+ EXPECT_TRUE(prefs.GetBoolean(kBoolean));
+ prefs.SetInteger(kInteger, 5);
+ EXPECT_EQ(5, prefs.GetInteger(kInteger));
+ prefs.SetString(kString, L"foo");
+ EXPECT_EQ(L"foo", prefs.GetString(kString));
+}
+#endif
+
+TEST_F(PrefServiceTest, NoObserverFire) {
+ PrefService prefs((FilePath()));
+
+ const wchar_t pref_name[] = L"homepage";
+ prefs.RegisterStringPref(pref_name, L"");
+
+ const std::wstring new_pref_value(L"http://www.google.com/");
+ TestPrefObserver obs(&prefs, pref_name, new_pref_value);
+ prefs.AddPrefObserver(pref_name, &obs);
+ // This should fire the checks in TestPrefObserver::Observe.
+ prefs.SetString(pref_name, new_pref_value);
+
+ // Make sure the observer was actually fired.
+ EXPECT_TRUE(obs.observer_fired());
+
+ // Setting the pref to the same value should not set the pref value a second
+ // time.
+ obs.Reset(new_pref_value);
+ prefs.SetString(pref_name, new_pref_value);
+ EXPECT_FALSE(obs.observer_fired());
+
+ // Clearing the pref should cause the pref to fire.
+ obs.Reset(L"");
+ prefs.ClearPref(pref_name);
+ EXPECT_TRUE(obs.observer_fired());
+
+ // Clearing the pref again should not cause the pref to fire.
+ obs.Reset(L"");
+ prefs.ClearPref(pref_name);
+ EXPECT_FALSE(obs.observer_fired());
+
+ // Ok, clean up.
+ prefs.RemovePrefObserver(pref_name, &obs);
+}
+
+TEST_F(PrefServiceTest, HasPrefPath) {
+ PrefService prefs((FilePath()));
+
+ const wchar_t path[] = L"fake.path";
+
+ // Shouldn't initially have a path.
+ EXPECT_FALSE(prefs.HasPrefPath(path));
+
+ // Register the path. This doesn't set a value, so the path still shouldn't
+ // exist.
+ prefs.RegisterStringPref(path, std::wstring());
+ EXPECT_FALSE(prefs.HasPrefPath(path));
+
+ // Set a value and make sure we have a path.
+ prefs.SetString(path, L"blah");
+ EXPECT_TRUE(prefs.HasPrefPath(path));
+}
diff --git a/chrome/browser/privacy_blacklist/blacklist.cc b/chrome/browser/privacy_blacklist/blacklist.cc
index bdefc7e..23526b0 100644
--- a/chrome/browser/privacy_blacklist/blacklist.cc
+++ b/chrome/browser/privacy_blacklist/blacklist.cc
@@ -11,9 +11,9 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/string_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "net/http/http_util.h"
diff --git a/chrome/browser/privacy_blacklist/blacklist_unittest.cc b/chrome/browser/privacy_blacklist/blacklist_unittest.cc
index 760ad97..16d2094 100644
--- a/chrome/browser/privacy_blacklist/blacklist_unittest.cc
+++ b/chrome/browser/privacy_blacklist/blacklist_unittest.cc
@@ -9,9 +9,9 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "chrome/browser/browser_prefs.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
class BlacklistTest : public testing::Test {
diff --git a/chrome/browser/profile_manager.cc b/chrome/browser/profile_manager.cc
index 950792b..debfb35 100644
--- a/chrome/browser/profile_manager.cc
+++ b/chrome/browser/profile_manager.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/browser_window.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -24,7 +25,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "net/http/http_transaction_factory.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/profile_manager_unittest.cc b/chrome/browser/profile_manager_unittest.cc
index 02813a6..0f339f7 100644
--- a/chrome/browser/profile_manager_unittest.cc
+++ b/chrome/browser/profile_manager_unittest.cc
@@ -6,11 +6,11 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
class ProfileManagerTest : public testing::Test {
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 88109ae..e1405d3 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/notifications_prefs_cache.h"
#include "chrome/browser/plugin_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/privacy_blacklist/blacklist.h"
@@ -50,7 +51,6 @@
#include "chrome/common/histogram_synchronizer.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/worker_messages.h"
diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc
index f5684ae..ff064fe 100644
--- a/chrome/browser/renderer_host/web_cache_manager.cc
+++ b/chrome/browser/renderer_host/web_cache_manager.cc
@@ -11,10 +11,10 @@
#include "base/sys_info.h"
#include "base/time.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index c19e4efc..43a2e27 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/safe_browsing/protocol_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
@@ -20,7 +21,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "net/base/registry_controlled_domain.h"
diff --git a/chrome/browser/search_engines/keyword_editor_controller.cc b/chrome/browser/search_engines/keyword_editor_controller.cc
index 9d8b9d9..997f37c 100644
--- a/chrome/browser/search_engines/keyword_editor_controller.cc
+++ b/chrome/browser/search_engines/keyword_editor_controller.cc
@@ -5,12 +5,12 @@
#include "chrome/browser/search_engines/keyword_editor_controller.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/search_engines/template_url_table_model.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
KeywordEditorController::KeywordEditorController(Profile* profile)
: profile_(profile) {
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index a356ad0..0f3b6f3 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -12,12 +12,12 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "net/base/net_util.h"
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index 8b4e6f3..91088ab 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -10,10 +10,10 @@
#include "base/command_line.h"
#include "base/string_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#if defined(OS_WIN)
#undef IN // On Windows, windef.h defines this, which screws up "India" cases.
diff --git a/chrome/browser/session_startup_pref.cc b/chrome/browser/session_startup_pref.cc
index 8def8fa..87c149d 100644
--- a/chrome/browser/session_startup_pref.cc
+++ b/chrome/browser/session_startup_pref.cc
@@ -6,9 +6,9 @@
#include "base/string_util.h"
#include "chrome/browser/defaults.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
namespace {
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc
index 2884d5a..b7e9574 100644
--- a/chrome/browser/spellcheck_host.cc
+++ b/chrome/browser/spellcheck_host.cc
@@ -13,12 +13,12 @@
#include "base/string_util.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/net/url_request_context_getter.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/spellcheck_host_observer.h"
#include "chrome/browser/spellchecker_platform_engine.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/spellcheck_common.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc
index 2622402..0746d61 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/cert_store.h"
#include "chrome/browser/dom_operation_notification_details.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/ssl/ssl_cert_error_handler.h"
@@ -22,7 +23,6 @@
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index dfe084b..711a22e 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -4,12 +4,12 @@
#include "base/time.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/interstitial_page.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc
index f19b9ea..c55a47b 100644
--- a/chrome/browser/ssl/ssl_manager.cc
+++ b/chrome/browser/ssl/ssl_manager.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/load_from_memory_cache_details.h"
#include "chrome/browser/net/url_request_tracking.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/resource_request_details.h"
#include "chrome/browser/ssl/ssl_cert_error_handler.h"
#include "chrome/browser/ssl/ssl_policy.h"
@@ -17,7 +18,6 @@
#include "chrome/browser/tab_contents/provisional_load_details.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "net/base/cert_status_flags.h"
diff --git a/chrome/browser/ssl/ssl_policy.cc b/chrome/browser/ssl/ssl_policy.cc
index 3f54b4e..2619c18 100644
--- a/chrome/browser/ssl/ssl_policy.cc
+++ b/chrome/browser/ssl/ssl_policy.cc
@@ -24,7 +24,7 @@
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/time_format.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/sync/glue/preference_change_processor.h b/chrome/browser/sync/glue/preference_change_processor.h
index c9787c8..dbd548a 100644
--- a/chrome/browser/sync/glue/preference_change_processor.h
+++ b/chrome/browser/sync/glue/preference_change_processor.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_SYNC_GLUE_PREFERENCE_CHANGE_PROCESSOR_H_
#include "base/scoped_ptr.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/change_processor.h"
#include "chrome/browser/sync/glue/sync_backend_host.h"
#include "chrome/common/notification_observer.h"
-#include "chrome/common/pref_service.h"
namespace browser_sync {
diff --git a/chrome/browser/sync/glue/preference_model_associator.cc b/chrome/browser/sync/glue/preference_model_associator.cc
index 4757e25..26cf8ed 100644
--- a/chrome/browser/sync/glue/preference_model_associator.cc
+++ b/chrome/browser/sync/glue/preference_model_associator.cc
@@ -7,13 +7,13 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/values.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/protocol/preference_specifics.pb.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
namespace browser_sync {
diff --git a/chrome/browser/sync/glue/preference_model_associator.h b/chrome/browser/sync/glue/preference_model_associator.h
index 264e862..19551db 100644
--- a/chrome/browser/sync/glue/preference_model_associator.h
+++ b/chrome/browser/sync/glue/preference_model_associator.h
@@ -12,8 +12,8 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/sync/glue/model_associator.h"
-#include "chrome/common/pref_service.h"
class ProfileSyncService;
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index f0e663a..6445b06 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -14,12 +14,12 @@
#include "base/string_util.h"
#include "base/task.h"
#include "chrome/browser/history/history_types.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/change_processor.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/time_format.h"
#include "grit/generated_resources.h"
#include "net/base/cookie_monster.h"
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index 89cdab8a..0518367 100755
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -19,12 +19,12 @@
#include "chrome/browser/cocoa/html_dialog_window_controller_cppsafe.h"
#endif
#include "chrome/browser/google_service_auth_error.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/locale_settings.h"
// XPath expression for finding specific iframes.
diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc
index bcc22845..3afbff9b 100644
--- a/chrome/browser/sync/sync_setup_wizard.cc
+++ b/chrome/browser/sync/sync_setup_wizard.cc
@@ -7,15 +7,15 @@
#include "app/resource_bundle.h"
#include "base/message_loop.h"
#include "base/singleton.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/browser/google_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_setup_flow.h"
#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
#include "grit/app_resources.h"
diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc
index 2d79bac..bdb41cb 100644
--- a/chrome/browser/sync/sync_setup_wizard_unittest.cc
+++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc
@@ -10,11 +10,11 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/google_service_auth_error.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_setup_flow.h"
#include "chrome/browser/sync/sync_setup_wizard.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/browser_with_test_window_test.h"
#include "chrome/test/testing_profile.h"
#include "chrome/test/test_browser_window.h"
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index a038779..58d4123 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/browser_url_handler.h"
#include "chrome/browser/in_process_webkit/dom_storage_context.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/sessions/session_types.h"
@@ -23,7 +24,6 @@
#include "chrome/common/navigation_types.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
diff --git a/chrome/browser/tab_contents/navigation_entry.cc b/chrome/browser/tab_contents/navigation_entry.cc
index b5c1cd0..32e0474 100644
--- a/chrome/browser/tab_contents/navigation_entry.cc
+++ b/chrome/browser/tab_contents/navigation_entry.cc
@@ -6,11 +6,11 @@
#include "app/resource_bundle.h"
#include "base/string_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
#include "net/base/net_util.h"
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 43c6634..e08554e 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/browser_url_util.h"
#include "chrome/browser/page_info_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/search_versus_navigate_classifier.h"
@@ -29,7 +30,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
#include "net/base/escape.h"
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 9b3be5d..baae7b9 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -8,6 +8,7 @@
#include "base/string_util.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/character_encoding.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -18,7 +19,6 @@
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
void RenderViewHostDelegateViewHelper::CreateNewWindow(
int route_id,
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 483d9b5..f050c93 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -42,6 +42,7 @@
#include "chrome/browser/omnibox_search_hint.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/plugin_installer.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -68,7 +69,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/renderer_preferences.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc
index 2200a38..afc547c 100644
--- a/chrome/browser/tab_contents/web_contents_unittest.cc
+++ b/chrome/browser/tab_contents/web_contents_unittest.cc
@@ -4,6 +4,7 @@
#include "app/message_box_flags.h"
#include "base/logging.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/renderer_host/test/test_render_view_host.h"
@@ -13,7 +14,6 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/test_tab_contents.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/testing_profile.h"
diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.h b/chrome/browser/tabs/tab_strip_model_order_controller.h
index 9beaa03..a74bf52 100644
--- a/chrome/browser/tabs/tab_strip_model_order_controller.h
+++ b/chrome/browser/tabs/tab_strip_model_order_controller.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H__
#define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H__
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/common/page_transition_types.h"
-#include "chrome/common/pref_member.h"
class TabContents;
class TabStripModel;
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index e9ede55..6453663 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -17,13 +17,13 @@
#include "chrome/browser/browser_window.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/url_request_tracking.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/task_manager_resource_providers.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/thumbnail_store.cc b/chrome/browser/thumbnail_store.cc
index a861e4a..d89368c 100644
--- a/chrome/browser/thumbnail_store.cc
+++ b/chrome/browser/thumbnail_store.cc
@@ -19,8 +19,8 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_notifications.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc
index ca0c436..f3f87a3 100644
--- a/chrome/browser/toolbar_model.cc
+++ b/chrome/browser/toolbar_model.cc
@@ -7,13 +7,13 @@
#include "app/l10n_util.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/cert_store.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/ssl/ssl_error_info.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
#include "net/base/cert_status_flags.h"
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index a1ea1fd..6763a3f 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -23,7 +24,6 @@
#include "chrome/common/notification_source.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
// static
bool TranslateManager::test_enabled_ = false;
diff --git a/chrome/browser/translate/translate_prefs.cc b/chrome/browser/translate/translate_prefs.cc
index ab69058..3077cb0 100644
--- a/chrome/browser/translate/translate_prefs.cc
+++ b/chrome/browser/translate/translate_prefs.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/translate/translate_prefs.h"
#include "base/string_util.h"
-#include "chrome/common/pref_service.h"
+#include "chrome/browser/pref_service.h"
static const wchar_t kPrefTranslateLanguageBlacklist[] =
L"translate_language_blacklist";
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 2c903ad..c175881 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
@@ -34,7 +35,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc
index 3d84ff8..5d6cbdb 100644
--- a/chrome/browser/views/bookmark_bar_view_test.cc
+++ b/chrome/browser/views/bookmark_bar_view_test.cc
@@ -7,11 +7,11 @@
#include "chrome/browser/automation/ui_controls.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/browser/views/bookmark_bar_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/testing_profile.h"
#include "chrome/test/interactive_ui/view_event_test_base.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/bookmark_context_menu_controller_views.cc b/chrome/browser/views/bookmark_context_menu_controller_views.cc
index 343973d..edbf9bd 100644
--- a/chrome/browser/views/bookmark_context_menu_controller_views.cc
+++ b/chrome/browser/views/bookmark_context_menu_controller_views.cc
@@ -12,10 +12,10 @@
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/input_window_dialog.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
namespace {
diff --git a/chrome/browser/views/bookmark_context_menu_test.cc b/chrome/browser/views/bookmark_context_menu_test.cc
index 9082324..aafbd42 100644
--- a/chrome/browser/views/bookmark_context_menu_test.cc
+++ b/chrome/browser/views/bookmark_context_menu_test.cc
@@ -6,11 +6,11 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/views/bookmark_context_menu.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/browser/tab_contents/page_navigator.h"
+#include "chrome/browser/views/bookmark_context_menu.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/testing_profile.h"
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc
index 8166a36..b993775 100644
--- a/chrome/browser/views/bookmark_editor_view.cc
+++ b/chrome/browser/views/bookmark_editor_view.cc
@@ -11,10 +11,10 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/history/history.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/bookmark_editor_view_unittest.cc b/chrome/browser/views/bookmark_editor_view_unittest.cc
index a43a928..66a6ab4 100644
--- a/chrome/browser/views/bookmark_editor_view_unittest.cc
+++ b/chrome/browser/views/bookmark_editor_view_unittest.cc
@@ -6,10 +6,10 @@
#include "base/string_util.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/bookmark_editor_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index b6f4c8a..84b059c 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -23,13 +23,13 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/views/bookmark_editor_view.h"
#include "chrome/browser/views/bookmark_folder_tree_view.h"
#include "chrome/browser/views/bookmark_table_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/bookmark_table_view.cc b/chrome/browser/views/bookmark_table_view.cc
index 1bf4245..0dcf162 100644
--- a/chrome/browser/views/bookmark_table_view.cc
+++ b/chrome/browser/views/bookmark_table_view.cc
@@ -17,9 +17,9 @@
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_table_model.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "views/controls/table/table_view_observer.h"
#include "views/view_constants.h"
diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc
index 0b2616a..90b9fbe 100644
--- a/chrome/browser/views/bug_report_view.cc
+++ b/chrome/browser/views/bug_report_view.cc
@@ -10,13 +10,13 @@
#include "base/string_util.h"
#include "chrome/browser/bug_report_util.h"
#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/views/chrome_views_delegate.cc b/chrome/browser/views/chrome_views_delegate.cc
index ce0e975..ce06b1a 100644
--- a/chrome/browser/views/chrome_views_delegate.cc
+++ b/chrome/browser/views/chrome_views_delegate.cc
@@ -1,6 +1,6 @@
-// Copyright (c) 2009 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.
+// Copyright (c) 2009 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.
#include "chrome/browser/views/chrome_views_delegate.h"
@@ -9,9 +9,9 @@
#include "base/scoped_ptr.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/window_sizer.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/pref_service.h"
///////////////////////////////////////////////////////////////////////////////
// ChromeViewsDelegate, views::ViewsDelegate implementation:
diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc
index c515656..d06644d 100644
--- a/chrome/browser/views/clear_browsing_data.cc
+++ b/chrome/browser/views/clear_browsing_data.cc
@@ -8,10 +8,10 @@
#include "app/gfx/insets.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/views/constrained_window_win.cc b/chrome/browser/views/constrained_window_win.cc
index 36c3ef7..ada759b 100644
--- a/chrome/browser/views/constrained_window_win.cc
+++ b/chrome/browser/views/constrained_window_win.cc
@@ -14,6 +14,7 @@
#include "base/gfx/rect.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
@@ -23,7 +24,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/cookie_prompt_view.cc b/chrome/browser/views/cookie_prompt_view.cc
index 0cd93da..1870b23 100644
--- a/chrome/browser/views/cookie_prompt_view.cc
+++ b/chrome/browser/views/cookie_prompt_view.cc
@@ -14,6 +14,7 @@
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/cookie_modal_dialog.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/browser_dialogs.h"
#include "chrome/browser/views/cookie_info_view.h"
@@ -21,7 +22,6 @@
#include "chrome/browser/views/local_storage_set_item_info_view.h"
#include "chrome/browser/views/options/content_settings_window_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "net/base/cookie_monster.h"
diff --git a/chrome/browser/views/create_application_shortcut_view.cc b/chrome/browser/views/create_application_shortcut_view.cc
index 0cb2b3d..81aabec 100644
--- a/chrome/browser/views/create_application_shortcut_view.cc
+++ b/chrome/browser/views/create_application_shortcut_view.cc
@@ -9,12 +9,12 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/callback.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "net/base/load_flags.h"
diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc
index 0fdd952..75aeb88 100644
--- a/chrome/browser/views/first_run_view_base.cc
+++ b/chrome/browser/views/first_run_view_base.cc
@@ -13,10 +13,10 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/first_run.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 0b304bc..ae16273 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/ntp_background_util.h"
#include "chrome/browser/page_info_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/bookmark_bar_view.h"
@@ -61,7 +62,6 @@
#include "chrome/common/native_window_notification_source.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc
index 24f6464..3776c65 100644
--- a/chrome/browser/views/keyword_editor_view.cc
+++ b/chrome/browser/views/keyword_editor_view.cc
@@ -10,13 +10,13 @@
#include "base/gfx/point.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/search_engines/template_url_table_model.h"
#include "chrome/browser/views/browser_dialogs.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index 4225bc0..61f93ab 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -28,6 +28,8 @@
#include "chrome/browser/gears_integration.h"
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/options_util.h"
+#include "chrome/browser/pref_member.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
@@ -37,9 +39,7 @@
#include "chrome/browser/views/options/content_settings_window_view.h"
#include "chrome/browser/views/options/fonts_languages_window_view.h"
#include "chrome/browser/views/restart_message_box.h"
-#include "chrome/common/pref_member.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/options/content_filter_page_view.h b/chrome/browser/views/options/content_filter_page_view.h
index 1370b77..3efb7dc 100644
--- a/chrome/browser/views/options/content_filter_page_view.h
+++ b/chrome/browser/views/options/content_filter_page_view.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_FILTER_PAGE_VIEW_H_
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_FILTER_PAGE_VIEW_H_
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/views/options/options_page_view.h"
#include "chrome/common/content_settings_types.h"
-#include "chrome/common/pref_member.h"
#include "views/controls/button/button.h"
#include "views/view.h"
diff --git a/chrome/browser/views/options/content_page_view.h b/chrome/browser/views/options/content_page_view.h
index 767ab9b..dd7b456 100644
--- a/chrome/browser/views/options/content_page_view.h
+++ b/chrome/browser/views/options/content_page_view.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_
#include "chrome/browser/autofill/personal_data_manager.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/views/options/options_page_view.h"
#include "chrome/browser/views/confirm_message_box_dialog.h"
-#include "chrome/common/pref_member.h"
#include "views/controls/button/button.h"
#include "views/controls/link.h"
#include "views/view.h"
diff --git a/chrome/browser/views/options/content_settings_window_view.cc b/chrome/browser/views/options/content_settings_window_view.cc
index fb58d7c..2a09034 100644
--- a/chrome/browser/views/options/content_settings_window_view.cc
+++ b/chrome/browser/views/options/content_settings_window_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/options/advanced_page_view.h"
#include "chrome/browser/views/options/content_filter_page_view.h"
@@ -14,7 +15,6 @@
#include "chrome/browser/views/options/general_page_view.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/views/options/content_settings_window_view.h b/chrome/browser/views/options/content_settings_window_view.h
index c4ce14f..9bc8fcef 100644
--- a/chrome/browser/views/options/content_settings_window_view.h
+++ b/chrome/browser/views/options/content_settings_window_view.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_
+#include "chrome/browser/pref_member.h"
#include "chrome/common/content_settings_types.h"
-#include "chrome/common/pref_member.h"
#include "views/controls/tabbed_pane/tabbed_pane.h"
#include "views/view.h"
#include "views/window/dialog_delegate.h"
diff --git a/chrome/browser/views/options/cookie_filter_page_view.cc b/chrome/browser/views/options/cookie_filter_page_view.cc
index 11ab354..1d447cd 100644
--- a/chrome/browser/views/options/cookie_filter_page_view.cc
+++ b/chrome/browser/views/options/cookie_filter_page_view.cc
@@ -11,11 +11,11 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/host_content_settings_map.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/options/cookies_view.h"
#include "chrome/browser/views/options/exceptions_view.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/controls/button/checkbox.h"
diff --git a/chrome/browser/views/options/cookie_filter_page_view.h b/chrome/browser/views/options/cookie_filter_page_view.h
index d2129f0..445afee 100644
--- a/chrome/browser/views/options/cookie_filter_page_view.h
+++ b/chrome/browser/views/options/cookie_filter_page_view.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_VIEWS_OPTIONS_COOKIE_FILTER_PAGE_VIEW_H_
#define CHROME_BROWSER_VIEWS_OPTIONS_COOKIE_FILTER_PAGE_VIEW_H_
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/views/options/options_page_view.h"
-#include "chrome/common/pref_member.h"
#include "views/controls/button/button.h"
#include "views/view.h"
diff --git a/chrome/browser/views/options/exceptions_page_view.cc b/chrome/browser/views/options/exceptions_page_view.cc
index a0dd49c..6001cc8 100644
--- a/chrome/browser/views/options/exceptions_page_view.cc
+++ b/chrome/browser/views/options/exceptions_page_view.cc
@@ -6,9 +6,9 @@
#include "app/l10n_util.h"
#include "base/string_util.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "views/background.h"
#include "views/controls/button/native_button.h"
diff --git a/chrome/browser/views/options/fonts_languages_window_view.cc b/chrome/browser/views/options/fonts_languages_window_view.cc
index d26aea2..4837582 100644
--- a/chrome/browser/views/options/fonts_languages_window_view.cc
+++ b/chrome/browser/views/options/fonts_languages_window_view.cc
@@ -6,12 +6,12 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/options/fonts_page_view.h"
#include "chrome/browser/views/options/languages_page_view.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc
index a24458d..34d119f 100644
--- a/chrome/browser/views/options/fonts_page_view.cc
+++ b/chrome/browser/views/options/fonts_page_view.cc
@@ -22,10 +22,10 @@
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/character_encoding.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/views/options/fonts_page_view.h b/chrome/browser/views/options/fonts_page_view.h
index 7404075..8f9ee0b 100644
--- a/chrome/browser/views/options/fonts_page_view.h
+++ b/chrome/browser/views/options/fonts_page_view.h
@@ -7,9 +7,9 @@
#include <string>
-#include "chrome/browser/views/options/options_page_view.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/shell_dialogs.h"
-#include "chrome/common/pref_member.h"
+#include "chrome/browser/views/options/options_page_view.h"
#include "views/controls/combobox/combobox.h"
#include "views/controls/button/button.h"
#include "views/view.h"
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index 7b60c24..317f596 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/favicon_service.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/net/url_fixer_upper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/session_startup_pref.h"
#include "chrome/browser/search_engines/template_url.h"
@@ -26,7 +27,6 @@
#include "chrome/browser/views/options/options_group_view.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h
index fea8b4d..dae9fa5 100644
--- a/chrome/browser/views/options/general_page_view.h
+++ b/chrome/browser/views/options/general_page_view.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_
#define CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/views/options/options_page_view.h"
#include "chrome/browser/views/url_picker.h"
-#include "chrome/common/pref_member.h"
#include "views/controls/combobox/combobox.h"
#include "views/controls/button/button.h"
#include "views/controls/table/table_view_observer.h"
diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc
index 542c66f..4c56faa 100644
--- a/chrome/browser/views/options/languages_page_view.cc
+++ b/chrome/browser/views/options/languages_page_view.cc
@@ -21,11 +21,11 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/language_combobox_model.h"
#include "chrome/browser/language_order_table_model.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/browser/views/restart_message_box.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/spellcheck_common.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/views/options/languages_page_view.h b/chrome/browser/views/options/languages_page_view.h
index 4dad30c..72de18b 100644
--- a/chrome/browser/views/options/languages_page_view.h
+++ b/chrome/browser/views/options/languages_page_view.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
#define CHROME_BROWSER_VIEWS_OPTIONS_LANGUAGES_PAGE_VIEW_H__
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/views/options/options_page_view.h"
-#include "chrome/common/pref_member.h"
#include "views/controls/combobox/combobox.h"
#include "views/controls/button/button.h"
#include "views/controls/table/table_view_observer.h"
diff --git a/chrome/browser/views/options/options_page_view.cc b/chrome/browser/views/options/options_page_view.cc
index 6e7747b..c0d5efb 100644
--- a/chrome/browser/views/options/options_page_view.cc
+++ b/chrome/browser/views/options/options_page_view.cc
@@ -6,8 +6,8 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_service.h"
#include "views/widget/widget.h"
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc
index 1461683..6b2e206 100644
--- a/chrome/browser/views/options/options_window_view.cc
+++ b/chrome/browser/views/options/options_window_view.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/views/options/advanced_page_view.h"
#include "chrome/browser/views/options/content_page_view.h"
@@ -16,7 +17,6 @@
#include "chrome/browser/window_sizer.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/views/options/passwords_page_view.cc
index da047f6..0cff819 100644
--- a/chrome/browser/views/options/passwords_page_view.cc
+++ b/chrome/browser/views/options/passwords_page_view.cc
@@ -7,9 +7,9 @@
#include "app/l10n_util.h"
#include "base/string_util.h"
#include "chrome/browser/password_manager/password_store.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "views/background.h"
#include "views/controls/button/native_button.h"
diff --git a/chrome/browser/views/tabs/side_tab_strip.cc b/chrome/browser/views/tabs/side_tab_strip.cc
index 04bd44b..74df961 100644
--- a/chrome/browser/views/tabs/side_tab_strip.cc
+++ b/chrome/browser/views/tabs/side_tab_strip.cc
@@ -6,11 +6,11 @@
#include "app/gfx/canvas.h"
#include "base/command_line.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/view_ids.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
namespace {
const int kVerticalTabSpacing = 2;
diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc
index 3487f0e..cfc66f7 100644
--- a/chrome/browser/views/task_manager_view.cc
+++ b/chrome/browser/views/task_manager_view.cc
@@ -12,10 +12,10 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/memory_purger.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/views/browser_dialogs.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index cde3b64..2d751d2 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -26,6 +26,7 @@
#include "chrome/browser/defaults.h"
#include "chrome/browser/encoding_menu_controller.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_ui_util.h"
@@ -42,7 +43,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index c9baae5..ffbec68f 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -14,10 +14,10 @@
#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/page_menu_model.h"
+#include "chrome/browser/pref_member.h"
#include "chrome/browser/views/accessible_toolbar_view.h"
#include "chrome/browser/views/go_button.h"
#include "chrome/browser/views/location_bar_view.h"
-#include "chrome/common/pref_member.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/menu.h"
#include "views/controls/menu/view_menu_delegate.h"
diff --git a/chrome/browser/views/url_picker.cc b/chrome/browser/views/url_picker.cc
index d505e9c..65e983d 100644
--- a/chrome/browser/views/url_picker.cc
+++ b/chrome/browser/views/url_picker.cc
@@ -13,10 +13,10 @@
#include "base/string_util.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/possible_url_model.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
diff --git a/chrome/browser/web_resource/web_resource_service.h b/chrome/browser/web_resource/web_resource_service.h
index a125cdc9..b7c4980 100644
--- a/chrome/browser/web_resource/web_resource_service.h
+++ b/chrome/browser/web_resource/web_resource_service.h
@@ -7,8 +7,8 @@
#include <string>
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/utility_process_host.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/web_resource/web_resource_unpacker.h"
class Profile;
diff --git a/chrome/browser/window_sizer.cc b/chrome/browser/window_sizer.cc
index 0a76a7b..fe6f825 100644
--- a/chrome/browser/window_sizer.cc
+++ b/chrome/browser/window_sizer.cc
@@ -8,8 +8,8 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
///////////////////////////////////////////////////////////////////////////////
// An implementation of WindowSizer::StateProvider that gets the last active