| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 class ContentSettingBubbleModelDelegate; | 27 class ContentSettingBubbleModelDelegate; |
| 28 class Profile; | 28 class Profile; |
| 29 class ProtocolHandlerRegistry; | 29 class ProtocolHandlerRegistry; |
| 30 | 30 |
| 31 namespace content { | 31 namespace content { |
| 32 class WebContents; | 32 class WebContents; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace rappor { | 35 namespace rappor { |
| 36 class RapporService; | 36 class RapporServiceImpl; |
| 37 } | 37 } |
| 38 | 38 |
| 39 // The hierarchy of bubble models: | 39 // The hierarchy of bubble models: |
| 40 // | 40 // |
| 41 // ContentSettingsBubbleModel - base class | 41 // ContentSettingsBubbleModel - base class |
| 42 // ContentSettingMediaStreamBubbleModel - media (camera and mic) | 42 // ContentSettingMediaStreamBubbleModel - media (camera and mic) |
| 43 // ContentSettingSimpleBubbleModel - single content setting | 43 // ContentSettingSimpleBubbleModel - single content setting |
| 44 // ContentSettingMixedScriptBubbleModel - mixed script | 44 // ContentSettingMixedScriptBubbleModel - mixed script |
| 45 // ContentSettingRPHBubbleModel - protocol handlers | 45 // ContentSettingRPHBubbleModel - protocol handlers |
| 46 // ContentSettingMidiSysExBubbleModel - midi sysex | 46 // ContentSettingMidiSysExBubbleModel - midi sysex |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // Cast this bubble into ContentSettingMediaStreamBubbleModel if possible. | 170 // Cast this bubble into ContentSettingMediaStreamBubbleModel if possible. |
| 171 virtual ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel(); | 171 virtual ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel(); |
| 172 | 172 |
| 173 // Cast this bubble into ContentSettingSubresourceFilterBubbleModel | 173 // Cast this bubble into ContentSettingSubresourceFilterBubbleModel |
| 174 // if possible. | 174 // if possible. |
| 175 virtual ContentSettingSubresourceFilterBubbleModel* | 175 virtual ContentSettingSubresourceFilterBubbleModel* |
| 176 AsSubresourceFilterBubbleModel(); | 176 AsSubresourceFilterBubbleModel(); |
| 177 | 177 |
| 178 // Sets the Rappor service used for testing. | 178 // Sets the Rappor service used for testing. |
| 179 void SetRapporServiceForTesting(rappor::RapporService* rappor_service) { | 179 void SetRapporServiceImplForTesting( |
| 180 rappor::RapporServiceImpl* rappor_service) { |
| 180 rappor_service_ = rappor_service; | 181 rappor_service_ = rappor_service; |
| 181 } | 182 } |
| 182 | 183 |
| 183 protected: | 184 protected: |
| 184 ContentSettingBubbleModel( | 185 ContentSettingBubbleModel( |
| 185 Delegate* delegate, | 186 Delegate* delegate, |
| 186 content::WebContents* web_contents, | 187 content::WebContents* web_contents, |
| 187 Profile* profile); | 188 Profile* profile); |
| 188 | 189 |
| 189 content::WebContents* web_contents() const { return web_contents_; } | 190 content::WebContents* web_contents() const { return web_contents_; } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 227 } |
| 227 void set_selected_device(const content::MediaStreamDevice& device) { | 228 void set_selected_device(const content::MediaStreamDevice& device) { |
| 228 bubble_content_.media_menus[device.type].selected_device = device; | 229 bubble_content_.media_menus[device.type].selected_device = device; |
| 229 } | 230 } |
| 230 bool setting_is_managed() { | 231 bool setting_is_managed() { |
| 231 return setting_is_managed_; | 232 return setting_is_managed_; |
| 232 } | 233 } |
| 233 void set_setting_is_managed(bool managed) { | 234 void set_setting_is_managed(bool managed) { |
| 234 setting_is_managed_ = managed; | 235 setting_is_managed_ = managed; |
| 235 } | 236 } |
| 236 rappor::RapporService* rappor_service() const { return rappor_service_; } | 237 rappor::RapporServiceImpl* rappor_service() const { return rappor_service_; } |
| 237 | 238 |
| 238 private: | 239 private: |
| 239 virtual void SetTitle() = 0; | 240 virtual void SetTitle() = 0; |
| 240 virtual void SetManageText() = 0; | 241 virtual void SetManageText() = 0; |
| 241 | 242 |
| 242 content::WebContents* web_contents_; | 243 content::WebContents* web_contents_; |
| 243 Profile* profile_; | 244 Profile* profile_; |
| 244 Delegate* delegate_; | 245 Delegate* delegate_; |
| 245 BubbleContent bubble_content_; | 246 BubbleContent bubble_content_; |
| 246 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. | 247 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. |
| 247 content::NotificationRegistrar registrar_; | 248 content::NotificationRegistrar registrar_; |
| 248 // A flag that indicates if the content setting managed i.e. can't be | 249 // A flag that indicates if the content setting managed i.e. can't be |
| 249 // controlled by the user. | 250 // controlled by the user. |
| 250 bool setting_is_managed_; | 251 bool setting_is_managed_; |
| 251 // The service used to record Rappor metrics. Can be set for testing. | 252 // The service used to record Rappor metrics. Can be set for testing. |
| 252 rappor::RapporService* rappor_service_; | 253 rappor::RapporServiceImpl* rappor_service_; |
| 253 | 254 |
| 254 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); | 255 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); |
| 255 }; | 256 }; |
| 256 | 257 |
| 257 // A generic bubble used for a single content setting. | 258 // A generic bubble used for a single content setting. |
| 258 class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel { | 259 class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel { |
| 259 public: | 260 public: |
| 260 ContentSettingSimpleBubbleModel(Delegate* delegate, | 261 ContentSettingSimpleBubbleModel(Delegate* delegate, |
| 261 content::WebContents* web_contents, | 262 content::WebContents* web_contents, |
| 262 Profile* profile, | 263 Profile* profile, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // The content settings that are associated with the individual radio | 384 // The content settings that are associated with the individual radio |
| 384 // buttons. | 385 // buttons. |
| 385 ContentSetting radio_item_setting_[2]; | 386 ContentSetting radio_item_setting_[2]; |
| 386 // The state of the microphone and camera access. | 387 // The state of the microphone and camera access. |
| 387 TabSpecificContentSettings::MicrophoneCameraState state_; | 388 TabSpecificContentSettings::MicrophoneCameraState state_; |
| 388 | 389 |
| 389 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); | 390 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); |
| 390 }; | 391 }; |
| 391 | 392 |
| 392 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 393 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
| OLD | NEW |