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

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

Issue 10823391: views: ContentSettingBubbleContents does not need to store a pointer to Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/content_setting_bubble_contents.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "chrome/common/content_settings_types.h" 12 #include "chrome/common/content_settings_types.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/views/bubble/bubble_delegate.h" 15 #include "ui/views/bubble/bubble_delegate.h"
16 #include "ui/views/controls/button/button.h" 16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/link_listener.h" 17 #include "ui/views/controls/link_listener.h"
18 18
19 // ContentSettingBubbleContents is used when the user turns on different kinds
20 // of content blocking (e.g. "block images"). When viewing a page with blocked
21 // content, icons appear in the omnibox corresponding to the content types that
22 // were blocked, and the user can click one to get a bubble hosting a few
23 // controls. This class provides the content of that bubble. In general,
24 // these bubbles typically have a title, a pair of radio buttons for toggling
25 // the blocking settings for the current site, a close button, and a link to
26 // get to a more comprehensive settings management dialog. A few types have
27 // more or fewer controls than this.
28
29 class ContentSettingBubbleModel; 19 class ContentSettingBubbleModel;
30 class Profile;
31 20
32 namespace content { 21 namespace content {
33 class WebContents; 22 class WebContents;
34 } 23 }
35 24
36 namespace views { 25 namespace views {
37 class TextButton; 26 class TextButton;
38 class RadioButton; 27 class RadioButton;
39 } 28 }
40 29
30 // ContentSettingBubbleContents is used when the user turns on different kinds
31 // of content blocking (e.g. "block images"). When viewing a page with blocked
32 // content, icons appear in the omnibox corresponding to the content types that
33 // were blocked, and the user can click one to get a bubble hosting a few
34 // controls. This class provides the content of that bubble. In general,
35 // these bubbles typically have a title, a pair of radio buttons for toggling
36 // the blocking settings for the current site, a close button, and a link to
37 // get to a more comprehensive settings management dialog. A few types have
38 // more or fewer controls than this.
41 class ContentSettingBubbleContents : public views::BubbleDelegateView, 39 class ContentSettingBubbleContents : public views::BubbleDelegateView,
42 public views::ButtonListener, 40 public views::ButtonListener,
43 public views::LinkListener, 41 public views::LinkListener,
44 public content::NotificationObserver { 42 public content::NotificationObserver {
45 public: 43 public:
46 ContentSettingBubbleContents( 44 ContentSettingBubbleContents(
47 ContentSettingBubbleModel* content_setting_bubble_model, 45 ContentSettingBubbleModel* content_setting_bubble_model,
48 Profile* profile,
49 content::WebContents* web_contents, 46 content::WebContents* web_contents,
50 views::View* anchor_view, 47 views::View* anchor_view,
51 views::BubbleBorder::ArrowLocation arrow_location); 48 views::BubbleBorder::ArrowLocation arrow_location);
52 virtual ~ContentSettingBubbleContents(); 49 virtual ~ContentSettingBubbleContents();
53 50
54 virtual gfx::Size GetPreferredSize() OVERRIDE; 51 virtual gfx::Size GetPreferredSize() OVERRIDE;
55 52
56 // views::BubbleDelegateView: 53 // views::BubbleDelegateView:
57 virtual gfx::Rect GetAnchorRect() OVERRIDE; 54 virtual gfx::Rect GetAnchorRect() OVERRIDE;
58 55
(...skipping 14 matching lines...) Expand all
73 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 70 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
74 71
75 // content::NotificationObserver: 72 // content::NotificationObserver:
76 virtual void Observe(int type, 73 virtual void Observe(int type,
77 const content::NotificationSource& source, 74 const content::NotificationSource& source,
78 const content::NotificationDetails& details) OVERRIDE; 75 const content::NotificationDetails& details) OVERRIDE;
79 76
80 // Provides data for this bubble. 77 // Provides data for this bubble.
81 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model_; 78 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model_;
82 79
83 // The active profile.
84 Profile* profile_;
85
86 // The active web contents. 80 // The active web contents.
87 content::WebContents* web_contents_; 81 content::WebContents* web_contents_;
88 82
89 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. 83 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications.
90 content::NotificationRegistrar registrar_; 84 content::NotificationRegistrar registrar_;
91 85
92 // Some of our controls, so we can tell what's been clicked when we get a 86 // Some of our controls, so we can tell what's been clicked when we get a
93 // message. 87 // message.
94 PopupLinks popup_links_; 88 PopupLinks popup_links_;
95 typedef std::vector<views::RadioButton*> RadioGroup; 89 typedef std::vector<views::RadioButton*> RadioGroup;
96 RadioGroup radio_group_; 90 RadioGroup radio_group_;
97 views::Link* custom_link_; 91 views::Link* custom_link_;
98 views::Link* manage_link_; 92 views::Link* manage_link_;
99 views::TextButton* close_button_; 93 views::TextButton* close_button_;
100 94
101 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents); 95 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingBubbleContents);
102 }; 96 };
103 97
104 #endif // CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_ 98 #endif // CHROME_BROWSER_UI_VIEWS_CONTENT_SETTING_BUBBLE_CONTENTS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/content_setting_bubble_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698