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

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.h

Issue 1870533002: Convert ContentSettingBubbleContents to a BubbleDialogDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mac views Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
6 #define CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/content_settings/core/common/content_settings_types.h" 12 #include "components/content_settings/core/common/content_settings_types.h"
13 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/common/media_stream_request.h" 14 #include "content/public/common/media_stream_request.h"
15 #include "ui/views/bubble/bubble_delegate.h" 15 #include "ui/views/bubble/bubble_dialog_delegate.h"
16 #include "ui/views/controls/button/button.h" 16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/button/menu_button_listener.h" 17 #include "ui/views/controls/button/menu_button_listener.h"
18 #include "ui/views/controls/link_listener.h" 18 #include "ui/views/controls/link_listener.h"
19 19
20 class ContentSettingBubbleModel; 20 class ContentSettingBubbleModel;
21 class ContentSettingMediaMenuModel; 21 class ContentSettingMediaMenuModel;
22 class Profile; 22 class Profile;
23 23
24 namespace chrome { 24 namespace chrome {
25 class ContentSettingBubbleViewsBridge; 25 class ContentSettingBubbleViewsBridge;
(...skipping 13 matching lines...) Expand all
39 // ContentSettingBubbleContents is used when the user turns on different kinds 39 // ContentSettingBubbleContents is used when the user turns on different kinds
40 // of content blocking (e.g. "block images"). When viewing a page with blocked 40 // of content blocking (e.g. "block images"). When viewing a page with blocked
41 // content, icons appear in the omnibox corresponding to the content types that 41 // content, icons appear in the omnibox corresponding to the content types that
42 // were blocked, and the user can click one to get a bubble hosting a few 42 // were blocked, and the user can click one to get a bubble hosting a few
43 // controls. This class provides the content of that bubble. In general, 43 // controls. This class provides the content of that bubble. In general,
44 // these bubbles typically have a title, a pair of radio buttons for toggling 44 // these bubbles typically have a title, a pair of radio buttons for toggling
45 // the blocking settings for the current site, a close button, and a link to 45 // the blocking settings for the current site, a close button, and a link to
46 // get to a more comprehensive settings management dialog. A few types have 46 // get to a more comprehensive settings management dialog. A few types have
47 // more or fewer controls than this. 47 // more or fewer controls than this.
48 class ContentSettingBubbleContents : public content::WebContentsObserver, 48 class ContentSettingBubbleContents : public content::WebContentsObserver,
49 public views::BubbleDelegateView, 49 public views::BubbleDialogDelegateView,
50 public views::ButtonListener, 50 public views::ButtonListener,
51 public views::LinkListener, 51 public views::LinkListener,
52 public views::MenuButtonListener { 52 public views::MenuButtonListener {
53 public: 53 public:
54 ContentSettingBubbleContents( 54 ContentSettingBubbleContents(
55 ContentSettingBubbleModel* content_setting_bubble_model, 55 ContentSettingBubbleModel* content_setting_bubble_model,
56 content::WebContents* web_contents, 56 content::WebContents* web_contents,
57 views::View* anchor_view, 57 views::View* anchor_view,
58 views::BubbleBorder::Arrow arrow); 58 views::BubbleBorder::Arrow arrow);
59 ~ContentSettingBubbleContents() override; 59 ~ContentSettingBubbleContents() override;
60 60
61 gfx::Size GetPreferredSize() const override; 61 gfx::Size GetPreferredSize() const override;
62 62
63 // Callback to allow ContentSettingMediaMenuModel to update the menu label. 63 // Callback to allow ContentSettingMediaMenuModel to update the menu label.
64 void UpdateMenuLabel(content::MediaStreamType type, 64 void UpdateMenuLabel(content::MediaStreamType type,
65 const std::string& label); 65 const std::string& label);
66 66
67 protected: 67 protected:
68 // views::BubbleDelegateView: 68 // views::BubbleDialogDelegateView:
69 void Init() override; 69 void Init() override;
70 View* CreateExtraView() override;
71 int GetDialogButtons() const override;
72 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
70 73
71 private: 74 private:
72 class Favicon; 75 class Favicon;
73 struct MediaMenuParts; 76 struct MediaMenuParts;
74 77
75 // This allows ContentSettingBubbleViewsBridge to call SetAnchorRect(). 78 // This allows ContentSettingBubbleViewsBridge to call SetAnchorRect().
76 friend class chrome::ContentSettingBubbleViewsBridge; 79 friend class chrome::ContentSettingBubbleViewsBridge;
77 80
78 typedef std::map<views::Link*, int> ListItemLinks; 81 typedef std::map<views::Link*, int> ListItemLinks;
79 typedef std::map<views::MenuButton*, MediaMenuParts*> MediaMenuPartsMap; 82 typedef std::map<views::MenuButton*, MediaMenuParts*> MediaMenuPartsMap;
(...skipping 29 matching lines...) Expand all
109 views::Link* manage_link_; 112 views::Link* manage_link_;
110 views::Link* learn_more_link_; 113 views::Link* learn_more_link_;
111 views::LabelButton* close_button_; 114 views::LabelButton* close_button_;
112 scoped_ptr<views::MenuRunner> menu_runner_; 115 scoped_ptr<views::MenuRunner> menu_runner_;
113 MediaMenuPartsMap media_menus_; 116 MediaMenuPartsMap media_menus_;
114 117
115 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents); 118 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents);
116 }; 119 };
117 120
118 #endif // CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ 121 #endif // CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_dialogs_views_mac.cc ('k') | chrome/browser/ui/views/content_setting_bubble_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698