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

Side by Side Diff: chrome/browser/gtk/blocked_popup_container_view_gtk.h

Issue 155860: GTK: Popup notification is readable with dark themes in chrome theme mode. (Closed)
Patch Set: Created 11 years, 5 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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_
6 #define CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ 6 #define CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "chrome/browser/blocked_popup_container.h" 12 #include "chrome/browser/blocked_popup_container.h"
13 #include "chrome/browser/gtk/menu_gtk.h" 13 #include "chrome/browser/gtk/menu_gtk.h"
14 #include "chrome/common/notification_observer.h"
15 #include "chrome/common/notification_registrar.h"
14 #include "chrome/common/owned_widget_gtk.h" 16 #include "chrome/common/owned_widget_gtk.h"
15 17
16 class BlockedPopupContainerInternalView; 18 class BlockedPopupContainerInternalView;
17 class CustomDrawButton; 19 class CustomDrawButton;
18 class GtkThemeProvider; 20 class GtkThemeProvider;
19 class MenuGtk; 21 class MenuGtk;
22 class NotificationObserver;
20 class PrefService; 23 class PrefService;
21 class Profile; 24 class Profile;
22 class TabContents; 25 class TabContents;
23 class TabContentsViewGtk; 26 class TabContentsViewGtk;
24 class TextButton; 27 class TextButton;
25 28
26 namespace views { 29 namespace views {
27 class ImageButton; 30 class ImageButton;
28 } 31 }
29 32
30 // The GTK blocked popup container notification. 33 // The GTK blocked popup container notification.
31 class BlockedPopupContainerViewGtk : public BlockedPopupContainerView, 34 class BlockedPopupContainerViewGtk : public BlockedPopupContainerView,
35 public NotificationObserver,
32 public MenuGtk::Delegate { 36 public MenuGtk::Delegate {
33 public: 37 public:
34 virtual ~BlockedPopupContainerViewGtk(); 38 virtual ~BlockedPopupContainerViewGtk();
35 39
36 // Returns the Gtk view that currently owns us. 40 // Returns the Gtk view that currently owns us.
37 TabContentsViewGtk* ContainingView(); 41 TabContentsViewGtk* ContainingView();
38 42
39 // Returns the URL and title for popup |index|, used to construct a string for 43 // Returns the URL and title for popup |index|, used to construct a string for
40 // display. 44 // display.
41 void GetURLAndTitleForPopup(size_t index, 45 void GetURLAndTitleForPopup(size_t index,
42 string16* url, 46 string16* url,
43 string16* title) const; 47 string16* title) const;
44 48
45 GtkWidget* widget() { return container_.get(); } 49 GtkWidget* widget() { return container_.get(); }
46 50
47 // Overridden from BlockedPopupContainerView: 51 // Overridden from BlockedPopupContainerView:
48 virtual void SetPosition(); 52 virtual void SetPosition();
49 virtual void ShowView(); 53 virtual void ShowView();
50 virtual void UpdateLabel(); 54 virtual void UpdateLabel();
51 virtual void HideView(); 55 virtual void HideView();
52 virtual void Destroy(); 56 virtual void Destroy();
53 57
58 // Overridden from NotificationObserver:
59 virtual void Observe(NotificationType type,
60 const NotificationSource& source,
61 const NotificationDetails& details);
62
54 // Overridden from MenuGtk::Delegate: 63 // Overridden from MenuGtk::Delegate:
55 virtual bool IsCommandEnabled(int command_id) const; 64 virtual bool IsCommandEnabled(int command_id) const;
56 virtual bool IsItemChecked(int command_id) const; 65 virtual bool IsItemChecked(int command_id) const;
57 virtual void ExecuteCommand(int command_id); 66 virtual void ExecuteCommand(int command_id);
58 67
59 private: 68 private:
60 // For the static constructor BlockedPopupContainerView::Create(). 69 // For the static constructor BlockedPopupContainerView::Create().
61 friend class BlockedPopupContainerView; 70 friend class BlockedPopupContainerView;
62 71
63 // Creates a container for a certain TabContents. 72 // Creates a container for a certain TabContents.
64 explicit BlockedPopupContainerViewGtk(BlockedPopupContainer* container); 73 explicit BlockedPopupContainerViewGtk(BlockedPopupContainer* container);
65 74
66 // Builds all the messy GTK stuff. 75 // Builds all the messy GTK stuff.
67 void Init(); 76 void Init();
68 77
69 // Callbacks for the two buttons in the notification 78 // Callbacks for the two buttons in the notification
70 static void OnMenuButtonClicked(GtkButton *button, 79 static void OnMenuButtonClicked(GtkButton *button,
71 BlockedPopupContainerViewGtk* container); 80 BlockedPopupContainerViewGtk* container);
72 static void OnCloseButtonClicked(GtkButton *button, 81 static void OnCloseButtonClicked(GtkButton *button,
73 BlockedPopupContainerViewGtk* container); 82 BlockedPopupContainerViewGtk* container);
74 83
75 // Draws |container_| with a custom background. 84 // Draws |container_| with a custom background.
76 static gboolean OnContainerExpose(GtkWidget* widget, GdkEventExpose* event, 85 static gboolean OnContainerExpose(GtkWidget* widget, GdkEventExpose* event,
77 BlockedPopupContainerViewGtk* container); 86 BlockedPopupContainerViewGtk* container);
78 87
88 NotificationRegistrar registrar_;
89
79 // Our model; calling the shots. 90 // Our model; calling the shots.
80 BlockedPopupContainer* model_; 91 BlockedPopupContainer* model_;
81 92
82 // The top level of our local GTK hierarchy. 93 // The top level of our local GTK hierarchy.
83 OwnedWidgetGtk container_; 94 OwnedWidgetGtk container_;
84 95
85 // The "Blocked Popups: XXX" button. 96 // The "Blocked Popups: XXX" button.
86 GtkWidget* menu_button_; 97 GtkWidget* menu_button_;
87 98
88 // Our theme provider. 99 // Our theme provider.
89 GtkThemeProvider* theme_provider_; 100 GtkThemeProvider* theme_provider_;
90 101
91 // Closes the container. 102 // Closes the container.
92 scoped_ptr<CustomDrawButton> close_button_; 103 scoped_ptr<CustomDrawButton> close_button_;
93 104
94 // The popup menu with options to launch blocked popups. 105 // The popup menu with options to launch blocked popups.
95 scoped_ptr<MenuGtk> launch_menu_; 106 scoped_ptr<MenuGtk> launch_menu_;
96 107
97 DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewGtk); 108 DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewGtk);
98 }; 109 };
99 110
100 #endif // CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ 111 #endif // CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698