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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 ~BubbleContent(); | 113 ~BubbleContent(); |
114 | 114 |
115 base::string16 title; | 115 base::string16 title; |
116 base::string16 message; | 116 base::string16 message; |
117 ListItems list_items; | 117 ListItems list_items; |
118 RadioGroup radio_group; | 118 RadioGroup radio_group; |
119 bool radio_group_enabled; | 119 bool radio_group_enabled; |
120 std::vector<DomainList> domain_lists; | 120 std::vector<DomainList> domain_lists; |
121 std::string custom_link; | 121 std::string custom_link; |
122 bool custom_link_enabled; | 122 bool custom_link_enabled; |
123 std::string manage_link; | 123 std::string manage_text; |
| 124 bool show_manage_text_as_button; |
124 MediaMenuMap media_menus; | 125 MediaMenuMap media_menus; |
125 std::string learn_more_link; | 126 std::string learn_more_link; |
126 | 127 |
127 private: | 128 private: |
128 DISALLOW_COPY_AND_ASSIGN(BubbleContent); | 129 DISALLOW_COPY_AND_ASSIGN(BubbleContent); |
129 }; | 130 }; |
130 | 131 |
131 // Creates a bubble model for a particular |content_type|. Note that not all | 132 // Creates a bubble model for a particular |content_type|. Note that not all |
132 // bubbles fit this description. | 133 // bubbles fit this description. |
133 // TODO(msramek): Move this to ContentSettingSimpleBubbleModel or remove | 134 // TODO(msramek): Move this to ContentSettingSimpleBubbleModel or remove |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 205 } |
205 void add_domain_list(const DomainList& domain_list) { | 206 void add_domain_list(const DomainList& domain_list) { |
206 bubble_content_.domain_lists.push_back(domain_list); | 207 bubble_content_.domain_lists.push_back(domain_list); |
207 } | 208 } |
208 void set_custom_link(const std::string& link) { | 209 void set_custom_link(const std::string& link) { |
209 bubble_content_.custom_link = link; | 210 bubble_content_.custom_link = link; |
210 } | 211 } |
211 void set_custom_link_enabled(bool enabled) { | 212 void set_custom_link_enabled(bool enabled) { |
212 bubble_content_.custom_link_enabled = enabled; | 213 bubble_content_.custom_link_enabled = enabled; |
213 } | 214 } |
214 void set_manage_link(const std::string& link) { | 215 void set_manage_text(const std::string& link) { |
215 bubble_content_.manage_link = link; | 216 bubble_content_.manage_text = link; |
| 217 } |
| 218 void set_show_manage_text_as_button(bool show_manage_text_as_button) { |
| 219 bubble_content_.show_manage_text_as_button = show_manage_text_as_button; |
216 } | 220 } |
217 void set_learn_more_link(const std::string& link) { | 221 void set_learn_more_link(const std::string& link) { |
218 bubble_content_.learn_more_link = link; | 222 bubble_content_.learn_more_link = link; |
219 } | 223 } |
220 void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { | 224 void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { |
221 bubble_content_.media_menus[type] = menu; | 225 bubble_content_.media_menus[type] = menu; |
222 } | 226 } |
223 void set_selected_device(const content::MediaStreamDevice& device) { | 227 void set_selected_device(const content::MediaStreamDevice& device) { |
224 bubble_content_.media_menus[device.type].selected_device = device; | 228 bubble_content_.media_menus[device.type].selected_device = device; |
225 } | 229 } |
226 bool setting_is_managed() { | 230 bool setting_is_managed() { |
227 return setting_is_managed_; | 231 return setting_is_managed_; |
228 } | 232 } |
229 void set_setting_is_managed(bool managed) { | 233 void set_setting_is_managed(bool managed) { |
230 setting_is_managed_ = managed; | 234 setting_is_managed_ = managed; |
231 } | 235 } |
232 rappor::RapporService* rappor_service() const { return rappor_service_; } | 236 rappor::RapporService* rappor_service() const { return rappor_service_; } |
233 | 237 |
234 private: | 238 private: |
235 virtual void SetTitle() = 0; | 239 virtual void SetTitle() = 0; |
236 virtual void SetManageLink() = 0; | 240 virtual void SetManageText() = 0; |
237 | 241 |
238 content::WebContents* web_contents_; | 242 content::WebContents* web_contents_; |
239 Profile* profile_; | 243 Profile* profile_; |
240 Delegate* delegate_; | 244 Delegate* delegate_; |
241 BubbleContent bubble_content_; | 245 BubbleContent bubble_content_; |
242 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. | 246 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. |
243 content::NotificationRegistrar registrar_; | 247 content::NotificationRegistrar registrar_; |
244 // A flag that indicates if the content setting managed i.e. can't be | 248 // A flag that indicates if the content setting managed i.e. can't be |
245 // controlled by the user. | 249 // controlled by the user. |
246 bool setting_is_managed_; | 250 bool setting_is_managed_; |
(...skipping 12 matching lines...) Expand all Loading... |
259 ContentSettingsType content_type); | 263 ContentSettingsType content_type); |
260 | 264 |
261 ContentSettingsType content_type() { return content_type_; } | 265 ContentSettingsType content_type() { return content_type_; } |
262 | 266 |
263 // ContentSettingBubbleModel implementation. | 267 // ContentSettingBubbleModel implementation. |
264 ContentSettingSimpleBubbleModel* AsSimpleBubbleModel() override; | 268 ContentSettingSimpleBubbleModel* AsSimpleBubbleModel() override; |
265 | 269 |
266 private: | 270 private: |
267 // ContentSettingBubbleModel implementation. | 271 // ContentSettingBubbleModel implementation. |
268 void SetTitle() override; | 272 void SetTitle() override; |
269 void SetManageLink() override; | 273 void SetManageText() override; |
270 void OnManageLinkClicked() override; | 274 void OnManageLinkClicked() override; |
271 void SetCustomLink(); | 275 void SetCustomLink(); |
272 void OnCustomLinkClicked() override; | 276 void OnCustomLinkClicked() override; |
273 | 277 |
274 ContentSettingsType content_type_; | 278 ContentSettingsType content_type_; |
275 | 279 |
276 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleBubbleModel); | 280 DISALLOW_COPY_AND_ASSIGN(ContentSettingSimpleBubbleModel); |
277 }; | 281 }; |
278 | 282 |
279 // RPH stands for Register Protocol Handler. | 283 // RPH stands for Register Protocol Handler. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 321 |
318 void OnManageLinkClicked() override; | 322 void OnManageLinkClicked() override; |
319 ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() | 323 ContentSettingSubresourceFilterBubbleModel* AsSubresourceFilterBubbleModel() |
320 override; | 324 override; |
321 | 325 |
322 private: | 326 private: |
323 void SetMessage(); | 327 void SetMessage(); |
324 | 328 |
325 // ContentSettingBubbleModel: | 329 // ContentSettingBubbleModel: |
326 void SetTitle() override; | 330 void SetTitle() override; |
327 void SetManageLink() override; | 331 void SetManageText() override; |
328 | 332 |
329 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); | 333 DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); |
330 }; | 334 }; |
331 | 335 |
332 // The model of the content settings bubble for media settings. | 336 // The model of the content settings bubble for media settings. |
333 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { | 337 class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { |
334 public: | 338 public: |
335 ContentSettingMediaStreamBubbleModel(Delegate* delegate, | 339 ContentSettingMediaStreamBubbleModel(Delegate* delegate, |
336 content::WebContents* web_contents, | 340 content::WebContents* web_contents, |
337 Profile* profile); | 341 Profile* profile); |
338 | 342 |
339 ~ContentSettingMediaStreamBubbleModel() override; | 343 ~ContentSettingMediaStreamBubbleModel() override; |
340 | 344 |
341 // ContentSettingBubbleModel: | 345 // ContentSettingBubbleModel: |
342 ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel() override; | 346 ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel() override; |
343 void OnManageLinkClicked() override; | 347 void OnManageLinkClicked() override; |
344 | 348 |
345 private: | 349 private: |
346 // Helper functions to check if this bubble was invoked for microphone, | 350 // Helper functions to check if this bubble was invoked for microphone, |
347 // camera, or both devices. | 351 // camera, or both devices. |
348 bool MicrophoneAccessed() const; | 352 bool MicrophoneAccessed() const; |
349 bool CameraAccessed() const; | 353 bool CameraAccessed() const; |
350 | 354 |
351 // ContentSettingBubbleModel: | 355 // ContentSettingBubbleModel: |
352 void SetTitle() override; | 356 void SetTitle() override; |
353 void SetManageLink() override; | 357 void SetManageText() override; |
354 | 358 |
355 // Sets the data for the radio buttons of the bubble. | 359 // Sets the data for the radio buttons of the bubble. |
356 void SetRadioGroup(); | 360 void SetRadioGroup(); |
357 | 361 |
358 // Sets the data for the media menus of the bubble. | 362 // Sets the data for the media menus of the bubble. |
359 void SetMediaMenus(); | 363 void SetMediaMenus(); |
360 | 364 |
361 // Sets the string that suggests reloading after the settings were changed. | 365 // Sets the string that suggests reloading after the settings were changed. |
362 void SetCustomLink(); | 366 void SetCustomLink(); |
363 | 367 |
(...skipping 15 matching lines...) Expand all Loading... |
379 // The content settings that are associated with the individual radio | 383 // The content settings that are associated with the individual radio |
380 // buttons. | 384 // buttons. |
381 ContentSetting radio_item_setting_[2]; | 385 ContentSetting radio_item_setting_[2]; |
382 // The state of the microphone and camera access. | 386 // The state of the microphone and camera access. |
383 TabSpecificContentSettings::MicrophoneCameraState state_; | 387 TabSpecificContentSettings::MicrophoneCameraState state_; |
384 | 388 |
385 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); | 389 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); |
386 }; | 390 }; |
387 | 391 |
388 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 392 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
OLD | NEW |