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
// found in the LICENSE file.
......@@ -10,9 +10,9 @@
#include "chrome/common/content_settings.h"
class ContentSettingsProviderInterface {
class DefaultContentSettingsProvider {
public:
virtual ~ContentSettingsProviderInterface() {}
virtual ~DefaultContentSettingsProvider() {}
// True if this provider can provide a default setting for the |content_type|.
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
// found in the LICENSE file.
......@@ -9,6 +9,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.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/pref_content_settings_provider.h"
#include "chrome/browser/metrics/user_metrics.h"
......@@ -87,11 +88,12 @@ ContentSetting ClickToPlayFixup(ContentSettingsType content_type,
return setting;
}
typedef std::vector<linked_ptr<ContentSettingsProviderInterface> >::iterator
typedef linked_ptr<DefaultContentSettingsProvider>
DefaultContentSettingsProviderPtr;
typedef std::vector<DefaultContentSettingsProviderPtr>::iterator
provider_iterator;
typedef
std::vector<linked_ptr<ContentSettingsProviderInterface> >::const_iterator
const_provider_iterator;
typedef std::vector<DefaultContentSettingsProviderPtr>::const_iterator
const_provider_iterator;
} // namespace
......@@ -110,11 +112,11 @@ HostContentSettingsMap::HostContentSettingsMap(Profile* profile)
// 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
// providers further up.
content_settings_providers_.push_back(
linked_ptr<ContentSettingsProviderInterface>(
default_content_settings_providers_.push_back(
DefaultContentSettingsProviderPtr(
new PrefContentSettingsProvider(profile)));
content_settings_providers_.push_back(
linked_ptr<ContentSettingsProviderInterface>(
default_content_settings_providers_.push_back(
DefaultContentSettingsProviderPtr(
new PolicyContentSettingsProvider(profile)));
PrefService* prefs = profile_->GetPrefs();
......@@ -174,8 +176,9 @@ void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) {
ContentSetting HostContentSettingsMap::GetDefaultContentSetting(
ContentSettingsType content_type) const {
ContentSetting setting = CONTENT_SETTING_DEFAULT;
for (const_provider_iterator provider = content_settings_providers_.begin();
provider != content_settings_providers_.end(); ++provider) {
for (const_provider_iterator provider =
default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
if (!(*provider)->CanProvideDefaultSetting(content_type))
continue;
ContentSetting provided_setting =
......@@ -411,8 +414,9 @@ void HostContentSettingsMap::SetDefaultContentSetting(
return;
}
for (provider_iterator provider = content_settings_providers_.begin();
provider != content_settings_providers_.end(); ++provider) {
for (provider_iterator provider =
default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
(*provider)->UpdateDefaultSetting(content_type, setting);
}
}
......@@ -669,8 +673,9 @@ void HostContentSettingsMap::ResetToDefaults() {
{
base::AutoLock auto_lock(lock_);
for (provider_iterator provider = content_settings_providers_.begin();
provider != content_settings_providers_.end(); ++provider) {
for (provider_iterator provider =
default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
(*provider)->ResetToDefaults();
}
host_content_settings_.clear();
......@@ -813,8 +818,9 @@ bool HostContentSettingsMap::AllDefault(
bool HostContentSettingsMap::IsDefaultContentSettingManaged(
ContentSettingsType content_type) const {
for (const_provider_iterator provider = content_settings_providers_.begin();
provider != content_settings_providers_.end(); ++provider) {
for (const_provider_iterator provider =
default_content_settings_providers_.begin();
provider != default_content_settings_providers_.end(); ++provider) {
if ((*provider)->DefaultSettingIsManaged(content_type))
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
// found in the LICENSE file.
......@@ -26,7 +26,7 @@
#include "chrome/common/notification_registrar.h"
class ContentSettingsDetails;
class ContentSettingsProviderInterface;
class DefaultContentSettingsProvider;
class DictionaryValue;
class GURL;
class PrefService;
......@@ -229,8 +229,8 @@ class HostContentSettingsMap
bool updating_preferences_;
// Content setting providers.
std::vector<linked_ptr<ContentSettingsProviderInterface> >
content_settings_providers_;
std::vector<linked_ptr<DefaultContentSettingsProvider> >
default_content_settings_providers_;
// Used around accesses to the following objects to guarantee thread safety.
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
// 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
// found in the LICENSE file.
......@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "chrome/browser/content_settings/content_settings_provider.h"
class MockContentSettingsProvider : public ContentSettingsProviderInterface {
class MockContentSettingsProvider : public DefaultContentSettingsProvider {
public:
// Create a content settings provider that provides a given setting for a
// 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
// found in the LICENSE file.
......@@ -20,13 +20,13 @@ class DictionaryValue;
class PrefService;
class Profile;
class PolicyContentSettingsProvider : public ContentSettingsProviderInterface,
class PolicyContentSettingsProvider : public DefaultContentSettingsProvider,
public NotificationObserver {
public:
explicit PolicyContentSettingsProvider(Profile* profile);
virtual ~PolicyContentSettingsProvider();
// ContentSettingsProviderInterface implementation.
// DefaultContentSettingsProvider implementation.
virtual bool CanProvideDefaultSetting(ContentSettingsType content_type) const;
virtual ContentSetting ProvideDefaultSetting(
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
// found in the LICENSE file.
......@@ -20,13 +20,13 @@ class DictionaryValue;
class PrefService;
class Profile;
class PrefContentSettingsProvider : public ContentSettingsProviderInterface,
class PrefContentSettingsProvider : public DefaultContentSettingsProvider,
public NotificationObserver {
public:
explicit PrefContentSettingsProvider(Profile* profile);
virtual ~PrefContentSettingsProvider();
// ContentSettingsProviderInterface implementation.
// DefaultContentSettingsProvider implementation.
virtual bool CanProvideDefaultSetting(ContentSettingsType content_type) const;
virtual ContentSetting ProvideDefaultSetting(
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