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

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

Issue 149681: GTK Themes: Make the omnibox area look more native. (Closed)
Patch Set: Change names for Dean 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
« no previous file with comments | « chrome/browser/gtk/browser_toolbar_gtk.cc ('k') | chrome/browser/gtk/go_button_gtk.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_GTK_GO_BUTTON_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_GO_BUTTON_GTK_H_
6 #define CHROME_BROWSER_GTK_GO_BUTTON_GTK_H_ 6 #define CHROME_BROWSER_GTK_GO_BUTTON_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/task.h" 11 #include "base/task.h"
12 #include "chrome/browser/gtk/custom_button.h" 12 #include "chrome/browser/gtk/custom_button.h"
13 #include "chrome/common/notification_observer.h"
14 #include "chrome/common/notification_registrar.h"
13 #include "chrome/common/owned_widget_gtk.h" 15 #include "chrome/common/owned_widget_gtk.h"
14 16
15 class Browser; 17 class Browser;
18 class GtkThemeProvider;
16 class LocationBarViewGtk; 19 class LocationBarViewGtk;
17 class Task; 20 class Task;
18 21
19 class GoButtonGtk { 22 class GoButtonGtk : public NotificationObserver {
20 public: 23 public:
21 enum Mode { MODE_GO = 0, MODE_STOP }; 24 enum Mode { MODE_GO = 0, MODE_STOP };
22 enum ButtonState { BS_NORMAL = 0, BS_HOT }; 25 enum ButtonState { BS_NORMAL = 0, BS_HOT };
23 26
24 GoButtonGtk(LocationBarViewGtk* location_bar, Browser* browser); 27 GoButtonGtk(LocationBarViewGtk* location_bar, Browser* browser);
25 ~GoButtonGtk(); 28 ~GoButtonGtk();
26 29
27 GtkWidget* widget() const { return widget_.get(); } 30 GtkWidget* widget() const { return widget_.get(); }
28 ButtonState state() const { return state_; } 31 ButtonState state() const { return state_; }
29 32
30 // Ask for a specified button state. If |force| is true this will be applied 33 // Ask for a specified button state. If |force| is true this will be applied
31 // immediately. 34 // immediately.
32 void ChangeMode(Mode mode, bool force); 35 void ChangeMode(Mode mode, bool force);
33 36
37 // Provide NotificationObserver implementation.
38 virtual void Observe(NotificationType type,
39 const NotificationSource& source,
40 const NotificationDetails& details);
41
34 private: 42 private:
35 friend class GoButtonGtkPeer; 43 friend class GoButtonGtkPeer;
36 44
37 // gtk signals 45 // gtk signals
38 static gboolean OnExpose(GtkWidget* widget, 46 static gboolean OnExpose(GtkWidget* widget,
39 GdkEventExpose* e, 47 GdkEventExpose* e,
40 GoButtonGtk* button); 48 GoButtonGtk* button);
41 static gboolean OnEnter(GtkButton* widget, GoButtonGtk* button); 49 static gboolean OnEnter(GtkButton* widget, GoButtonGtk* button);
42 static gboolean OnLeave(GtkButton* widget, GoButtonGtk* button); 50 static gboolean OnLeave(GtkButton* widget, GoButtonGtk* button);
43 static gboolean OnClicked(GtkButton* widget, GoButtonGtk* button); 51 static gboolean OnClicked(GtkButton* widget, GoButtonGtk* button);
44 52
45 void SetToggled(); 53 void SetToggled();
46 54
47 Task* CreateButtonTimerTask(); 55 Task* CreateButtonTimerTask();
48 void OnButtonTimer(); 56 void OnButtonTimer();
49 void SetTooltip(); 57 void SetTooltip();
58 void UpdateThemeButtons();
59
60 // Used to listen for theme change notifications.
61 NotificationRegistrar registrar_;
50 62
51 LocationBarViewGtk* const location_bar_; 63 LocationBarViewGtk* const location_bar_;
52 64
53 // Keep a pointer to the Browser object to execute commands on it. 65 // Keep a pointer to the Browser object to execute commands on it.
54 Browser* const browser_; 66 Browser* const browser_;
55 67
56 // Delay time to wait before allowing a mode change. This is to prevent a 68 // Delay time to wait before allowing a mode change. This is to prevent a
57 // mode switch while the user is double clicking. 69 // mode switch while the user is double clicking.
58 int button_delay_; 70 int button_delay_;
59 ScopedRunnableMethodFactory<GoButtonGtk> stop_timer_; 71 ScopedRunnableMethodFactory<GoButtonGtk> stop_timer_;
60 72
61 // The mode we should be in 73 // The mode we should be in
62 Mode intended_mode_; 74 Mode intended_mode_;
63 75
64 // The currently-visible mode - this may different from the intended mode 76 // The currently-visible mode - this may different from the intended mode
65 Mode visible_mode_; 77 Mode visible_mode_;
66 78
67 ButtonState state_; 79 ButtonState state_;
68 80
81 GtkThemeProvider* theme_provider_;
82
69 CustomDrawButtonBase go_; 83 CustomDrawButtonBase go_;
70 CustomDrawButtonBase stop_; 84 CustomDrawButtonBase stop_;
71 85
72 OwnedWidgetGtk widget_; 86 OwnedWidgetGtk widget_;
73 87
74 DISALLOW_COPY_AND_ASSIGN(GoButtonGtk); 88 DISALLOW_COPY_AND_ASSIGN(GoButtonGtk);
75 }; 89 };
76 90
77 #endif // CHROME_BROWSER_GTK_GO_BUTTON_GTK_H_ 91 #endif // CHROME_BROWSER_GTK_GO_BUTTON_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_toolbar_gtk.cc ('k') | chrome/browser/gtk/go_button_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698