OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "chrome/browser/content_settings/content_settings_custom_extension_prov
ider.h" | |
6 | |
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" | |
11 | |
12 namespace content_settings { | |
13 | |
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); | |
19 } | |
20 | |
21 CustomExtensionProvider::~CustomExtensionProvider() { | |
22 } | |
23 | |
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); | |
31 } | |
32 | |
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; | |
40 } | |
41 | |
42 void CustomExtensionProvider::ShutdownOnUIThread() { | |
43 RemoveAllObservers(); | |
44 extensions_settings_->RemoveObserver(this); | |
45 } | |
46 | |
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()); | |
57 } | |
58 | |
59 } // namespace content_settings | |
OLD | NEW |