Rename ContentSettingsProviderInterface to DefaultContentSettingsProviderInterface.

BUG=70750
TEST=content_settings_provider_unittest.cc

Review URL: http://codereview.chromium.org/6300015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72503 0039d316-1c4b-4281-b951-d872f2087c98
parent 61ce18f3
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include "chrome/common/content_settings.h" #include "chrome/common/content_settings.h"
class ContentSettingsProviderInterface { class DefaultContentSettingsProvider {
public: public:
virtual ~ContentSettingsProviderInterface() {} virtual ~DefaultContentSettingsProvider() {}
// True if this provider can provide a default setting for the |content_type|. // True if this provider can provide a default setting for the |content_type|.
virtual bool CanProvideDefaultSetting( virtual bool CanProvideDefaultSetting(
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h" #include "chrome/browser/browser_thread.h"
#include "chrome/browser/content_settings/content_settings_details.h" #include "chrome/browser/content_settings/content_settings_details.h"
#include "chrome/browser/content_settings/content_settings_provider.h"
#include "chrome/browser/content_settings/policy_content_settings_provider.h" #include "chrome/browser/content_settings/policy_content_settings_provider.h"
#include "chrome/browser/content_settings/pref_content_settings_provider.h" #include "chrome/browser/content_settings/pref_content_settings_provider.h"
#include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/metrics/user_metrics.h"
...@@ -87,11 +88,12 @@ ContentSetting ClickToPlayFixup(ContentSettingsType content_type, ...@@ -87,11 +88,12 @@ ContentSetting ClickToPlayFixup(ContentSettingsType content_type,
return setting; return setting;
} }
typedef std::vector<linked_ptr<ContentSettingsProviderInterface> >::iterator typedef linked_ptr<DefaultContentSettingsProvider>
DefaultContentSettingsProviderPtr;
typedef std::vector<DefaultContentSettingsProviderPtr>::iterator
provider_iterator; provider_iterator;
typedef typedef std::vector<DefaultContentSettingsProviderPtr>::const_iterator
std::vector<linked_ptr<ContentSettingsProviderInterface> >::const_iterator const_provider_iterator;
const_provider_iterator;
} // namespace } // namespace
...@@ -110,11 +112,11 @@ HostContentSettingsMap::HostContentSettingsMap(Profile* profile) ...@@ -110,11 +112,11 @@ HostContentSettingsMap::HostContentSettingsMap(Profile* profile)
// The order in which the content settings providers are created is critical, // The order in which the content settings providers are created is critical,
// as providers that are further down in the list (i.e. added later) override // as providers that are further down in the list (i.e. added later) override
// providers further up. // providers further up.
content_settings_providers_.push_back( default_content_settings_providers_.push_back(
linked_ptr<ContentSettingsProviderInterface>( DefaultContentSettingsProviderPtr(
new PrefContentSettingsProvider(profile))); new PrefContentSettingsProvider(profile)));
content_settings_providers_.push_back( default_content_settings_providers_.push_back(
linked_ptr<ContentSettingsProviderInterface>( DefaultContentSettingsProviderPtr(
new PolicyContentSettingsProvider(profile))); new PolicyContentSettingsProvider(profile)));
PrefService* prefs = profile_->GetPrefs(); PrefService* prefs = profile_->GetPrefs();
...@@ -174,8 +176,9 @@ void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { ...@@ -174,8 +176,9 @@ void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) {
ContentSetting HostContentSettingsMap::GetDefaultContentSetting( ContentSetting HostContentSettingsMap::GetDefaultContentSetting(
ContentSettingsType content_type) const { ContentSettingsType content_type) const {
ContentSetting setting = CONTENT_SETTING_DEFAULT; ContentSetting setting = CONTENT_SETTING_DEFAULT;
for (const_provider_iterator provider = content_settings_providers_.begin(); for (const_provider_iterator provider =
provider != content_settings_providers_.end(); ++provider) { default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
if (!(*provider)->CanProvideDefaultSetting(content_type)) if (!(*provider)->CanProvideDefaultSetting(content_type))
continue; continue;
ContentSetting provided_setting = ContentSetting provided_setting =
...@@ -411,8 +414,9 @@ void HostContentSettingsMap::SetDefaultContentSetting( ...@@ -411,8 +414,9 @@ void HostContentSettingsMap::SetDefaultContentSetting(
return; return;
} }
for (provider_iterator provider = content_settings_providers_.begin(); for (provider_iterator provider =
provider != content_settings_providers_.end(); ++provider) { default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
(*provider)->UpdateDefaultSetting(content_type, setting); (*provider)->UpdateDefaultSetting(content_type, setting);
} }
} }
...@@ -669,8 +673,9 @@ void HostContentSettingsMap::ResetToDefaults() { ...@@ -669,8 +673,9 @@ void HostContentSettingsMap::ResetToDefaults() {
{ {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
for (provider_iterator provider = content_settings_providers_.begin(); for (provider_iterator provider =
provider != content_settings_providers_.end(); ++provider) { default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
(*provider)->ResetToDefaults(); (*provider)->ResetToDefaults();
} }
host_content_settings_.clear(); host_content_settings_.clear();
...@@ -813,8 +818,9 @@ bool HostContentSettingsMap::AllDefault( ...@@ -813,8 +818,9 @@ bool HostContentSettingsMap::AllDefault(
bool HostContentSettingsMap::IsDefaultContentSettingManaged( bool HostContentSettingsMap::IsDefaultContentSettingManaged(
ContentSettingsType content_type) const { ContentSettingsType content_type) const {
for (const_provider_iterator provider = content_settings_providers_.begin(); for (const_provider_iterator provider =
provider != content_settings_providers_.end(); ++provider) { default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
if ((*provider)->DefaultSettingIsManaged(content_type)) if ((*provider)->DefaultSettingIsManaged(content_type))
return true; return true;
} }
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "chrome/common/notification_registrar.h" #include "chrome/common/notification_registrar.h"
class ContentSettingsDetails; class ContentSettingsDetails;
class ContentSettingsProviderInterface; class DefaultContentSettingsProvider;
class DictionaryValue; class DictionaryValue;
class GURL; class GURL;
class PrefService; class PrefService;
...@@ -229,8 +229,8 @@ class HostContentSettingsMap ...@@ -229,8 +229,8 @@ class HostContentSettingsMap
bool updating_preferences_; bool updating_preferences_;
// Content setting providers. // Content setting providers.
std::vector<linked_ptr<ContentSettingsProviderInterface> > std::vector<linked_ptr<DefaultContentSettingsProvider> >
content_settings_providers_; default_content_settings_providers_;
// Used around accesses to the following objects to guarantee thread safety. // Used around accesses to the following objects to guarantee thread safety.
mutable base::Lock lock_; mutable base::Lock lock_;
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "chrome/browser/content_settings/content_settings_provider.h" #include "chrome/browser/content_settings/content_settings_provider.h"
class MockContentSettingsProvider : public ContentSettingsProviderInterface { class MockContentSettingsProvider : public DefaultContentSettingsProvider {
public: public:
// Create a content settings provider that provides a given setting for a // Create a content settings provider that provides a given setting for a
// given type. // given type.
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -20,13 +20,13 @@ class DictionaryValue; ...@@ -20,13 +20,13 @@ class DictionaryValue;
class PrefService; class PrefService;
class Profile; class Profile;
class PolicyContentSettingsProvider : public ContentSettingsProviderInterface, class PolicyContentSettingsProvider : public DefaultContentSettingsProvider,
public NotificationObserver { public NotificationObserver {
public: public:
explicit PolicyContentSettingsProvider(Profile* profile); explicit PolicyContentSettingsProvider(Profile* profile);
virtual ~PolicyContentSettingsProvider(); virtual ~PolicyContentSettingsProvider();
// ContentSettingsProviderInterface implementation. // DefaultContentSettingsProvider implementation.
virtual bool CanProvideDefaultSetting(ContentSettingsType content_type) const; virtual bool CanProvideDefaultSetting(ContentSettingsType content_type) const;
virtual ContentSetting ProvideDefaultSetting( virtual ContentSetting ProvideDefaultSetting(
ContentSettingsType content_type) const; ContentSettingsType content_type) const;
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -20,13 +20,13 @@ class DictionaryValue; ...@@ -20,13 +20,13 @@ class DictionaryValue;
class PrefService; class PrefService;
class Profile; class Profile;
class PrefContentSettingsProvider : public ContentSettingsProviderInterface, class PrefContentSettingsProvider : public DefaultContentSettingsProvider,
public NotificationObserver { public NotificationObserver {
public: public:
explicit PrefContentSettingsProvider(Profile* profile); explicit PrefContentSettingsProvider(Profile* profile);
virtual ~PrefContentSettingsProvider(); virtual ~PrefContentSettingsProvider();
// ContentSettingsProviderInterface implementation. // DefaultContentSettingsProvider implementation.
virtual bool CanProvideDefaultSetting(ContentSettingsType content_type) const; virtual bool CanProvideDefaultSetting(ContentSettingsType content_type) const;
virtual ContentSetting ProvideDefaultSetting( virtual ContentSetting ProvideDefaultSetting(
ContentSettingsType content_type) const; ContentSettingsType content_type) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment