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_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/plugin_data_remover_helper.h" | 9 #include <map> |
| 10 #include <string> |
| 11 |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/pepper_flash_settings_manager.h" |
10 #include "chrome/browser/prefs/pref_change_registrar.h" | 14 #include "chrome/browser/prefs/pref_change_registrar.h" |
11 #include "chrome/browser/ui/webui/options2/options_ui2.h" | 15 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
12 #include "chrome/common/content_settings_types.h" | 16 #include "chrome/common/content_settings_types.h" |
13 #include "chrome/common/content_settings.h" | 17 #include "chrome/common/content_settings.h" |
14 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
16 | 20 |
17 class HostContentSettingsMap; | 21 class HostContentSettingsMap; |
18 class ProtocolHandlerRegistry; | 22 class ProtocolHandlerRegistry; |
19 | 23 |
20 namespace options2 { | 24 namespace options2 { |
21 | 25 |
22 class ContentSettingsHandler : public OptionsPageUIHandler { | 26 class ContentSettingsHandler : public OptionsPageUIHandler, |
| 27 public PepperFlashSettingsManager::Client { |
23 public: | 28 public: |
24 ContentSettingsHandler(); | 29 ContentSettingsHandler(); |
25 virtual ~ContentSettingsHandler(); | 30 virtual ~ContentSettingsHandler(); |
26 | 31 |
27 // OptionsPageUIHandler implementation. | 32 // OptionsPageUIHandler implementation. |
28 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 33 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
29 virtual void InitializeHandler() OVERRIDE; | 34 virtual void InitializeHandler() OVERRIDE; |
30 virtual void InitializePage() OVERRIDE; | 35 virtual void InitializePage() OVERRIDE; |
31 virtual void RegisterMessages() OVERRIDE; | 36 virtual void RegisterMessages() OVERRIDE; |
32 | 37 |
33 // content::NotificationObserver implementation. | 38 // content::NotificationObserver implementation. |
34 virtual void Observe(int type, | 39 virtual void Observe(int type, |
35 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
36 const content::NotificationDetails& details) OVERRIDE; | 41 const content::NotificationDetails& details) OVERRIDE; |
37 | 42 |
| 43 // PepperFlashSettingsManager::Client implementation. |
| 44 virtual void OnGetPermissionSettingsCompleted( |
| 45 uint32 request_id, |
| 46 bool success, |
| 47 PP_Flash_BrowserOperations_Permission default_permission, |
| 48 const ppapi::FlashSiteSettings& sites) OVERRIDE; |
| 49 |
38 // 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. |
39 static std::string ContentSettingsTypeToGroupName(ContentSettingsType type); | 51 static std::string ContentSettingsTypeToGroupName(ContentSettingsType type); |
40 | 52 |
41 private: | 53 private: |
| 54 // Extends ContentSettingsType with some other types that will be also |
| 55 // displayed in the content settings UI. |
| 56 class ExContentSettingsType; |
| 57 struct ExContentSettingsTypeNameEntry; |
| 58 |
| 59 struct CachedPepperFlashSettings { |
| 60 CachedPepperFlashSettings(); |
| 61 ~CachedPepperFlashSettings(); |
| 62 |
| 63 PP_Flash_BrowserOperations_Permission default_permission; |
| 64 |
| 65 typedef std::map<std::string, PP_Flash_BrowserOperations_Permission> |
| 66 SiteMap; |
| 67 SiteMap sites; |
| 68 |
| 69 bool initialized; |
| 70 }; |
| 71 |
42 // Functions that call into the page ----------------------------------------- | 72 // Functions that call into the page ----------------------------------------- |
43 | 73 |
44 // Updates the page with the default settings (allow, ask, block, etc.) | 74 // Updates the page with the default settings (allow, ask, block, etc.) |
45 void UpdateSettingDefaultFromModel(ContentSettingsType type); | 75 void UpdateSettingDefaultFromModel(const ExContentSettingsType& type); |
46 | 76 |
47 // Clobbers and rebuilds the specific content setting type exceptions table. | 77 // Clobbers and rebuilds the specific content setting type exceptions table. |
48 void UpdateExceptionsViewFromModel(ContentSettingsType type); | 78 void UpdateExceptionsViewFromModel(const ExContentSettingsType& type); |
49 // Clobbers and rebuilds the specific content setting type exceptions | 79 // Clobbers and rebuilds the specific content setting type exceptions |
50 // OTR table. | 80 // OTR table. |
51 void UpdateOTRExceptionsViewFromModel(ContentSettingsType type); | 81 void UpdateOTRExceptionsViewFromModel( |
| 82 const ExContentSettingsType& type); |
52 // 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 |
53 // and OTR tables). | 84 // and OTR tables). |
54 void UpdateAllExceptionsViewsFromModel(); | 85 void UpdateAllExceptionsViewsFromModel(); |
55 // As above, but only OTR tables. | 86 // As above, but only OTR tables. |
56 void UpdateAllOTRExceptionsViewsFromModel(); | 87 void UpdateAllOTRExceptionsViewsFromModel(); |
57 // Clobbers and rebuilds just the geolocation exception table. | 88 // Clobbers and rebuilds just the geolocation exception table. |
58 void UpdateGeolocationExceptionsView(); | 89 void UpdateGeolocationExceptionsView(); |
59 // Clobbers and rebuilds just the desktop notification exception table. | 90 // Clobbers and rebuilds just the desktop notification exception table. |
60 void UpdateNotificationExceptionsView(); | 91 void UpdateNotificationExceptionsView(); |
| 92 // Clobbers and rebuilds just the Pepper Flash camera and microphone exception |
| 93 // table. |
| 94 void UpdateFlashCameraMicExceptionsView(); |
61 // Clobbers and rebuilds an exception table that's managed by the host content | 95 // Clobbers and rebuilds an exception table that's managed by the host content |
62 // settings map. | 96 // settings map. |
63 void UpdateExceptionsViewFromHostContentSettingsMap(ContentSettingsType type); | 97 void UpdateExceptionsViewFromHostContentSettingsMap(ContentSettingsType type); |
64 // As above, but acts on the OTR table for the content setting type. | 98 // As above, but acts on the OTR table for the content setting type. |
65 void UpdateExceptionsViewFromOTRHostContentSettingsMap( | 99 void UpdateExceptionsViewFromOTRHostContentSettingsMap( |
66 ContentSettingsType type); | 100 ContentSettingsType type); |
67 // Updates the radio buttons for enabling / disabling handlers. | 101 // Updates the radio buttons for enabling / disabling handlers. |
68 void UpdateHandlersEnabledRadios(); | 102 void UpdateHandlersEnabledRadios(); |
69 | 103 |
70 // Callbacks used by the page ------------------------------------------------ | 104 // Callbacks used by the page ------------------------------------------------ |
(...skipping 24 matching lines...) Expand all Loading... |
95 | 129 |
96 // Gets the HostContentSettingsMap for the normal profile. | 130 // Gets the HostContentSettingsMap for the normal profile. |
97 HostContentSettingsMap* GetContentSettingsMap(); | 131 HostContentSettingsMap* GetContentSettingsMap(); |
98 | 132 |
99 // Gets the HostContentSettingsMap for the incognito profile, or NULL if there | 133 // Gets the HostContentSettingsMap for the incognito profile, or NULL if there |
100 // is no active incognito session. | 134 // is no active incognito session. |
101 HostContentSettingsMap* GetOTRContentSettingsMap(); | 135 HostContentSettingsMap* GetOTRContentSettingsMap(); |
102 | 136 |
103 // Gets the default setting in string form. If |provider_id| is not NULL, the | 137 // Gets the default setting in string form. If |provider_id| is not NULL, the |
104 // id of the provider which provided the default setting is assigned to it. | 138 // id of the provider which provided the default setting is assigned to it. |
105 std::string GetSettingDefaultFromModel(ContentSettingsType type, | 139 std::string GetSettingDefaultFromModel(const ExContentSettingsType& type, |
106 std::string* provider_id); | 140 std::string* provider_id); |
107 | 141 |
108 // Gets the ProtocolHandlerRegistry for the normal profile. | 142 // Gets the ProtocolHandlerRegistry for the normal profile. |
109 ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); | 143 ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); |
110 | 144 |
| 145 static ExContentSettingsType ExContentSettingsTypeFromGroupName( |
| 146 const std::string& name); |
| 147 static std::string ExContentSettingsTypeToGroupName( |
| 148 const ExContentSettingsType& type); |
| 149 |
111 // Member variables --------------------------------------------------------- | 150 // Member variables --------------------------------------------------------- |
112 | 151 |
113 content::NotificationRegistrar notification_registrar_; | 152 content::NotificationRegistrar notification_registrar_; |
114 PrefChangeRegistrar pref_change_registrar_; | 153 PrefChangeRegistrar pref_change_registrar_; |
| 154 scoped_ptr<PepperFlashSettingsManager> flash_settings_manager_; |
| 155 CachedPepperFlashSettings flash_cameramic_settings_; |
| 156 |
| 157 static const ExContentSettingsTypeNameEntry |
| 158 kExContentSettingsTypeGroupNames[]; |
115 | 159 |
116 DISALLOW_COPY_AND_ASSIGN(ContentSettingsHandler); | 160 DISALLOW_COPY_AND_ASSIGN(ContentSettingsHandler); |
117 }; | 161 }; |
118 | 162 |
119 } // namespace options2 | 163 } // namespace options2 |
120 | 164 |
121 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_ | 165 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CONTENT_SETTINGS_HANDLER2_H_ |
OLD | NEW |