Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/content_settings/content_settings_extension_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_extension_provider.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_content_settings_store.h" | 7 #include "chrome/browser/extensions/extension_content_settings_store.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 } | 22 } |
| 23 | 23 |
| 24 ContentSetting ExtensionProvider::GetContentSetting( | 24 ContentSetting ExtensionProvider::GetContentSetting( |
| 25 const GURL& embedded_url, | 25 const GURL& embedded_url, |
| 26 const GURL& top_level_url, | 26 const GURL& top_level_url, |
| 27 ContentSettingsType content_type, | 27 ContentSettingsType content_type, |
| 28 const ResourceIdentifier& resource_identifier) const { | 28 const ResourceIdentifier& resource_identifier) const { |
| 29 // TODO(markusheintz): Instead of getting the effective setting every time | 29 // TODO(markusheintz): Instead of getting the effective setting every time |
| 30 // effective patterns could be cached in here. | 30 // effective patterns could be cached in here. |
| 31 DCHECK(extensions_settings_); | 31 DCHECK(extensions_settings_); |
| 32 return extensions_settings_->GetEffectiveContentSetting( | 32 ContentSetting setting = extensions_settings_->GetEffectiveContentSetting( |
| 33 embedded_url, | 33 embedded_url, |
| 34 top_level_url, | 34 top_level_url, |
| 35 content_type, | 35 content_type, |
| 36 resource_identifier, | 36 resource_identifier, |
| 37 incognito_); | 37 incognito_); |
| 38 | |
|
battre
2011/08/29 17:44:04
nit: is this really better?
markusheintz_
2011/08/30 15:14:02
Ahhhh no not at all. I just did this to LOG the se
| |
| 39 return setting; | |
| 38 } | 40 } |
| 39 | 41 |
| 40 void ExtensionProvider::GetAllContentSettingsRules( | 42 void ExtensionProvider::GetAllContentSettingsRules( |
| 41 ContentSettingsType content_type, | 43 ContentSettingsType content_type, |
| 42 const ResourceIdentifier& resource_identifier, | 44 const ResourceIdentifier& resource_identifier, |
| 43 Rules* content_setting_rules) const { | 45 Rules* content_setting_rules) const { |
| 44 return extensions_settings_->GetContentSettingsForContentType( | 46 return extensions_settings_->GetContentSettingsForContentType( |
| 45 content_type, resource_identifier, incognito_, content_setting_rules); | 47 content_type, resource_identifier, incognito_, content_setting_rules); |
| 46 } | 48 } |
| 47 | 49 |
| 48 void ExtensionProvider::ShutdownOnUIThread() { | 50 void ExtensionProvider::ShutdownOnUIThread() { |
| 49 RemoveAllObservers(); | 51 RemoveAllObservers(); |
| 50 extensions_settings_->RemoveObserver(this); | 52 extensions_settings_->RemoveObserver(this); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void ExtensionProvider::OnContentSettingChanged( | 55 void ExtensionProvider::OnContentSettingChanged( |
| 54 const std::string& extension_id, | 56 const std::string& extension_id, |
| 55 bool incognito) { | 57 bool incognito) { |
| 56 if (incognito_ != incognito) | 58 if (incognito_ != incognito) |
| 57 return; | 59 return; |
| 58 // TODO(markusheintz): Be more concise. | 60 // TODO(markusheintz): Be more concise. |
| 59 NotifyObservers(ContentSettingsPattern(), | 61 NotifyObservers(ContentSettingsPattern(), |
| 60 ContentSettingsPattern(), | 62 ContentSettingsPattern(), |
| 61 CONTENT_SETTINGS_TYPE_DEFAULT, | 63 CONTENT_SETTINGS_TYPE_DEFAULT, |
| 62 std::string()); | 64 std::string()); |
| 63 } | 65 } |
| 64 | 66 |
| 65 } // namespace content_settings | 67 } // namespace content_settings |
| OLD | NEW |