Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / api / content_settings / content_settings_custom_extension_provider.cc
blob172ff8e06e9268d5d0fbdc02a4f4d476495b286b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
9 #include "components/content_settings/core/browser/content_settings_utils.h"
10 #include "components/content_settings/core/common/content_settings_pattern.h"
12 namespace content_settings {
14 CustomExtensionProvider::CustomExtensionProvider(
15 const scoped_refptr<extensions::ContentSettingsStore>& extensions_settings,
16 bool incognito)
17 : incognito_(incognito), extensions_settings_(extensions_settings) {
18 extensions_settings_->AddObserver(this);
21 CustomExtensionProvider::~CustomExtensionProvider() {
24 RuleIterator* CustomExtensionProvider::GetRuleIterator(
25 ContentSettingsType content_type,
26 const ResourceIdentifier& resource_identifier,
27 bool incognito) const {
28 return extensions_settings_->GetRuleIterator(content_type,
29 resource_identifier,
30 incognito);
33 bool CustomExtensionProvider::SetWebsiteSetting(
34 const ContentSettingsPattern& primary_pattern,
35 const ContentSettingsPattern& secondary_pattern,
36 ContentSettingsType content_type,
37 const ResourceIdentifier& resource_identifier,
38 base::Value* value) {
39 return false;
42 void CustomExtensionProvider::ShutdownOnUIThread() {
43 RemoveAllObservers();
44 extensions_settings_->RemoveObserver(this);
47 void CustomExtensionProvider::OnContentSettingChanged(
48 const std::string& extension_id,
49 bool incognito) {
50 if (incognito_ != incognito)
51 return;
52 // TODO(markusheintz): Be more concise.
53 NotifyObservers(ContentSettingsPattern(),
54 ContentSettingsPattern(),
55 CONTENT_SETTINGS_TYPE_DEFAULT,
56 std::string());
59 } // namespace content_settings