| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/prefs/public/pref_change_registrar.h" | 12 #include "base/prefs/public/pref_change_registrar.h" |
| 13 #include "base/prefs/public/pref_observer.h" | |
| 14 #include "chrome/browser/pepper_flash_settings_manager.h" | 13 #include "chrome/browser/pepper_flash_settings_manager.h" |
| 15 #include "chrome/browser/ui/webui/options/options_ui.h" | 14 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 16 #include "chrome/common/content_settings.h" | 15 #include "chrome/common/content_settings.h" |
| 17 #include "chrome/common/content_settings_types.h" | 16 #include "chrome/common/content_settings_types.h" |
| 18 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 20 | 19 |
| 21 class HostContentSettingsMap; | 20 class HostContentSettingsMap; |
| 22 class ProtocolHandlerRegistry; | 21 class ProtocolHandlerRegistry; |
| 23 | 22 |
| 24 namespace options { | 23 namespace options { |
| 25 | 24 |
| 26 class ContentSettingsHandler : public OptionsPageUIHandler, | 25 class ContentSettingsHandler : public OptionsPageUIHandler, |
| 27 public PepperFlashSettingsManager::Client, | 26 public PepperFlashSettingsManager::Client { |
| 28 public PrefObserver { | |
| 29 public: | 27 public: |
| 30 ContentSettingsHandler(); | 28 ContentSettingsHandler(); |
| 31 virtual ~ContentSettingsHandler(); | 29 virtual ~ContentSettingsHandler(); |
| 32 | 30 |
| 33 // OptionsPageUIHandler implementation. | 31 // OptionsPageUIHandler implementation. |
| 34 virtual void GetLocalizedValues( | 32 virtual void GetLocalizedValues( |
| 35 base::DictionaryValue* localized_strings) OVERRIDE; | 33 base::DictionaryValue* localized_strings) OVERRIDE; |
| 36 virtual void InitializeHandler() OVERRIDE; | 34 virtual void InitializeHandler() OVERRIDE; |
| 37 virtual void InitializePage() OVERRIDE; | 35 virtual void InitializePage() OVERRIDE; |
| 38 virtual void RegisterMessages() OVERRIDE; | 36 virtual void RegisterMessages() OVERRIDE; |
| 39 | 37 |
| 40 // content::NotificationObserver implementation. | 38 // content::NotificationObserver implementation. |
| 41 virtual void Observe(int type, | 39 virtual void Observe(int type, |
| 42 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
| 43 const content::NotificationDetails& details) OVERRIDE; | 41 const content::NotificationDetails& details) OVERRIDE; |
| 44 | 42 |
| 45 // PrefObserver implementation. | |
| 46 virtual void OnPreferenceChanged(PrefServiceBase* service, | |
| 47 const std::string& pref_name) OVERRIDE; | |
| 48 | |
| 49 // PepperFlashSettingsManager::Client implementation. | 43 // PepperFlashSettingsManager::Client implementation. |
| 50 virtual void OnGetPermissionSettingsCompleted( | 44 virtual void OnGetPermissionSettingsCompleted( |
| 51 uint32 request_id, | 45 uint32 request_id, |
| 52 bool success, | 46 bool success, |
| 53 PP_Flash_BrowserOperations_Permission default_permission, | 47 PP_Flash_BrowserOperations_Permission default_permission, |
| 54 const ppapi::FlashSiteSettings& sites) OVERRIDE; | 48 const ppapi::FlashSiteSettings& sites) OVERRIDE; |
| 55 | 49 |
| 56 // Gets a string identifier for the group name, for use in HTML. | 50 // Gets a string identifier for the group name, for use in HTML. |
| 57 static std::string ContentSettingsTypeToGroupName(ContentSettingsType type); | 51 static std::string ContentSettingsTypeToGroupName(ContentSettingsType type); |
| 58 | 52 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 78 | 72 |
| 79 // Functions that call into the page ----------------------------------------- | 73 // Functions that call into the page ----------------------------------------- |
| 80 | 74 |
| 81 // Updates the page with the default settings (allow, ask, block, etc.) | 75 // Updates the page with the default settings (allow, ask, block, etc.) |
| 82 void UpdateSettingDefaultFromModel(const ExContentSettingsType& type); | 76 void UpdateSettingDefaultFromModel(const ExContentSettingsType& type); |
| 83 | 77 |
| 84 // Clobbers and rebuilds the specific content setting type exceptions table. | 78 // Clobbers and rebuilds the specific content setting type exceptions table. |
| 85 void UpdateExceptionsViewFromModel(const ExContentSettingsType& type); | 79 void UpdateExceptionsViewFromModel(const ExContentSettingsType& type); |
| 86 // Clobbers and rebuilds the specific content setting type exceptions | 80 // Clobbers and rebuilds the specific content setting type exceptions |
| 87 // OTR table. | 81 // OTR table. |
| 88 void UpdateOTRExceptionsViewFromModel( | 82 void UpdateOTRExceptionsViewFromModel(const ExContentSettingsType& type); |
| 89 const ExContentSettingsType& type); | |
| 90 // Clobbers and rebuilds all the exceptions tables in the page (both normal | 83 // Clobbers and rebuilds all the exceptions tables in the page (both normal |
| 91 // and OTR tables). | 84 // and OTR tables). |
| 92 void UpdateAllExceptionsViewsFromModel(); | 85 void UpdateAllExceptionsViewsFromModel(); |
| 93 // As above, but only OTR tables. | 86 // As above, but only OTR tables. |
| 94 void UpdateAllOTRExceptionsViewsFromModel(); | 87 void UpdateAllOTRExceptionsViewsFromModel(); |
| 95 // Clobbers and rebuilds just the geolocation exception table. | 88 // Clobbers and rebuilds just the geolocation exception table. |
| 96 void UpdateGeolocationExceptionsView(); | 89 void UpdateGeolocationExceptionsView(); |
| 97 // Clobbers and rebuilds just the desktop notification exception table. | 90 // Clobbers and rebuilds just the desktop notification exception table. |
| 98 void UpdateNotificationExceptionsView(); | 91 void UpdateNotificationExceptionsView(); |
| 99 // Clobbers and rebuilds just the Pepper Flash camera and microphone exception | 92 // Clobbers and rebuilds just the Pepper Flash camera and microphone exception |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 182 |
| 190 static const ExContentSettingsTypeNameEntry | 183 static const ExContentSettingsTypeNameEntry |
| 191 kExContentSettingsTypeGroupNames[]; | 184 kExContentSettingsTypeGroupNames[]; |
| 192 | 185 |
| 193 DISALLOW_COPY_AND_ASSIGN(ContentSettingsHandler); | 186 DISALLOW_COPY_AND_ASSIGN(ContentSettingsHandler); |
| 194 }; | 187 }; |
| 195 | 188 |
| 196 } // namespace options | 189 } // namespace options |
| 197 | 190 |
| 198 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_ | 191 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CONTENT_SETTINGS_HANDLER_H_ |
| OLD | NEW |