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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; |
| 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; |
| 125 std::string manage_text; | 125 std::string manage_text; |
| 126 bool show_manage_text_as_button; | 126 bool show_manage_text_as_button; |
| 127 bool show_manage_text_as_checkbox; | |
| 127 MediaMenuMap media_menus; | 128 MediaMenuMap media_menus; |
| 128 std::string learn_more_link; | 129 std::string learn_more_link; |
| 130 base::string16 done_text; | |
|
msw
2017/04/05 22:08:34
nit: give this a better name like |done_button_tex
Charlie Harrison
2017/04/05 22:35:32
Done. Changed to done_button_text.
| |
| 129 | 131 |
| 130 private: | 132 private: |
| 131 DISALLOW_COPY_AND_ASSIGN(BubbleContent); | 133 DISALLOW_COPY_AND_ASSIGN(BubbleContent); |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 // Creates a bubble model for a particular |content_type|. Note that not all | 136 // Creates a bubble model for a particular |content_type|. Note that not all |
| 135 // bubbles fit this description. | 137 // bubbles fit this description. |
| 136 // TODO(msramek): Move this to ContentSettingSimpleBubbleModel or remove | 138 // TODO(msramek): Move this to ContentSettingSimpleBubbleModel or remove |
| 137 // entirely. | 139 // entirely. |
| 138 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( | 140 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( |
| 139 Delegate* delegate, | 141 Delegate* delegate, |
| 140 content::WebContents* web_contents, | 142 content::WebContents* web_contents, |
| 141 Profile* profile, | 143 Profile* profile, |
| 142 ContentSettingsType content_type); | 144 ContentSettingsType content_type); |
| 143 | 145 |
| 144 ~ContentSettingBubbleModel() override; | 146 ~ContentSettingBubbleModel() override; |
| 145 | 147 |
| 146 const BubbleContent& bubble_content() const { return bubble_content_; } | 148 const BubbleContent& bubble_content() const { return bubble_content_; } |
| 147 | 149 |
| 148 // content::NotificationObserver: | 150 // content::NotificationObserver: |
| 149 void Observe(int type, | 151 void Observe(int type, |
| 150 const content::NotificationSource& source, | 152 const content::NotificationSource& source, |
| 151 const content::NotificationDetails& details) override; | 153 const content::NotificationDetails& details) override; |
| 152 | 154 |
| 153 virtual void OnRadioClicked(int radio_index) {} | 155 virtual void OnRadioClicked(int radio_index) {} |
| 154 virtual void OnListItemClicked(int index) {} | 156 virtual void OnListItemClicked(int index) {} |
| 155 virtual void OnCustomLinkClicked() {} | 157 virtual void OnCustomLinkClicked() {} |
| 156 virtual void OnManageLinkClicked() {} | 158 virtual void OnManageLinkClicked() {} |
| 159 virtual void OnChecked(bool is_checked) {} | |
|
msw
2017/04/05 22:08:34
nit: OnManageCheckboxChecked?
Charlie Harrison
2017/04/05 22:35:32
Done.
| |
| 157 virtual void OnLearnMoreLinkClicked() {} | 160 virtual void OnLearnMoreLinkClicked() {} |
| 158 virtual void OnMediaMenuClicked(content::MediaStreamType type, | 161 virtual void OnMediaMenuClicked(content::MediaStreamType type, |
| 159 const std::string& selected_device_id) {} | 162 const std::string& selected_device_id) {} |
| 160 | 163 |
| 161 // Called by the view code when the bubble is closed by the user using the | 164 // Called by the view code when the bubble is closed by the user using the |
| 162 // Done button. | 165 // Done button. |
| 163 virtual void OnDoneClicked() {} | 166 virtual void OnDoneClicked() {} |
| 164 | 167 |
| 165 // TODO(msramek): The casting methods below are only necessary because | 168 // TODO(msramek): The casting methods below are only necessary because |
| 166 // ContentSettingBubbleController in the Cocoa UI needs to know the type of | 169 // ContentSettingBubbleController in the Cocoa UI needs to know the type of |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 192 ContentSettingBubbleModel( | 195 ContentSettingBubbleModel( |
| 193 Delegate* delegate, | 196 Delegate* delegate, |
| 194 content::WebContents* web_contents, | 197 content::WebContents* web_contents, |
| 195 Profile* profile); | 198 Profile* profile); |
| 196 | 199 |
| 197 content::WebContents* web_contents() const { return web_contents_; } | 200 content::WebContents* web_contents() const { return web_contents_; } |
| 198 Profile* profile() const { return profile_; } | 201 Profile* profile() const { return profile_; } |
| 199 Delegate* delegate() const { return delegate_; } | 202 Delegate* delegate() const { return delegate_; } |
| 200 | 203 |
| 201 void set_title(const base::string16& title) { bubble_content_.title = title; } | 204 void set_title(const base::string16& title) { bubble_content_.title = title; } |
| 205 void set_done_text(const base::string16& done_text) { | |
|
msw
2017/04/05 22:08:34
nit: match order to member declaration?
Charlie Harrison
2017/04/05 22:35:32
Done.
| |
| 206 bubble_content_.done_text = done_text; | |
| 207 } | |
| 202 void set_message(const base::string16& message) { | 208 void set_message(const base::string16& message) { |
| 203 bubble_content_.message = message; | 209 bubble_content_.message = message; |
| 204 } | 210 } |
| 205 void add_list_item(const ListItem& item) { | 211 void add_list_item(const ListItem& item) { |
| 206 bubble_content_.list_items.push_back(item); | 212 bubble_content_.list_items.push_back(item); |
| 207 } | 213 } |
| 208 void set_radio_group(const RadioGroup& radio_group) { | 214 void set_radio_group(const RadioGroup& radio_group) { |
| 209 bubble_content_.radio_group = radio_group; | 215 bubble_content_.radio_group = radio_group; |
| 210 } | 216 } |
| 211 void set_radio_group_enabled(bool enabled) { | 217 void set_radio_group_enabled(bool enabled) { |
| 212 bubble_content_.radio_group_enabled = enabled; | 218 bubble_content_.radio_group_enabled = enabled; |
| 213 } | 219 } |
| 214 void add_domain_list(const DomainList& domain_list) { | 220 void add_domain_list(const DomainList& domain_list) { |
| 215 bubble_content_.domain_lists.push_back(domain_list); | 221 bubble_content_.domain_lists.push_back(domain_list); |
| 216 } | 222 } |
| 217 void set_custom_link(const std::string& link) { | 223 void set_custom_link(const std::string& link) { |
| 218 bubble_content_.custom_link = link; | 224 bubble_content_.custom_link = link; |
| 219 } | 225 } |
| 220 void set_custom_link_enabled(bool enabled) { | 226 void set_custom_link_enabled(bool enabled) { |
| 221 bubble_content_.custom_link_enabled = enabled; | 227 bubble_content_.custom_link_enabled = enabled; |
| 222 } | 228 } |
| 223 void set_manage_text(const std::string& link) { | 229 void set_manage_text(const std::string& link) { |
| 224 bubble_content_.manage_text = link; | 230 bubble_content_.manage_text = link; |
| 225 } | 231 } |
| 226 void set_show_manage_text_as_button(bool show_manage_text_as_button) { | 232 void set_show_manage_text_as_button(bool show_manage_text_as_button) { |
| 227 bubble_content_.show_manage_text_as_button = show_manage_text_as_button; | 233 bubble_content_.show_manage_text_as_button = show_manage_text_as_button; |
| 228 } | 234 } |
| 235 void set_show_manage_text_as_checkbox(bool show_manage_text_as_checkbox) { | |
| 236 bubble_content_.show_manage_text_as_checkbox = show_manage_text_as_checkbox; | |
| 237 } | |
| 229 void set_learn_more_link(const std::string& link) { | 238 void set_learn_more_link(const std::string& link) { |
| 230 bubble_content_.learn_more_link = link; | 239 bubble_content_.learn_more_link = link; |
| 231 } | 240 } |
| 232 void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { | 241 void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { |
| 233 bubble_content_.media_menus[type] = menu; | 242 bubble_content_.media_menus[type] = menu; |
| 234 } | 243 } |
| 235 void set_selected_device(const content::MediaStreamDevice& device) { | 244 void set_selected_device(const content::MediaStreamDevice& device) { |
| 236 bubble_content_.media_menus[device.type].selected_device = device; | 245 bubble_content_.media_menus[device.type].selected_device = device; |
| 237 } | 246 } |
| 238 rappor::RapporServiceImpl* rappor_service() const { return rappor_service_; } | 247 rappor::RapporServiceImpl* rappor_service() const { return rappor_service_; } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 // The model for the deceptive content bubble. | 320 // The model for the deceptive content bubble. |
| 312 class ContentSettingSubresourceFilterBubbleModel | 321 class ContentSettingSubresourceFilterBubbleModel |
| 313 : public ContentSettingBubbleModel { | 322 : public ContentSettingBubbleModel { |
| 314 public: | 323 public: |
| 315 ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, | 324 ContentSettingSubresourceFilterBubbleModel(Delegate* delegate, |
| 316 content::WebContents* web_contents, | 325 content::WebContents* web_contents, |
| 317 Profile* profile); | 326 Profile* profile); |
| 318 | 327 |
| 319 ~ContentSettingSubresourceFilterBubbleModel() override; | 328 ~ContentSettingSubresourceFilterBubbleModel() override; |
| 320 | 329 |
| 321 void OnManageLinkClicked() override; | |
| 322 ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() | |
| 323 override; | |
| 324 | 330 |
| 325 private: | 331 private: |
| 326 void SetMessage(); | 332 void SetMessage(); |
| 327 | 333 |
| 328 // ContentSettingBubbleModel: | 334 // ContentSettingBubbleModel: |
| 329 void SetTitle() override; | 335 void SetTitle() override; |
| 330 void SetManageText() override; | 336 void SetManageText() override; |
| 337 void OnChecked(bool is_checked) override; | |
| 338 ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() | |
| 339 override; | |
| 340 void OnDoneClicked() override; | |
| 341 | |
| 342 bool is_checked_ = false; | |
| 331 | 343 |
| 332 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); | 344 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); |
| 333 }; | 345 }; |
| 334 | 346 |
| 335 // The model of the content settings bubble for media settings. | 347 // The model of the content settings bubble for media settings. |
| 336 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { | 348 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { |
| 337 public: | 349 public: |
| 338 ContentSettingMediaStreamBubbleModel(Delegate* delegate, | 350 ContentSettingMediaStreamBubbleModel(Delegate* delegate, |
| 339 content::WebContents* web_contents, | 351 content::WebContents* web_contents, |
| 340 Profile* profile); | 352 Profile* profile); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 void SetTitle() override; | 419 void SetTitle() override; |
| 408 void SetManageText() override; | 420 void SetManageText() override; |
| 409 void OnManageLinkClicked() override; | 421 void OnManageLinkClicked() override; |
| 410 | 422 |
| 411 int selected_item_ = 0; | 423 int selected_item_ = 0; |
| 412 | 424 |
| 413 DISALLOW_COPY_AND_ASSIGN(ContentSettingDownloadsBubbleModel); | 425 DISALLOW_COPY_AND_ASSIGN(ContentSettingDownloadsBubbleModel); |
| 414 }; | 426 }; |
| 415 | 427 |
| 416 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 428 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
| OLD | NEW |