diff options
author | Kristian Monsen <kristianm@google.com> | 2011-05-13 16:44:31 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-05-20 15:06:03 +0100 |
commit | 5af4e3efaa07e1369024c188538dcf582ed5a21e (patch) | |
tree | e20235fbb026f562f9be89e579c3c0b570e1d290 /chrome | |
parent | 944a57ef65ab1c9e826dddae33fb347063d87fbc (diff) | |
download | external_chromium-5af4e3efaa07e1369024c188538dcf582ed5a21e.zip external_chromium-5af4e3efaa07e1369024c188538dcf582ed5a21e.tar.gz external_chromium-5af4e3efaa07e1369024c188538dcf582ed5a21e.tar.bz2 |
Merge Chromium at 10.0.621.0: Fix conflicts in pref_value_store.*
Large upstream changes. Matching upstream now, with a local change
that will be upstreamed.
Mostly due to these CL's
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/prefs/pref_value_store.h?r1=68355&r2=68574
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/prefs/pref_value_store.h?r1=68736&r2=70050
Change-Id: I62bea1d4e4314b379ee823bb505412b049c8c17b
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/prefs/pref_value_store.cc | 109 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_value_store.h | 114 |
2 files changed, 3 insertions, 220 deletions
diff --git a/chrome/browser/prefs/pref_value_store.cc b/chrome/browser/prefs/pref_value_store.cc index 431e55f..e66f2d0 100644 --- a/chrome/browser/prefs/pref_value_store.cc +++ b/chrome/browser/prefs/pref_value_store.cc @@ -4,21 +4,10 @@ #include "chrome/browser/prefs/pref_value_store.h" -<<<<<<< HEAD -#ifndef ANDROID -#include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_pref_store.h" -#include "chrome/browser/policy/configuration_policy_pref_store.h" -#include "chrome/browser/prefs/command_line_pref_store.h" -#endif -#include "chrome/browser/prefs/default_pref_store.h" -#ifndef ANDROID -#include "chrome/common/json_pref_store.h" -#include "chrome/common/notification_service.h" +#ifdef ANDROID +#include "base/logging.h" #endif -======= #include "chrome/browser/prefs/pref_notifier.h" ->>>>>>> chromium.org at r10.0.621.0 PrefValueStore::PrefStoreKeeper::PrefStoreKeeper() : pref_value_store_(NULL), @@ -43,46 +32,6 @@ void PrefValueStore::PrefStoreKeeper::Initialize( pref_store_->AddObserver(this); } -<<<<<<< HEAD -} // namespace - -// static -PrefValueStore* PrefValueStore::CreatePrefValueStore( - const FilePath& pref_filename, - Profile* profile, - bool user_only) { -#ifdef ANDROID - return new PrefValueStore(NULL, NULL, NULL, NULL, NULL, NULL, new DefaultPrefStore(), profile); -#else - using policy::ConfigurationPolicyPrefStore; - ConfigurationPolicyPrefStore* managed = NULL; - ConfigurationPolicyPrefStore* device_management = NULL; - ExtensionPrefStore* extension = NULL; - CommandLinePrefStore* command_line = NULL; - ConfigurationPolicyPrefStore* recommended = NULL; - - JsonPrefStore* user = new JsonPrefStore( - pref_filename, - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); - DefaultPrefStore* default_store = new DefaultPrefStore(); - - if (!user_only) { - managed = - ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore(); - device_management = - ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( - profile); - extension = new ExtensionPrefStore(profile, PrefNotifier::EXTENSION_STORE); - command_line = new CommandLinePrefStore(CommandLine::ForCurrentProcess()); - recommended = - ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(); - } - - return new PrefValueStore(managed, device_management, extension, - command_line, user, recommended, default_store, - profile); -#endif -======= void PrefValueStore::PrefStoreKeeper::OnPrefValueChanged( const std::string& key) { pref_value_store_->OnPrefValueChanged(type_, key); @@ -110,7 +59,6 @@ PrefValueStore::PrefValueStore(PrefStore* managed_platform_prefs, InitPrefStore(DEFAULT_STORE, default_prefs); CheckInitializationCompleted(); ->>>>>>> chromium.org at r10.0.621.0 } PrefValueStore::~PrefValueStore() {} @@ -254,42 +202,11 @@ bool PrefValueStore::PrefValueInStoreRange( return false; } -<<<<<<< HEAD -#ifndef ANDROID -void PrefValueStore::RefreshPolicyPrefsOnFileThread( - BrowserThread::ID calling_thread_id, - PrefStore* new_managed_platform_pref_store, - PrefStore* new_device_management_pref_store, - PrefStore* new_recommended_pref_store, - AfterRefreshCallback* callback_pointer) { - scoped_ptr<AfterRefreshCallback> callback(callback_pointer); - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - scoped_ptr<PrefStore> managed_platform_pref_store( - new_managed_platform_pref_store); - scoped_ptr<PrefStore> device_management_pref_store( - new_device_management_pref_store); - scoped_ptr<PrefStore> recommended_pref_store(new_recommended_pref_store); - - PrefStore::PrefReadError read_error = - new_managed_platform_pref_store->ReadPrefs(); - if (read_error != PrefStore::PREF_READ_ERROR_NONE) { - LOG(ERROR) << "refresh of managed policy failed: PrefReadError = " - << read_error; - return; - } - - read_error = new_device_management_pref_store->ReadPrefs(); - if (read_error != PrefStore::PREF_READ_ERROR_NONE) { - LOG(ERROR) << "refresh of device management policy failed: " - << "PrefReadError = " << read_error; - return; -======= PrefValueStore::PrefStoreType PrefValueStore::ControllingPrefStoreForPref( const char* name) const { for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { if (PrefValueInStore(name, static_cast<PrefStoreType>(i))) return static_cast<PrefStoreType>(i); ->>>>>>> chromium.org at r10.0.621.0 } return INVALID_STORE; } @@ -335,30 +252,10 @@ void PrefValueStore::OnInitializationCompleted( PrefValueStore::PrefStoreType type) { CheckInitializationCompleted(); } -#endif // ANDROID - -<<<<<<< HEAD -bool PrefValueStore::HasPolicyConflictingUserProxySettings() { -#if !defined(ANDROID) - using policy::ConfigurationPolicyPrefStore; - ConfigurationPolicyPrefStore::ProxyPreferenceSet proxy_prefs; - ConfigurationPolicyPrefStore::GetProxyPreferenceSet(&proxy_prefs); - ConfigurationPolicyPrefStore::ProxyPreferenceSet::const_iterator i; - for (i = proxy_prefs.begin(); i != proxy_prefs.end(); ++i) { - if ((PrefValueInManagedPlatformStore(*i) || - PrefValueInDeviceManagementStore(*i)) && - PrefValueInStoreRange(*i, - PrefNotifier::COMMAND_LINE_STORE, - PrefNotifier::USER_STORE)) - return true; - } -#endif - return false; -======= + void PrefValueStore::InitPrefStore(PrefValueStore::PrefStoreType type, PrefStore* pref_store) { pref_stores_[type].Initialize(this, pref_store, type); ->>>>>>> chromium.org at r10.0.621.0 } void PrefValueStore::CheckInitializationCompleted() { diff --git a/chrome/browser/prefs/pref_value_store.h b/chrome/browser/prefs/pref_value_store.h index 2b8c539..8b6ba0c 100644 --- a/chrome/browser/prefs/pref_value_store.h +++ b/chrome/browser/prefs/pref_value_store.h @@ -17,11 +17,7 @@ #include "base/values.h" #ifndef ANDROID #include "chrome/browser/browser_thread.h" -<<<<<<< HEAD #endif -#include "chrome/browser/prefs/pref_notifier.h" -======= ->>>>>>> chromium.org at r10.0.621.0 #include "chrome/common/pref_store.h" class FilePath; @@ -38,24 +34,6 @@ class Profile; // be called on the UI thread. class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { public: -<<<<<<< HEAD - // Returns a new PrefValueStore with all applicable PrefStores. The - // |pref_filename| points to the user preference file. The |profile| is the - // one to which these preferences apply; it may be NULL if we're dealing - // with the local state. If |pref_filename| is empty, the user PrefStore will - // not be created. If |user_only| is true, no PrefStores will be created - // other than the user and default PrefStores. This should not normally be - // called directly: the usual way to create a PrefValueStore is by creating a - // PrefService. - static PrefValueStore* CreatePrefValueStore(const FilePath& pref_filename, - Profile* profile, - bool user_only); - -#ifdef ANDROID - virtual -#endif - ~PrefValueStore(); -======= // In decreasing order of precedence: // |managed_platform_prefs| contains all managed platform (non-cloud policy) // preference values. @@ -86,7 +64,6 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { PrefStore* default_prefs, PrefNotifier* pref_notifier); virtual ~PrefValueStore(); ->>>>>>> chromium.org at r10.0.621.0 // Gets the value for the given preference name that has a valid value type; // that is, the same type the preference was registered with, or NULL for @@ -128,73 +105,6 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // there is no higher-priority source controlling it. bool PrefValueUserModifiable(const char* name) const; -<<<<<<< HEAD - // Returns the pref store type identifying the source that controls the - // Preference identified by |name|. If none of the sources has a value, - // PrefNotifier::INVALID_STORE is returned. In practice, the default PrefStore - // should always have a value for any registered preferencem, so INVALID_STORE - // indicates an error. - PrefNotifier::PrefStoreType ControllingPrefStoreForPref( - const char* name) const; - - // Signature of callback triggered after policy refresh. Parameter is not - // passed as reference to prevent passing along a pointer to a set whose - // lifecycle is managed in another thread. - typedef Callback1<std::vector<std::string> >::Type AfterRefreshCallback; - -#ifndef ANDROID - // Called as a result of a notification of policy change. Triggers a reload of - // managed platform, device management and recommended preferences from policy - // from a Task on the FILE thread. The Task will take ownership of the - // |callback|. |callback| is called with the set of preferences changed by the - // policy refresh. |callback| is called on the caller's thread as a Task - // after RefreshPolicyPrefs has returned. - void RefreshPolicyPrefs(AfterRefreshCallback* callback); -#endif - - // Returns true if there are proxy preferences in user-modifiable - // preference stores (e.g. CommandLinePrefStore, ExtensionPrefStore) - // that conflict with proxy settings specified by proxy policy. - bool HasPolicyConflictingUserProxySettings(); - - protected: - // In decreasing order of precedence: - // |managed_platform_prefs| contains all managed platform (non-cloud policy) - // preference values. - // |device_management_prefs| contains all device management (cloud policy) - // preference values. - // |extension_prefs| contains preference values set by extensions. - // |command_line_prefs| contains preference values set by command-line - // switches. - // |user_prefs| contains all user-set preference values. - // |recommended_prefs| contains all recommended (policy) preference values. - // |default_prefs| contains application-default preference values. It must - // be non-null if any preferences are to be registered. - // - // The |profile| parameter is used to construct a replacement device - // management pref store. This is done after policy refresh when we swap out - // the policy pref stores for new ones, so the |profile| pointer needs to be - // kept around for then. It is safe to pass a NULL pointer for local state - // preferences. - // - // TODO(mnissler, danno): Refactor the pref store interface and refresh logic - // so refreshes can be handled by the pref store itself without swapping - // stores. This way we can get rid of the profile pointer here. - // - // This constructor should only be used internally, or by subclasses in - // testing. The usual way to create a PrefValueStore is by creating a - // PrefService. - PrefValueStore(PrefStore* managed_platform_prefs, - PrefStore* device_management_prefs, - PrefStore* extension_prefs, - PrefStore* command_line_prefs, - PrefStore* user_prefs, - PrefStore* recommended_prefs, - PrefStore* default_prefs, - Profile* profile); - -======= ->>>>>>> chromium.org at r10.0.621.0 private: // PrefStores must be listed here in order from highest to lowest priority. // MANAGED_PLATFORM contains all managed preference values that are @@ -295,29 +205,6 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { PrefStoreType store, Value** out_value) const; -<<<<<<< HEAD -#ifndef ANDROID - // Called during policy refresh after ReadPrefs completes on the thread - // that initiated the policy refresh. RefreshPolicyPrefsCompletion takes - // ownership of the |callback| object. - void RefreshPolicyPrefsCompletion( - PrefStore* new_managed_platform_pref_store, - PrefStore* new_device_management_pref_store, - PrefStore* new_recommended_pref_store, - AfterRefreshCallback* callback); - - // Called during policy refresh to do the ReadPrefs on the FILE thread. - // RefreshPolicyPrefsOnFileThread takes ownership of the |callback| object. - void RefreshPolicyPrefsOnFileThread( - BrowserThread::ID calling_thread_id, - PrefStore* new_managed_platform_pref_store, - PrefStore* new_device_management_pref_store, - PrefStore* new_recommended_pref_store, - AfterRefreshCallback* callback); -#endif - - scoped_ptr<PrefStore> pref_stores_[PrefNotifier::PREF_STORE_TYPE_MAX + 1]; -======= // Called upon changes in individual pref stores in order to determine whether // the user-visible pref value has changed. Triggers the change notification // if the effective value of the preference has changed, or if the store @@ -355,7 +242,6 @@ class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { // notifications. This is a weak reference, since the notifier is owned by the // corresponding PrefService. PrefNotifier* pref_notifier_; ->>>>>>> chromium.org at r10.0.621.0 // A mapping of preference names to their registered types. PrefTypeMap pref_types_; |