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 <map> |
8 #include <set> | 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "chrome/common/content_settings.h" | 14 #include "chrome/common/content_settings.h" |
14 #include "chrome/common/custom_handlers/protocol_handler.h" | 15 #include "chrome/common/custom_handlers/protocol_handler.h" |
15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/common/media_stream_request.h" |
17 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
18 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
19 | 21 |
20 class ContentSettingBubbleModelDelegate; | 22 class ContentSettingBubbleModelDelegate; |
21 class Profile; | 23 class Profile; |
22 class ProtocolHandlerRegistry; | 24 class ProtocolHandlerRegistry; |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 class WebContents; | 27 class WebContents; |
26 } | 28 } |
(...skipping 23 matching lines...) Expand all Loading... |
50 }; | 52 }; |
51 | 53 |
52 struct DomainList { | 54 struct DomainList { |
53 DomainList(); | 55 DomainList(); |
54 ~DomainList(); | 56 ~DomainList(); |
55 | 57 |
56 std::string title; | 58 std::string title; |
57 std::set<std::string> hosts; | 59 std::set<std::string> hosts; |
58 }; | 60 }; |
59 | 61 |
| 62 struct MediaMenu { |
| 63 std::string label; |
| 64 content::MediaStreamDevice default_device; |
| 65 content::MediaStreamDevice selected_device; |
| 66 }; |
| 67 typedef std::map<content::MediaStreamType, MediaMenu> MediaMenuMap; |
| 68 |
60 struct BubbleContent { | 69 struct BubbleContent { |
61 BubbleContent(); | 70 BubbleContent(); |
62 ~BubbleContent(); | 71 ~BubbleContent(); |
63 | 72 |
64 std::string title; | 73 std::string title; |
65 PopupItems popup_items; | 74 PopupItems popup_items; |
66 RadioGroup radio_group; | 75 RadioGroup radio_group; |
67 bool radio_group_enabled; | 76 bool radio_group_enabled; |
68 std::vector<DomainList> domain_lists; | 77 std::vector<DomainList> domain_lists; |
69 std::set<std::string> resource_identifiers; | 78 std::set<std::string> resource_identifiers; |
70 std::string custom_link; | 79 std::string custom_link; |
71 bool custom_link_enabled; | 80 bool custom_link_enabled; |
72 std::string manage_link; | 81 std::string manage_link; |
| 82 MediaMenuMap media_menus; |
73 | 83 |
74 private: | 84 private: |
75 DISALLOW_COPY_AND_ASSIGN(BubbleContent); | 85 DISALLOW_COPY_AND_ASSIGN(BubbleContent); |
76 }; | 86 }; |
77 | 87 |
78 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( | 88 static ContentSettingBubbleModel* CreateContentSettingBubbleModel( |
79 Delegate* delegate, | 89 Delegate* delegate, |
80 content::WebContents* web_contents, | 90 content::WebContents* web_contents, |
81 Profile* profile, | 91 Profile* profile, |
82 ContentSettingsType content_type); | 92 ContentSettingsType content_type); |
83 | 93 |
84 virtual ~ContentSettingBubbleModel(); | 94 virtual ~ContentSettingBubbleModel(); |
85 | 95 |
86 ContentSettingsType content_type() const { return content_type_; } | 96 ContentSettingsType content_type() const { return content_type_; } |
87 | 97 |
88 const BubbleContent& bubble_content() const { return bubble_content_; } | 98 const BubbleContent& bubble_content() const { return bubble_content_; } |
89 | 99 |
90 // content::NotificationObserver: | 100 // content::NotificationObserver: |
91 virtual void Observe(int type, | 101 virtual void Observe(int type, |
92 const content::NotificationSource& source, | 102 const content::NotificationSource& source, |
93 const content::NotificationDetails& details) OVERRIDE; | 103 const content::NotificationDetails& details) OVERRIDE; |
94 | 104 |
95 virtual void OnRadioClicked(int radio_index) {} | 105 virtual void OnRadioClicked(int radio_index) {} |
96 virtual void OnPopupClicked(int index) {} | 106 virtual void OnPopupClicked(int index) {} |
97 virtual void OnCustomLinkClicked() {} | 107 virtual void OnCustomLinkClicked() {} |
98 virtual void OnManageLinkClicked() {} | 108 virtual void OnManageLinkClicked() {} |
| 109 virtual void OnMediaMenuClicked(content::MediaStreamType type, |
| 110 const std::string& selected_device_id) {} |
99 | 111 |
100 // Called by the view code when the bubble is closed by the user using the | 112 // Called by the view code when the bubble is closed by the user using the |
101 // Done button. | 113 // Done button. |
102 virtual void OnDoneClicked() {} | 114 virtual void OnDoneClicked() {} |
103 | 115 |
104 protected: | 116 protected: |
105 ContentSettingBubbleModel( | 117 ContentSettingBubbleModel( |
106 content::WebContents* web_contents, | 118 content::WebContents* web_contents, |
107 Profile* profile, | 119 Profile* profile, |
108 ContentSettingsType content_type); | 120 ContentSettingsType content_type); |
(...skipping 16 matching lines...) Expand all Loading... |
125 } | 137 } |
126 void set_custom_link(const std::string& link) { | 138 void set_custom_link(const std::string& link) { |
127 bubble_content_.custom_link = link; | 139 bubble_content_.custom_link = link; |
128 } | 140 } |
129 void set_custom_link_enabled(bool enabled) { | 141 void set_custom_link_enabled(bool enabled) { |
130 bubble_content_.custom_link_enabled = enabled; | 142 bubble_content_.custom_link_enabled = enabled; |
131 } | 143 } |
132 void set_manage_link(const std::string& link) { | 144 void set_manage_link(const std::string& link) { |
133 bubble_content_.manage_link = link; | 145 bubble_content_.manage_link = link; |
134 } | 146 } |
| 147 void add_media_menu(content::MediaStreamType type, const MediaMenu& menu) { |
| 148 bubble_content_.media_menus[type] = menu; |
| 149 } |
| 150 void set_selected_device(const content::MediaStreamDevice& device) { |
| 151 bubble_content_.media_menus[device.type].selected_device = device; |
| 152 } |
135 void AddBlockedResource(const std::string& resource_identifier); | 153 void AddBlockedResource(const std::string& resource_identifier); |
136 | 154 |
137 private: | 155 private: |
138 content::WebContents* web_contents_; | 156 content::WebContents* web_contents_; |
139 Profile* profile_; | 157 Profile* profile_; |
140 ContentSettingsType content_type_; | 158 ContentSettingsType content_type_; |
141 BubbleContent bubble_content_; | 159 BubbleContent bubble_content_; |
142 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. | 160 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. |
143 content::NotificationRegistrar registrar_; | 161 content::NotificationRegistrar registrar_; |
144 | 162 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void IgnoreProtocolHandler(); | 206 void IgnoreProtocolHandler(); |
189 void ClearOrSetPreviousHandler(); | 207 void ClearOrSetPreviousHandler(); |
190 | 208 |
191 int selected_item_; | 209 int selected_item_; |
192 ProtocolHandlerRegistry* registry_; | 210 ProtocolHandlerRegistry* registry_; |
193 ProtocolHandler pending_handler_; | 211 ProtocolHandler pending_handler_; |
194 ProtocolHandler previous_handler_; | 212 ProtocolHandler previous_handler_; |
195 }; | 213 }; |
196 | 214 |
197 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 215 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
OLD | NEW |