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_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 private: | 92 private: |
93 DISALLOW_COPY_AND_ASSIGN(BubbleContent); | 93 DISALLOW_COPY_AND_ASSIGN(BubbleContent); |
94 }; | 94 }; |
95 | 95 |
96 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( | 96 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( |
97 Delegate* delegate, | 97 Delegate* delegate, |
98 content::WebContents* web_contents, | 98 content::WebContents* web_contents, |
99 Profile* profile, | 99 Profile* profile, |
100 ContentSettingsType content_type); | 100 ContentSettingsType content_type); |
101 | 101 |
102 virtual ~ContentSettingBubbleModel(); | 102 ~ContentSettingBubbleModel() override; |
103 | 103 |
104 ContentSettingsType content_type() const { return content_type_; } | 104 ContentSettingsType content_type() const { return content_type_; } |
105 | 105 |
106 const BubbleContent& bubble_content() const { return bubble_content_; } | 106 const BubbleContent& bubble_content() const { return bubble_content_; } |
107 | 107 |
108 // content::NotificationObserver: | 108 // content::NotificationObserver: |
109 virtual void Observe(int type, | 109 void Observe(int type, |
110 const content::NotificationSource& source, | 110 const content::NotificationSource& source, |
111 const content::NotificationDetails& details) override; | 111 const content::NotificationDetails& details) override; |
112 | 112 |
113 virtual void OnRadioClicked(int radio_index) {} | 113 virtual void OnRadioClicked(int radio_index) {} |
114 virtual void OnPopupClicked(int index) {} | 114 virtual void OnPopupClicked(int index) {} |
115 virtual void OnCustomLinkClicked() {} | 115 virtual void OnCustomLinkClicked() {} |
116 virtual void OnManageLinkClicked() {} | 116 virtual void OnManageLinkClicked() {} |
117 virtual void OnLearnMoreLinkClicked() {} | 117 virtual void OnLearnMoreLinkClicked() {} |
118 virtual void OnMediaMenuClicked(content::MediaStreamType type, | 118 virtual void OnMediaMenuClicked(content::MediaStreamType type, |
119 const std::string& selected_device_id) {} | 119 const std::string& selected_device_id) {} |
120 | 120 |
121 // Called by the view code when the bubble is closed by the user using the | 121 // Called by the view code when the bubble is closed by the user using the |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); | 183 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); |
184 }; | 184 }; |
185 | 185 |
186 class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { | 186 class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel { |
187 public: | 187 public: |
188 ContentSettingTitleAndLinkModel(Delegate* delegate, | 188 ContentSettingTitleAndLinkModel(Delegate* delegate, |
189 content::WebContents* web_contents, | 189 content::WebContents* web_contents, |
190 Profile* profile, | 190 Profile* profile, |
191 ContentSettingsType content_type); | 191 ContentSettingsType content_type); |
192 virtual ~ContentSettingTitleAndLinkModel() {} | 192 ~ContentSettingTitleAndLinkModel() override {} |
193 Delegate* delegate() const { return delegate_; } | 193 Delegate* delegate() const { return delegate_; } |
194 | 194 |
195 private: | 195 private: |
196 void SetTitle(); | 196 void SetTitle(); |
197 void SetManageLink(); | 197 void SetManageLink(); |
198 void SetLearnMoreLink(); | 198 void SetLearnMoreLink(); |
199 | 199 |
200 // content::ContentSettingBubbleModel: | 200 // content::ContentSettingBubbleModel: |
201 virtual void OnManageLinkClicked() override; | 201 void OnManageLinkClicked() override; |
202 virtual void OnLearnMoreLinkClicked() override; | 202 void OnLearnMoreLinkClicked() override; |
203 Delegate* delegate_; | 203 Delegate* delegate_; |
204 }; | 204 }; |
205 | 205 |
206 class ContentSettingRPHBubbleModel : public ContentSettingTitleAndLinkModel { | 206 class ContentSettingRPHBubbleModel : public ContentSettingTitleAndLinkModel { |
207 public: | 207 public: |
208 ContentSettingRPHBubbleModel(Delegate* delegate, | 208 ContentSettingRPHBubbleModel(Delegate* delegate, |
209 content::WebContents* web_contents, | 209 content::WebContents* web_contents, |
210 Profile* profile, | 210 Profile* profile, |
211 ProtocolHandlerRegistry* registry, | 211 ProtocolHandlerRegistry* registry, |
212 ContentSettingsType content_type); | 212 ContentSettingsType content_type); |
213 | 213 |
214 virtual void OnRadioClicked(int radio_index) override; | 214 void OnRadioClicked(int radio_index) override; |
215 virtual void OnDoneClicked() override; | 215 void OnDoneClicked() override; |
216 | 216 |
217 private: | 217 private: |
218 // These states must match the order of appearance of the radio buttons | 218 // These states must match the order of appearance of the radio buttons |
219 // in the XIB file for the Mac port. | 219 // in the XIB file for the Mac port. |
220 enum RPHState { | 220 enum RPHState { |
221 RPH_ALLOW = 0, | 221 RPH_ALLOW = 0, |
222 RPH_BLOCK, | 222 RPH_BLOCK, |
223 RPH_IGNORE, | 223 RPH_IGNORE, |
224 }; | 224 }; |
225 | 225 |
226 void RegisterProtocolHandler(); | 226 void RegisterProtocolHandler(); |
227 void UnregisterProtocolHandler(); | 227 void UnregisterProtocolHandler(); |
228 void IgnoreProtocolHandler(); | 228 void IgnoreProtocolHandler(); |
229 void ClearOrSetPreviousHandler(); | 229 void ClearOrSetPreviousHandler(); |
230 | 230 |
231 int selected_item_; | 231 int selected_item_; |
232 ProtocolHandlerRegistry* registry_; | 232 ProtocolHandlerRegistry* registry_; |
233 ProtocolHandler pending_handler_; | 233 ProtocolHandler pending_handler_; |
234 ProtocolHandler previous_handler_; | 234 ProtocolHandler previous_handler_; |
235 }; | 235 }; |
236 | 236 |
237 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 237 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
OLD | NEW |