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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 27 matching lines...) Expand all Loading... |
38 // ContentSettingMediaStreamBubbleModel - media (camera and mic) | 38 // ContentSettingMediaStreamBubbleModel - media (camera and mic) |
39 // ContentSettingSimpleBubbleModel - single content setting | 39 // ContentSettingSimpleBubbleModel - single content setting |
40 // ContentSettingMixedScriptBubbleModel - mixed script | 40 // ContentSettingMixedScriptBubbleModel - mixed script |
41 // ContentSettingRPHBubbleModel - protocol handlers | 41 // ContentSettingRPHBubbleModel - protocol handlers |
42 // ContentSettingMidiSysExBubbleModel - midi sysex | 42 // ContentSettingMidiSysExBubbleModel - midi sysex |
43 // ContentSettingDomainListBubbleModel - domain list (geolocation) | 43 // ContentSettingDomainListBubbleModel - domain list (geolocation) |
44 // ContentSettingSingleRadioGroup - radio group | 44 // ContentSettingSingleRadioGroup - radio group |
45 // ContentSettingCookiesBubbleModel - cookies | 45 // ContentSettingCookiesBubbleModel - cookies |
46 // ContentSettingPluginBubbleModel - plugins | 46 // ContentSettingPluginBubbleModel - plugins |
47 // ContentSettingPopupBubbleModel - popups | 47 // ContentSettingPopupBubbleModel - popups |
| 48 // ContentSettingSubresourceFilterBubbleModel - filtered subresources |
48 | 49 |
49 // Forward declaration necessary for downcasts. | 50 // Forward declaration necessary for downcasts. |
| 51 class ContentSettingMediaStreamBubbleModel; |
50 class ContentSettingSimpleBubbleModel; | 52 class ContentSettingSimpleBubbleModel; |
51 class ContentSettingMediaStreamBubbleModel; | 53 class ContentSettingSubresourceFilterBubbleModel; |
52 | 54 |
53 // This model provides data for ContentSettingBubble, and also controls | 55 // This model provides data for ContentSettingBubble, and also controls |
54 // the action triggered when the allow / block radio buttons are triggered. | 56 // the action triggered when the allow / block radio buttons are triggered. |
55 class ContentSettingBubbleModel : public content::NotificationObserver { | 57 class ContentSettingBubbleModel : public content::NotificationObserver { |
56 public: | 58 public: |
57 typedef ContentSettingBubbleModelDelegate Delegate; | 59 typedef ContentSettingBubbleModelDelegate Delegate; |
58 | 60 |
59 struct ListItem { | 61 struct ListItem { |
60 ListItem(const gfx::Image& image, | 62 ListItem(const gfx::Image& image, |
61 const std::string& title, | 63 const std::string& title, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // TODO(msramek): The casting methods below are only necessary because | 157 // TODO(msramek): The casting methods below are only necessary because |
156 // ContentSettingBubbleController in the Cocoa UI needs to know the type of | 158 // ContentSettingBubbleController in the Cocoa UI needs to know the type of |
157 // the bubble it wraps. Find a solution that does not require reflection nor | 159 // the bubble it wraps. Find a solution that does not require reflection nor |
158 // recreating the entire hierarchy for Cocoa UI. | 160 // recreating the entire hierarchy for Cocoa UI. |
159 // Cast this bubble into ContentSettingSimpleBubbleModel if possible. | 161 // Cast this bubble into ContentSettingSimpleBubbleModel if possible. |
160 virtual ContentSettingSimpleBubbleModel* AsSimpleBubbleModel(); | 162 virtual ContentSettingSimpleBubbleModel* AsSimpleBubbleModel(); |
161 | 163 |
162 // Cast this bubble into ContentSettingMediaStreamBubbleModel if possible. | 164 // Cast this bubble into ContentSettingMediaStreamBubbleModel if possible. |
163 virtual ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel(); | 165 virtual ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel(); |
164 | 166 |
| 167 // Cast this bubble into ContentSettingSubresourceFilterBubbleModel |
| 168 // if possible. |
| 169 virtual ContentSettingSubresourceFilterBubbleModel* |
| 170 AsSubresourceFilterBubbleModel(); |
| 171 |
165 protected: | 172 protected: |
166 ContentSettingBubbleModel( | 173 ContentSettingBubbleModel( |
167 Delegate* delegate, | 174 Delegate* delegate, |
168 content::WebContents* web_contents, | 175 content::WebContents* web_contents, |
169 Profile* profile); | 176 Profile* profile); |
170 | 177 |
171 content::WebContents* web_contents() const { return web_contents_; } | 178 content::WebContents* web_contents() const { return web_contents_; } |
172 Profile* profile() const { return profile_; } | 179 Profile* profile() const { return profile_; } |
173 Delegate* delegate() const { return delegate_; } | 180 Delegate* delegate() const { return delegate_; } |
174 | 181 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // Initially false, set to true if the user explicitly interacts with the | 282 // Initially false, set to true if the user explicitly interacts with the |
276 // bubble. | 283 // bubble. |
277 bool interacted_; | 284 bool interacted_; |
278 ProtocolHandlerRegistry* registry_; | 285 ProtocolHandlerRegistry* registry_; |
279 ProtocolHandler pending_handler_; | 286 ProtocolHandler pending_handler_; |
280 ProtocolHandler previous_handler_; | 287 ProtocolHandler previous_handler_; |
281 | 288 |
282 DISALLOW_COPY_AND_ASSIGN(ContentSettingRPHBubbleModel); | 289 DISALLOW_COPY_AND_ASSIGN(ContentSettingRPHBubbleModel); |
283 }; | 290 }; |
284 | 291 |
| 292 // The model for the deceptive content bubble. |
| 293 class ContentSettingSubresourceFilterBubbleModel |
| 294 : public ContentSettingBubbleModel { |
| 295 public: |
| 296 ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, |
| 297 content::WebContents* web_contents, |
| 298 Profile* profile); |
| 299 |
| 300 ~ContentSettingSubresourceFilterBubbleModel() override; |
| 301 |
| 302 void OnManageLinkClicked() override; |
| 303 ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() |
| 304 override; |
| 305 |
| 306 private: |
| 307 // ContentSettingBubbleModel: |
| 308 void SetTitle() override; |
| 309 void SetManageLink() override; |
| 310 |
| 311 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); |
| 312 }; |
| 313 |
285 // The model of the content settings bubble for media settings. | 314 // The model of the content settings bubble for media settings. |
286 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { | 315 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { |
287 public: | 316 public: |
288 ContentSettingMediaStreamBubbleModel(Delegate* delegate, | 317 ContentSettingMediaStreamBubbleModel(Delegate* delegate, |
289 content::WebContents* web_contents, | 318 content::WebContents* web_contents, |
290 Profile* profile); | 319 Profile* profile); |
291 | 320 |
292 ~ContentSettingMediaStreamBubbleModel() override; | 321 ~ContentSettingMediaStreamBubbleModel() override; |
293 | 322 |
294 // ContentSettingBubbleModel: | 323 // ContentSettingBubbleModel: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // The content settings that are associated with the individual radio | 361 // The content settings that are associated with the individual radio |
333 // buttons. | 362 // buttons. |
334 ContentSetting radio_item_setting_[2]; | 363 ContentSetting radio_item_setting_[2]; |
335 // The state of the microphone and camera access. | 364 // The state of the microphone and camera access. |
336 TabSpecificContentSettings::MicrophoneCameraState state_; | 365 TabSpecificContentSettings::MicrophoneCameraState state_; |
337 | 366 |
338 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); | 367 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); |
339 }; | 368 }; |
340 | 369 |
341 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 370 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
OLD | NEW |