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

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: Used callback instead of inheriting from a virtual interface 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..2a6696720abe93e5a715429e4aba201c33ab3559 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.h
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.h
@@ -14,15 +14,20 @@
#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 ContentSettingMediaMenuModel;
+class Profile;
namespace content {
class WebContents;
}
namespace views {
+class MenuButton;
+class MenuRunner;
class TextButton;
class RadioButton;
}
@@ -36,13 +41,16 @@ 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:
ContentSettingBubbleContents(
ContentSettingBubbleModel* content_setting_bubble_model,
+ Profile* profile,
content::WebContents* web_contents,
views::View* anchor_view,
views::BubbleBorder::ArrowLocation arrow_location);
@@ -50,6 +58,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 +71,20 @@ class ContentSettingBubbleContents : public views::BubbleDelegateView,
typedef std::map<views::Link*, int> PopupLinks;
+ struct MediaMenuParts {
+ MediaMenuParts(content::MediaStreamType type);
+ ~MediaMenuParts();
+
+ content::MediaStreamType type;
+ scoped_ptr<ui::SimpleMenuModel> menu_model;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MediaMenuParts);
+ };
+ // A map from a views::MenuButton* to a MediaMenuParts*. MediaMenuParts struct
+ // is used to store the UI members that a media menu owns.
+ typedef std::map<views::MenuButton*, MediaMenuParts*> MediaMenuPartsMap;
+
// views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
@@ -66,6 +92,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 +104,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 +121,8 @@ class ContentSettingBubbleContents : public views::BubbleDelegateView,
views::Link* custom_link_;
views::Link* manage_link_;
views::TextButton* close_button_;
+ scoped_ptr<views::MenuRunner> menu_runner_;
+ MediaMenuPartsMap media_menus_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents);
};

Powered by Google App Engine
This is Rietveld 408576698