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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
47 // ContentSettingDomainListBubbleModel - domain list (geolocation) | 47 // ContentSettingDomainListBubbleModel - domain list (geolocation) |
48 // ContentSettingPluginBubbleModel - plugins | 48 // ContentSettingPluginBubbleModel - plugins |
49 // ContentSettingSingleRadioGroup - radio group | 49 // ContentSettingSingleRadioGroup - radio group |
50 // ContentSettingCookiesBubbleModel - cookies | 50 // ContentSettingCookiesBubbleModel - cookies |
51 // ContentSettingPopupBubbleModel - popups | 51 // ContentSettingPopupBubbleModel - popups |
52 // ContentSettingSubresourceFilterBubbleModel - filtered subresources | 52 // ContentSettingSubresourceFilterBubbleModel - filtered subresources |
| 53 // ContentSettingDownloadsBubbleModel - automatic downloads |
53 | 54 |
54 // Forward declaration necessary for downcasts. | 55 // Forward declaration necessary for downcasts. |
55 class ContentSettingMediaStreamBubbleModel; | 56 class ContentSettingMediaStreamBubbleModel; |
56 class ContentSettingSimpleBubbleModel; | 57 class ContentSettingSimpleBubbleModel; |
57 class ContentSettingSubresourceFilterBubbleModel; | 58 class ContentSettingSubresourceFilterBubbleModel; |
| 59 class ContentSettingDownloadsBubbleModel; |
58 | 60 |
59 // This model provides data for ContentSettingBubble, and also controls | 61 // This model provides data for ContentSettingBubble, and also controls |
60 // the action triggered when the allow / block radio buttons are triggered. | 62 // the action triggered when the allow / block radio buttons are triggered. |
61 class ContentSettingBubbleModel : public content::NotificationObserver { | 63 class ContentSettingBubbleModel : public content::NotificationObserver { |
62 public: | 64 public: |
63 typedef ContentSettingBubbleModelDelegate Delegate; | 65 typedef ContentSettingBubbleModelDelegate Delegate; |
64 | 66 |
65 struct ListItem { | 67 struct ListItem { |
66 ListItem(const gfx::Image& image, | 68 ListItem(const gfx::Image& image, |
67 const std::string& title, | 69 const std::string& title, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 virtual ContentSettingSimpleBubbleModel* AsSimpleBubbleModel(); | 170 virtual ContentSettingSimpleBubbleModel* AsSimpleBubbleModel(); |
169 | 171 |
170 // Cast this bubble into ContentSettingMediaStreamBubbleModel if possible. | 172 // Cast this bubble into ContentSettingMediaStreamBubbleModel if possible. |
171 virtual ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel(); | 173 virtual ContentSettingMediaStreamBubbleModel* AsMediaStreamBubbleModel(); |
172 | 174 |
173 // Cast this bubble into ContentSettingSubresourceFilterBubbleModel | 175 // Cast this bubble into ContentSettingSubresourceFilterBubbleModel |
174 // if possible. | 176 // if possible. |
175 virtual ContentSettingSubresourceFilterBubbleModel* | 177 virtual ContentSettingSubresourceFilterBubbleModel* |
176 AsSubresourceFilterBubbleModel(); | 178 AsSubresourceFilterBubbleModel(); |
177 | 179 |
| 180 // Cast this bubble into ContentSettingDownloadsBubbleModel if possible. |
| 181 virtual ContentSettingDownloadsBubbleModel* AsDownloadsBubbleModel(); |
| 182 |
178 // Sets the Rappor service used for testing. | 183 // Sets the Rappor service used for testing. |
179 void SetRapporServiceImplForTesting( | 184 void SetRapporServiceImplForTesting( |
180 rappor::RapporServiceImpl* rappor_service) { | 185 rappor::RapporServiceImpl* rappor_service) { |
181 rappor_service_ = rappor_service; | 186 rappor_service_ = rappor_service; |
182 } | 187 } |
183 | 188 |
184 static const int kAllowButtonIndex; | 189 static const int kAllowButtonIndex; |
185 | 190 |
186 protected: | 191 protected: |
187 ContentSettingBubbleModel( | 192 ContentSettingBubbleModel( |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 int selected_item_; | 381 int selected_item_; |
377 // The content settings that are associated with the individual radio | 382 // The content settings that are associated with the individual radio |
378 // buttons. | 383 // buttons. |
379 ContentSetting radio_item_setting_[2]; | 384 ContentSetting radio_item_setting_[2]; |
380 // The state of the microphone and camera access. | 385 // The state of the microphone and camera access. |
381 TabSpecificContentSettings::MicrophoneCameraState state_; | 386 TabSpecificContentSettings::MicrophoneCameraState state_; |
382 | 387 |
383 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); | 388 DISALLOW_COPY_AND_ASSIGN(ContentSettingMediaStreamBubbleModel); |
384 }; | 389 }; |
385 | 390 |
| 391 // The model for automatic downloads setting. |
| 392 class ContentSettingDownloadsBubbleModel : public ContentSettingBubbleModel { |
| 393 public: |
| 394 ContentSettingDownloadsBubbleModel(Delegate* delegate, |
| 395 content::WebContents* web_contents, |
| 396 Profile* profile); |
| 397 ~ContentSettingDownloadsBubbleModel() override; |
| 398 |
| 399 // ContentSettingBubbleModel overrides: |
| 400 ContentSettingDownloadsBubbleModel* AsDownloadsBubbleModel() override; |
| 401 |
| 402 private: |
| 403 void SetRadioGroup(); |
| 404 |
| 405 // ContentSettingBubbleModel overrides: |
| 406 void OnRadioClicked(int radio_index) override; |
| 407 void SetTitle() override; |
| 408 void SetManageText() override; |
| 409 void OnManageLinkClicked() override; |
| 410 |
| 411 int selected_item_ = 0; |
| 412 |
| 413 DISALLOW_COPY_AND_ASSIGN(ContentSettingDownloadsBubbleModel); |
| 414 }; |
| 415 |
386 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 416 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
OLD | NEW |