diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 12:32:16 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 12:32:16 +0000 |
commit | 87cc213e32c17d6cd593be45eb40fee4612e7b15 (patch) | |
tree | 203415f99c8d5c1ea0e089da117eab677a1848cb /chrome | |
parent | 32af00b4ee05844f9699599c1762b2aeb6674bce (diff) | |
download | chromium_src-87cc213e32c17d6cd593be45eb40fee4612e7b15.zip chromium_src-87cc213e32c17d6cd593be45eb40fee4612e7b15.tar.gz chromium_src-87cc213e32c17d6cd593be45eb40fee4612e7b15.tar.bz2 |
Reduce the include footprint of pref_service.h
This removes the pref_value_store.h header from the pref_service.h
include list and cleans up any users that were getting the MessageLoop
and BrowserThread definitions indirectly through pref_service.h
BUG=64893
TEST=compiles and passes tests
Review URL: http://codereview.chromium.org/5461001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
26 files changed, 67 insertions, 33 deletions
diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc index 6120c73..cc4fbb9 100644 --- a/chrome/browser/extensions/extension_management_browsertest.cc +++ b/chrome/browser/extensions/extension_management_browsertest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/extensions/extension_test_message_listener.h" #include "chrome/browser/extensions/extension_updater.h" +#include "chrome/browser/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" diff --git a/chrome/browser/extensions/extension_pref_store_unittest.cc b/chrome/browser/extensions/extension_pref_store_unittest.cc index 580dd3e..45b22d5 100644 --- a/chrome/browser/extensions/extension_pref_store_unittest.cc +++ b/chrome/browser/extensions/extension_pref_store_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/testing_pref_service.h" +#include "chrome/test/testing_pref_value_store.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -342,8 +343,8 @@ TEST(ExtensionPrefStoreTest, NotifyWhenNeeded) { // The PrefValueStore takes ownership of the PrefStores; in this case, that's // only an ExtensionPrefStore. Likewise, the PrefService takes ownership of // the PrefValueStore and PrefNotifier. - PrefValueStore* value_store = new TestingPrefService::TestingPrefValueStore( - NULL, NULL, eps, NULL, NULL, NULL, dps); + PrefValueStore* value_store = + new TestingPrefValueStore(NULL, NULL, eps, NULL, NULL, NULL, dps); scoped_ptr<MockPrefService> pref_service(new MockPrefService(value_store)); MockPrefNotifier* pref_notifier = new MockPrefNotifier(pref_service.get(), value_store); diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 96e497f..07195e4 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -7,6 +7,7 @@ #include "base/string_util.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/prefs/pref_notifier.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/notification_service.h" diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 63a62a0..d49674b 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -1508,7 +1508,7 @@ void ExtensionsService::ReloadExtensions() { } void ExtensionsService::GarbageCollectExtensions() { - if (extension_prefs_->pref_service()->read_only()) + if (extension_prefs_->pref_service()->ReadOnly()) return; scoped_ptr<ExtensionPrefs::ExtensionsInfo> info( diff --git a/chrome/browser/extensions/external_policy_extension_provider.cc b/chrome/browser/extensions/external_policy_extension_provider.cc index d482bb3..5b0e489 100644 --- a/chrome/browser/extensions/external_policy_extension_provider.cc +++ b/chrome/browser/extensions/external_policy_extension_provider.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/external_policy_extension_provider.h" +#include "base/logging.h" #include "base/values.h" #include "chrome/common/pref_names.h" #include "chrome/browser/extensions/stateful_external_extension_provider.h" diff --git a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc index 5148116..2ed941d 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc @@ -4,6 +4,8 @@ #include "chrome/browser/geolocation/geolocation_content_settings_map.h" +#include "base/message_loop.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/google/google_url_tracker_unittest.cc b/chrome/browser/google/google_url_tracker_unittest.cc index d9fe0c7..75b9bea 100644 --- a/chrome/browser/google/google_url_tracker_unittest.cc +++ b/chrome/browser/google/google_url_tracker_unittest.cc @@ -3,8 +3,11 @@ // found in the LICENSE file. #include "chrome/browser/google/google_url_tracker.h" + #include "base/command_line.h" +#include "base/message_loop.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/common/net/url_fetcher.h" diff --git a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc b/chrome/browser/gtk/options/languages_page_gtk_unittest.cc index 453eea5..d861c35 100644 --- a/chrome/browser/gtk/options/languages_page_gtk_unittest.cc +++ b/chrome/browser/gtk/options/languages_page_gtk_unittest.cc @@ -6,6 +6,7 @@ #include <gtk/gtk.h> +#include "base/message_loop.h" #include "base/string_util.h" #include "chrome/browser/language_combobox_model.h" #include "chrome/browser/prefs/pref_service.h" diff --git a/chrome/browser/history/history_browsertest.cc b/chrome/browser/history/history_browsertest.cc index d06aaf8..939e9c8 100644 --- a/chrome/browser/history/history_browsertest.cc +++ b/chrome/browser/history/history_browsertest.cc @@ -4,6 +4,8 @@ #include <vector> +#include "base/message_loop.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/history/history.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profile.h" diff --git a/chrome/browser/net/net_pref_observer.cc b/chrome/browser/net/net_pref_observer.cc index 5ab75ff..b912958 100644 --- a/chrome/browser/net/net_pref_observer.cc +++ b/chrome/browser/net/net_pref_observer.cc @@ -7,6 +7,7 @@ #include "chrome/browser/browser_thread.h" #include "chrome/browser/net/predictor_api.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/notification_type.h" #include "chrome/common/pref_names.h" #include "net/http/http_stream_factory.h" diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc index 3c1c8ca..4532dd2 100644 --- a/chrome/browser/notifications/desktop_notification_service_unittest.cc +++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc @@ -4,8 +4,10 @@ #include "chrome/browser/notifications/desktop_notification_service.h" +#include "base/message_loop.h" #include "base/ref_counted.h" #include "base/waitable_event.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/notifications/notifications_prefs_cache.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_pref_update.h" diff --git a/chrome/browser/password_manager/password_manager_unittest.cc b/chrome/browser/password_manager/password_manager_unittest.cc index 2be490f..78eae4a 100644 --- a/chrome/browser/password_manager/password_manager_unittest.cc +++ b/chrome/browser/password_manager/password_manager_unittest.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/message_loop.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/password_manager/password_manager.h" #include "chrome/browser/password_manager/password_manager_delegate.h" #include "chrome/browser/password_manager/password_store.h" diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc index eb8f030..500a1b4 100644 --- a/chrome/browser/password_manager/password_store_default_unittest.cc +++ b/chrome/browser/password_manager/password_store_default_unittest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/notification_details.h" #include "chrome/common/notification_observer_mock.h" +#include "chrome/common/notification_registrar.h" #include "chrome/common/notification_source.h" #include "chrome/common/pref_names.h" #include "chrome/test/signaling_task.h" diff --git a/chrome/browser/prefs/pref_change_registrar.cc b/chrome/browser/prefs/pref_change_registrar.cc index 05372b1..5655a8e 100644 --- a/chrome/browser/prefs/pref_change_registrar.cc +++ b/chrome/browser/prefs/pref_change_registrar.cc @@ -4,6 +4,7 @@ #include "chrome/browser/prefs/pref_change_registrar.h" +#include "base/logging.h" #include "chrome/browser/prefs/pref_service.h" PrefChangeRegistrar::PrefChangeRegistrar() : service_(NULL) {} diff --git a/chrome/browser/prefs/pref_change_registrar_unittest.cc b/chrome/browser/prefs/pref_change_registrar_unittest.cc index 8096ee6..31c513b 100644 --- a/chrome/browser/prefs/pref_change_registrar_unittest.cc +++ b/chrome/browser/prefs/pref_change_registrar_unittest.cc @@ -6,6 +6,7 @@ #include "chrome/common/notification_details.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_source.h" +#include "chrome/common/notification_type.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_pref_service.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index a1baf43..89d7e78 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -21,6 +21,8 @@ #include "base/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/browser_thread.h" +#include "chrome/browser/prefs/pref_notifier.h" +#include "chrome/browser/prefs/pref_value_store.h" #include "chrome/browser/profile.h" #include "chrome/common/notification_service.h" #include "grit/chromium_strings.h" @@ -353,6 +355,10 @@ const ListValue* PrefService::GetList(const char* path) const { return static_cast<const ListValue*>(value); } +bool PrefService::ReadOnly() const { + return pref_value_store_->ReadOnly(); +} + void PrefService::AddPrefObserver(const char* path, NotificationObserver* obs) { pref_notifier_->AddPrefObserver(path, obs); diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h index f1128a22..632bc84 100644 --- a/chrome/browser/prefs/pref_service.h +++ b/chrome/browser/prefs/pref_service.h @@ -12,15 +12,16 @@ #include <string> #include "base/non_thread_safe.h" +#include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_value_store.h" #include "chrome/common/pref_store.h" class FilePath; class NotificationObserver; class PrefChangeObserver; class PrefNotifier; +class PrefValueStore; class Profile; namespace subtle { @@ -218,7 +219,7 @@ class PrefService : public NonThreadSafe { // preference is not registered. const Preference* FindPreference(const char* pref_name) const; - bool read_only() const { return pref_value_store_->ReadOnly(); } + bool ReadOnly() const; PrefNotifier* pref_notifier() const { return pref_notifier_.get(); } diff --git a/chrome/browser/prefs/pref_value_store_unittest.cc b/chrome/browser/prefs/pref_value_store_unittest.cc index cbf7ccc..b67fc05 100644 --- a/chrome/browser/prefs/pref_value_store_unittest.cc +++ b/chrome/browser/prefs/pref_value_store_unittest.cc @@ -9,7 +9,7 @@ #include "chrome/browser/prefs/dummy_pref_store.h" #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/common/pref_names.h" -#include "chrome/test/testing_pref_service.h" +#include "chrome/test/testing_pref_value_store.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -113,7 +113,7 @@ class PrefValueStoreTest : public testing::Test { default_pref_store_->set_prefs(default_prefs_); // Create a new pref-value-store. - pref_value_store_ = new TestingPrefService::TestingPrefValueStore( + pref_value_store_ = new TestingPrefValueStore( managed_platform_pref_store_, device_management_pref_store_, extension_pref_store_, @@ -262,7 +262,7 @@ class PrefValueStoreTest : public testing::Test { MessageLoop loop_; - scoped_refptr<TestingPrefService::TestingPrefValueStore> pref_value_store_; + scoped_refptr<TestingPrefValueStore> pref_value_store_; // |PrefStore|s are owned by the |PrefValueStore|. DummyPrefStore* managed_platform_pref_store_; diff --git a/chrome/browser/prefs/scoped_pref_update.cc b/chrome/browser/prefs/scoped_pref_update.cc index bc77b28..05a607c 100644 --- a/chrome/browser/prefs/scoped_pref_update.cc +++ b/chrome/browser/prefs/scoped_pref_update.cc @@ -4,6 +4,7 @@ #include "chrome/browser/prefs/scoped_pref_update.h" +#include "chrome/browser/prefs/pref_notifier.h" #include "chrome/browser/prefs/pref_service.h" ScopedPrefUpdate::ScopedPrefUpdate(PrefService* service, const char* path) diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc index c27b1a3..9fe9fb4 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc @@ -11,6 +11,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/notifications/desktop_notification_service.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_ui_manager.h" diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc index 79e32f4..7a4f676 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc @@ -11,6 +11,7 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_list.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/browser/dom_ui/dom_ui_util.h" #if defined(TOOLKIT_GTK) diff --git a/chrome/browser/remoting/remoting_setup_flow.cc b/chrome/browser/remoting/remoting_setup_flow.cc index a7975bc..fbdcbdc 100644 --- a/chrome/browser/remoting/remoting_setup_flow.cc +++ b/chrome/browser/remoting/remoting_setup_flow.cc @@ -10,6 +10,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/browser/dom_ui/dom_ui_util.h" #include "chrome/browser/platform_util.h" diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 2904701..84c04e1 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -126,6 +126,7 @@ 'test/testing_device_token_fetcher.h', 'test/testing_pref_service.cc', 'test/testing_pref_service.h', + 'test/testing_pref_value_store.h', 'test/testing_profile.cc', 'test/testing_profile.h', 'test/thread_observer_helper.h', diff --git a/chrome/test/testing_pref_service.cc b/chrome/test/testing_pref_service.cc index f6ca03a..d8d08e5 100644 --- a/chrome/test/testing_pref_service.cc +++ b/chrome/test/testing_pref_service.cc @@ -8,19 +8,7 @@ #include "chrome/browser/prefs/dummy_pref_store.h" #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/browser/policy/configuration_policy_pref_store.h" - -TestingPrefService::TestingPrefValueStore::TestingPrefValueStore( - PrefStore* managed_platform_prefs, - PrefStore* device_management_prefs, - PrefStore* extension_prefs, - PrefStore* command_line_prefs, - PrefStore* user_prefs, - PrefStore* recommended_prefs, - PrefStore* default_prefs) - : PrefValueStore(managed_platform_prefs, device_management_prefs, - extension_prefs, command_line_prefs, - user_prefs, recommended_prefs, default_prefs, NULL) { -} +#include "chrome/test/testing_pref_value_store.h" // TODO(pamg): Instantiate no PrefStores by default. Allow callers to specify // which they want, and expand usage of this class to more unit tests. diff --git a/chrome/test/testing_pref_service.h b/chrome/test/testing_pref_service.h index 069ff32..6c60fcf 100644 --- a/chrome/test/testing_pref_service.h +++ b/chrome/test/testing_pref_service.h @@ -19,18 +19,6 @@ class PrefStore; // (managed, extension, user) conveniently. class TestingPrefService : public PrefService { public: - // Subclass to allow directly setting PrefStores. - class TestingPrefValueStore : public PrefValueStore { - public: - TestingPrefValueStore(PrefStore* managed_prefs, - PrefStore* device_management_prefs, - PrefStore* extension_prefs, - PrefStore* command_line_prefs, - PrefStore* user_prefs, - PrefStore* recommended_prefs, - PrefStore* default_prefs); - }; - // Create an empty instance. TestingPrefService(); diff --git a/chrome/test/testing_pref_value_store.h b/chrome/test/testing_pref_value_store.h new file mode 100644 index 0000000..01ae898 --- /dev/null +++ b/chrome/test/testing_pref_value_store.h @@ -0,0 +1,26 @@ +// Copyright (c) 2010 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_TEST_TESTING_PREF_VALUE_STORE_H_ +#define CHROME_TEST_TESTING_PREF_VALUE_STORE_H_ +#pragma once + +#include "chrome/browser/prefs/pref_value_store.h" + +// PrefValueStore subclass that allows directly setting PrefStores. +class TestingPrefValueStore : public PrefValueStore { + public: + TestingPrefValueStore(PrefStore* managed_platform_prefs, + PrefStore* device_management_prefs, + PrefStore* extension_prefs, + PrefStore* command_line_prefs, + PrefStore* user_prefs, + PrefStore* recommended_prefs, + PrefStore* default_prefs) + : PrefValueStore(managed_platform_prefs, device_management_prefs, + extension_prefs, command_line_prefs, + user_prefs, recommended_prefs, default_prefs, NULL) {} +}; + +#endif // CHROME_TEST_TESTING_PREF_VALUE_STORE_H_ |