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