Chromium Code Reviews| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 typedef std::map<content::MediaStreamType, MediaMenu> MediaMenuMap; | 111 typedef std::map<content::MediaStreamType, MediaMenu> MediaMenuMap; |
| 112 | 112 |
| 113 struct BubbleContent { | 113 struct BubbleContent { |
| 114 BubbleContent(); | 114 BubbleContent(); |
| 115 ~BubbleContent(); | 115 ~BubbleContent(); |
| 116 | 116 |
| 117 base::string16 title; | 117 base::string16 title; |
| 118 base::string16 message; | 118 base::string16 message; |
| 119 ListItems list_items; | 119 ListItems list_items; |
| 120 RadioGroup radio_group; | 120 RadioGroup radio_group; |
| 121 bool radio_group_enabled; | 121 bool radio_group_enabled = false; |
| 122 std::vector<DomainList> domain_lists; | 122 std::vector<DomainList> domain_lists; |
| 123 std::string custom_link; | 123 std::string custom_link; |
| 124 bool custom_link_enabled; | 124 bool custom_link_enabled = false; |
| 125 std::string manage_text; | 125 std::string manage_text; |
| 126 bool show_manage_text_as_button; | 126 bool show_manage_text_as_checkbox = false; |
| 127 MediaMenuMap media_menus; | 127 MediaMenuMap media_menus; |
| 128 std::string learn_more_link; | 128 std::string learn_more_link; |
| 129 base::string16 done_button_text; | |
| 129 | 130 |
| 130 private: | 131 private: |
| 131 DISALLOW_COPY_AND_ASSIGN(BubbleContent); | 132 DISALLOW_COPY_AND_ASSIGN(BubbleContent); |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 // Creates a bubble model for a particular |content_type|. Note that not all | 135 // Creates a bubble model for a particular |content_type|. Note that not all |
| 135 // bubbles fit this description. | 136 // bubbles fit this description. |
| 136 // TODO(msramek): Move this to ContentSettingSimpleBubbleModel or remove | 137 // TODO(msramek): Move this to ContentSettingSimpleBubbleModel or remove |
| 137 // entirely. | 138 // entirely. |
| 138 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( | 139 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( |
| 139 Delegate* delegate, | 140 Delegate* delegate, |
| 140 content::WebContents* web_contents, | 141 content::WebContents* web_contents, |
| 141 Profile* profile, | 142 Profile* profile, |
| 142 ContentSettingsType content_type); | 143 ContentSettingsType content_type); |
| 143 | 144 |
| 144 ~ContentSettingBubbleModel() override; | 145 ~ContentSettingBubbleModel() override; |
| 145 | 146 |
| 146 const BubbleContent& bubble_content() const { return bubble_content_; } | 147 const BubbleContent& bubble_content() const { return bubble_content_; } |
| 147 | 148 |
| 148 // content::NotificationObserver: | 149 // content::NotificationObserver: |
| 149 void Observe(int type, | 150 void Observe(int type, |
| 150 const content::NotificationSource& source, | 151 const content::NotificationSource& source, |
| 151 const content::NotificationDetails& details) override; | 152 const content::NotificationDetails& details) override; |
| 152 | 153 |
| 153 virtual void OnRadioClicked(int radio_index) {} | 154 virtual void OnRadioClicked(int radio_index) {} |
| 154 virtual void OnListItemClicked(int index) {} | 155 virtual void OnListItemClicked(int index) {} |
| 155 virtual void OnCustomLinkClicked() {} | 156 virtual void OnCustomLinkClicked() {} |
| 156 virtual void OnManageLinkClicked() {} | 157 virtual void OnManageLinkClicked() {} |
| 158 virtual void OnManageCheckboxChecked(bool is_checked) {} | |
| 157 virtual void OnLearnMoreLinkClicked() {} | 159 virtual void OnLearnMoreLinkClicked() {} |
| 158 virtual void OnMediaMenuClicked(content::MediaStreamType type, | 160 virtual void OnMediaMenuClicked(content::MediaStreamType type, |
| 159 const std::string& selected_device_id) {} | 161 const std::string& selected_device_id) {} |
| 160 | 162 |
| 161 // Called by the view code when the bubble is closed by the user using the | 163 // Called by the view code when the bubble is closed by the user using the |
| 162 // Done button. | 164 // Done button. |
| 163 virtual void OnDoneClicked() {} | 165 virtual void OnDoneClicked() {} |
| 164 | 166 |
| 165 // TODO(msramek): The casting methods below are only necessary because | 167 // TODO(msramek): The casting methods below are only necessary because |
| 166 // ContentSettingBubbleController in the Cocoa UI needs to know the type of | 168 // ContentSettingBubbleController in the Cocoa UI needs to know the type of |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 } | 218 } |
| 217 void set_custom_link(const std::string& link) { | 219 void set_custom_link(const std::string& link) { |
| 218 bubble_content_.custom_link = link; | 220 bubble_content_.custom_link = link; |
| 219 } | 221 } |
| 220 void set_custom_link_enabled(bool enabled) { | 222 void set_custom_link_enabled(bool enabled) { |
| 221 bubble_content_.custom_link_enabled = enabled; | 223 bubble_content_.custom_link_enabled = enabled; |
| 222 } | 224 } |
| 223 void set_manage_text(const std::string& link) { | 225 void set_manage_text(const std::string& link) { |
| 224 bubble_content_.manage_text = link; | 226 bubble_content_.manage_text = link; |
| 225 } | 227 } |
| 226 void set_show_manage_text_as_button(bool show_manage_text_as_button) { | 228 void set_show_manage_text_as_checkbox(bool show_manage_text_as_checkbox) { |
| 227 bubble_content_.show_manage_text_as_button = show_manage_text_as_button; | 229 bubble_content_.show_manage_text_as_checkbox = show_manage_text_as_checkbox; |
| 228 } | 230 } |
| 229 void set_learn_more_link(const std::string& link) { | 231 void set_learn_more_link(const std::string& link) { |
|
msw
2017/04/06 00:44:56
optional nit: this and |set_done_button_text| prob
Charlie Harrison
2017/04/06 02:04:58
Done.
| |
| 230 bubble_content_.learn_more_link = link; | 232 bubble_content_.learn_more_link = link; |
| 231 } | 233 } |
| 234 void set_done_button_text(const base::string16& done_button_text) { | |
| 235 bubble_content_.done_button_text = done_button_text; | |
| 236 } | |
| 232 void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { | 237 void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { |
| 233 bubble_content_.media_menus[type] = menu; | 238 bubble_content_.media_menus[type] = menu; |
| 234 } | 239 } |
| 235 void set_selected_device(const content::MediaStreamDevice& device) { | 240 void set_selected_device(const content::MediaStreamDevice& device) { |
| 236 bubble_content_.media_menus[device.type].selected_device = device; | 241 bubble_content_.media_menus[device.type].selected_device = device; |
| 237 } | 242 } |
| 238 rappor::RapporServiceImpl* rappor_service() const { return rappor_service_; } | 243 rappor::RapporServiceImpl* rappor_service() const { return rappor_service_; } |
| 239 | 244 |
| 240 private: | 245 private: |
| 241 virtual void SetTitle() = 0; | 246 virtual void SetTitle() = 0; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 // The model for the deceptive content bubble. | 316 // The model for the deceptive content bubble. |
| 312 class ContentSettingSubresourceFilterBubbleModel | 317 class ContentSettingSubresourceFilterBubbleModel |
| 313 : public ContentSettingBubbleModel { | 318 : public ContentSettingBubbleModel { |
| 314 public: | 319 public: |
| 315 ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, | 320 ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, |
| 316 content::WebContents* web_contents, | 321 content::WebContents* web_contents, |
| 317 Profile* profile); | 322 Profile* profile); |
| 318 | 323 |
| 319 ~ContentSettingSubresourceFilterBubbleModel() override; | 324 ~ContentSettingSubresourceFilterBubbleModel() override; |
| 320 | 325 |
| 321 void OnManageLinkClicked() override; | |
| 322 ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() | |
| 323 override; | |
| 324 | 326 |
| 325 private: | 327 private: |
| 326 void SetMessage(); | 328 void SetMessage(); |
| 327 | 329 |
| 328 // ContentSettingBubbleModel: | 330 // ContentSettingBubbleModel: |
| 329 void SetTitle() override; | 331 void SetTitle() override; |
| 330 void SetManageText() override; | 332 void SetManageText() override; |
| 333 void OnManageCheckboxChecked(bool is_checked) override; | |
| 334 ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() | |
| 335 override; | |
| 336 void OnDoneClicked() override; | |
| 337 | |
| 338 bool is_checked_ = false; | |
| 331 | 339 |
| 332 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); | 340 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); |
| 333 }; | 341 }; |
| 334 | 342 |
| 335 // The model of the content settings bubble for media settings. | 343 // The model of the content settings bubble for media settings. |
| 336 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { | 344 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { |
| 337 public: | 345 public: |
| 338 ContentSettingMediaStreamBubbleModel(Delegate* delegate, | 346 ContentSettingMediaStreamBubbleModel(Delegate* delegate, |
| 339 content::WebContents* web_contents, | 347 content::WebContents* web_contents, |
| 340 Profile* profile); | 348 Profile* profile); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 void SetTitle() override; | 415 void SetTitle() override; |
| 408 void SetManageText() override; | 416 void SetManageText() override; |
| 409 void OnManageLinkClicked() override; | 417 void OnManageLinkClicked() override; |
| 410 | 418 |
| 411 int selected_item_ = 0; | 419 int selected_item_ = 0; |
| 412 | 420 |
| 413 DISALLOW_COPY_AND_ASSIGN(ContentSettingDownloadsBubbleModel); | 421 DISALLOW_COPY_AND_ASSIGN(ContentSettingDownloadsBubbleModel); |
| 414 }; | 422 }; |
| 415 | 423 |
| 416 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 424 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
| OLD | NEW |