| 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/content_settings/content_settings_details.h" | 7 #include "chrome/browser/content_settings/content_settings_details.h" |
| 8 #include "chrome/browser/extensions/extension_content_settings_store.h" | 8 #include "chrome/browser/extensions/extension_content_settings_store.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/chrome_notification_types.h" |
| 10 #include "content/common/notification_details.h" | 11 #include "content/common/notification_details.h" |
| 11 #include "content/common/notification_service.h" | 12 #include "content/common/notification_service.h" |
| 12 #include "content/common/notification_source.h" | 13 #include "content/common/notification_source.h" |
| 13 | 14 |
| 14 namespace content_settings { | 15 namespace content_settings { |
| 15 | 16 |
| 16 ExtensionProvider::ExtensionProvider( | 17 ExtensionProvider::ExtensionProvider( |
| 17 HostContentSettingsMap* map, | 18 HostContentSettingsMap* map, |
| 18 ExtensionContentSettingsStore* extensions_settings, | 19 ExtensionContentSettingsStore* extensions_settings, |
| 19 bool incognito) | 20 bool incognito) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 54 |
| 54 void ExtensionProvider::ShutdownOnUIThread() { | 55 void ExtensionProvider::ShutdownOnUIThread() { |
| 55 extensions_settings_->RemoveObserver(this); | 56 extensions_settings_->RemoveObserver(this); |
| 56 map_ = NULL; | 57 map_ = NULL; |
| 57 } | 58 } |
| 58 | 59 |
| 59 void ExtensionProvider::NotifyObservers( | 60 void ExtensionProvider::NotifyObservers( |
| 60 const ContentSettingsDetails& details) { | 61 const ContentSettingsDetails& details) { |
| 61 DCHECK(map_); | 62 DCHECK(map_); |
| 62 NotificationService::current()->Notify( | 63 NotificationService::current()->Notify( |
| 63 NotificationType::CONTENT_SETTINGS_CHANGED, | 64 chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, |
| 64 Source<HostContentSettingsMap>(map_), | 65 Source<HostContentSettingsMap>(map_), |
| 65 Details<const ContentSettingsDetails>(&details)); | 66 Details<const ContentSettingsDetails>(&details)); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void ExtensionProvider::OnContentSettingChanged( | 69 void ExtensionProvider::OnContentSettingChanged( |
| 69 const std::string& extension_id, | 70 const std::string& extension_id, |
| 70 bool incognito) { | 71 bool incognito) { |
| 71 if (incognito_ != incognito) | 72 if (incognito_ != incognito) |
| 72 return; | 73 return; |
| 73 // TODO(markusheintz): Be more concise. | 74 // TODO(markusheintz): Be more concise. |
| 74 ContentSettingsDetails details(ContentSettingsPattern(), | 75 ContentSettingsDetails details(ContentSettingsPattern(), |
| 75 ContentSettingsPattern(), | 76 ContentSettingsPattern(), |
| 76 CONTENT_SETTINGS_TYPE_DEFAULT, | 77 CONTENT_SETTINGS_TYPE_DEFAULT, |
| 77 std::string()); | 78 std::string()); |
| 78 NotifyObservers(details); | 79 NotifyObservers(details); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace content_settings | 82 } // namespace content_settings |
| OLD | NEW |