Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1393)

Unified Diff: chrome/browser/ui/views/content_setting_bubble_contents.h

Issue 12208010: Adding device selection menus to the content setting bubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some more cleanup and ready for review. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/content_setting_bubble_contents.h
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.h b/chrome/browser/ui/views/content_setting_bubble_contents.h
index 9960246fb3dea94f0d4ad8da114ef9500e42de61..811d347df48e614ba8b7e9dbc84308e3badff2f1 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.h
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.h
@@ -9,20 +9,25 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "chrome/browser/ui/content_settings/content_setting_media_menu_model.h"
#include "chrome/common/content_settings_types.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
+#include "ui/views/controls/button/menu_button_listener.h"
#include "ui/views/controls/link_listener.h"
class ContentSettingBubbleModel;
+class Profile;
namespace content {
class WebContents;
}
namespace views {
+class MenuButton;
+class MenuRunner;
class TextButton;
class RadioButton;
}
@@ -36,13 +41,17 @@ class RadioButton;
// the blocking settings for the current site, a close button, and a link to
// get to a more comprehensive settings management dialog. A few types have
// more or fewer controls than this.
-class ContentSettingBubbleContents : public views::BubbleDelegateView,
- public views::ButtonListener,
- public views::LinkListener,
- public content::NotificationObserver {
+class ContentSettingBubbleContents
+ : public views::BubbleDelegateView,
+ public views::ButtonListener,
+ public views::LinkListener,
+ public views::MenuButtonListener,
+ public content::NotificationObserver,
+ public ContentSettingMediaMenuModel::Observer {
public:
ContentSettingBubbleContents(
ContentSettingBubbleModel* content_setting_bubble_model,
+ Profile* profile,
content::WebContents* web_contents,
views::View* anchor_view,
views::BubbleBorder::ArrowLocation arrow_location);
@@ -50,6 +59,10 @@ class ContentSettingBubbleContents : public views::BubbleDelegateView,
virtual gfx::Size GetPreferredSize() OVERRIDE;
+ // ContentSettingMediaMenuModel::Observer implementation.
+ virtual void UpdateMenuLabel(content::MediaStreamType type,
+ const std::string& label) OVERRIDE;
+
protected:
// views::BubbleDelegateView:
virtual void Init() OVERRIDE;
@@ -59,6 +72,20 @@ class ContentSettingBubbleContents : public views::BubbleDelegateView,
typedef std::map<views::Link*, int> PopupLinks;
+ // A map from a views::MenuButton* to a MediaMenuView*. MediaMenuView struct
markusheintz_ 2013/02/06 11:03:26 Since the map is defined in line 87 either move th
no longer working on chromium 2013/02/06 13:31:52 Done.
+ // is used to store the UI members that a media menu owns.
+ struct MediaMenuView {
markusheintz_ 2013/02/06 11:03:26 The suffix "View" is a bit misleading here, since
no longer working on chromium 2013/02/06 13:31:52 Done.
+ MediaMenuView();
+ ~MediaMenuView();
+
+ content::MediaStreamType type;
+ scoped_ptr<ui::SimpleMenuModel> menu_model;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MediaMenuView);
+ };
+ typedef std::map<views::MenuButton*, MediaMenuView*> MediaMenuViewMap;
+
// views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
@@ -66,6 +93,10 @@ class ContentSettingBubbleContents : public views::BubbleDelegateView,
// views::LinkListener:
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
+ // views::MenuButtonListener interface.
+ virtual void OnMenuButtonClicked(views::View* source,
+ const gfx::Point& point) OVERRIDE;
+
// content::NotificationObserver:
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -74,6 +105,9 @@ class ContentSettingBubbleContents : public views::BubbleDelegateView,
// Provides data for this bubble.
scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model_;
+ // The active profile.
+ Profile* profile_;
+
// The active web contents.
content::WebContents* web_contents_;
@@ -88,6 +122,8 @@ class ContentSettingBubbleContents : public views::BubbleDelegateView,
views::Link* custom_link_;
views::Link* manage_link_;
views::TextButton* close_button_;
+ scoped_ptr<views::MenuRunner> menu_runner_;
+ MediaMenuViewMap media_menus_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents);
};

Powered by Google App Engine
This is Rietveld 408576698