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

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

Issue 40013: Implement a GTK LocationBarView and Autocomplete. (Closed)
Patch Set: Feedback Created 11 years, 9 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/browser.scons ('k') | chrome/browser/gtk/browser_toolbar_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_BROWSER_TOOLBAR_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_
6 #define CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ 6 #define CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <string> 9 #include <string>
10 10
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "base/task.h" 12 #include "base/task.h"
13 #include "chrome/browser/command_updater.h" 13 #include "chrome/browser/command_updater.h"
14 #include "chrome/browser/gtk/menu_gtk.h" 14 #include "chrome/browser/gtk/menu_gtk.h"
15 #include "chrome/common/pref_member.h" 15 #include "chrome/common/pref_member.h"
16 16
17 class BackForwardMenuModelGtk; 17 class BackForwardMenuModelGtk;
18 class Browser; 18 class Browser;
19 class CustomContainerButton; 19 class CustomContainerButton;
20 class CustomDrawButton; 20 class CustomDrawButton;
21 class LocationBar; 21 class LocationBar;
22 class LocationBarViewGtk;
22 class Profile; 23 class Profile;
23 class TabContents; 24 class TabContents;
24 class ToolbarModel; 25 class ToolbarModel;
25 26
26 // View class that displays the GTK version of the toolbar and routes gtk 27 // View class that displays the GTK version of the toolbar and routes gtk
27 // events back to the Browser. 28 // events back to the Browser.
28 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, 29 class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
29 public MenuGtk::Delegate, 30 public MenuGtk::Delegate,
30 public NotificationObserver { 31 public NotificationObserver {
31 public: 32 public:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 int icon_id, 77 int icon_id,
77 const std::wstring& localized_tooltip); 78 const std::wstring& localized_tooltip);
78 79
79 // Adds a keyboard accelerator which trigers a button. (i.e., Ctrl+R is now 80 // Adds a keyboard accelerator which trigers a button. (i.e., Ctrl+R is now
80 // equivalent to a reload click). 81 // equivalent to a reload click).
81 void AddAcceleratorToButton( 82 void AddAcceleratorToButton(
82 const scoped_ptr<CustomDrawButton>& button, 83 const scoped_ptr<CustomDrawButton>& button,
83 unsigned int accelerator, 84 unsigned int accelerator,
84 unsigned int accelerator_mod); 85 unsigned int accelerator_mod);
85 86
86 // Gtk callback for the "activate" signal on the |entry_| widget. Responds to
87 // enter.
88 static void OnEntryActivate(GtkEntry *entry, BrowserToolbarGtk* toolbar);
89
90 // Gtk callback for the "focus" signal on the |entry_| widget.
91 static gboolean OnEntryFocus(GtkWidget* widget,
92 GtkDirectionType direction,
93 BrowserToolbarGtk* host);
94
95 // Gtk callback for the "focus-in" signal on the |entry_| widget.
96 static gboolean OnEntryFocusIn(GtkWidget* widget,
97 GdkEventFocus* focus,
98 BrowserToolbarGtk* host);
99
100 // Gtk callback for the "focus-out" signal on the |entry_| widget.
101 static gboolean OnEntryFocusOut(GtkWidget* widget,
102 GdkEventFocus* focus,
103 BrowserToolbarGtk* host);
104
105 // Gtk callback for the "clicked" signal. 87 // Gtk callback for the "clicked" signal.
106 static void OnButtonClick(GtkWidget* button, BrowserToolbarGtk* toolbar); 88 static void OnButtonClick(GtkWidget* button, BrowserToolbarGtk* toolbar);
107 89
108 // Gtk callback to intercept mouse clicks to the menu buttons. 90 // Gtk callback to intercept mouse clicks to the menu buttons.
109 static gboolean OnMenuButtonPressEvent(GtkWidget* button, 91 static gboolean OnMenuButtonPressEvent(GtkWidget* button,
110 GdkEvent *event, 92 GdkEvent *event,
111 BrowserToolbarGtk* toolbar); 93 BrowserToolbarGtk* toolbar);
112 94
113 // Displays the page menu. 95 // Displays the page menu.
114 void RunPageMenu(GdkEvent* button_press_event); 96 void RunPageMenu(GdkEvent* button_press_event);
115 97
116 // Displays the app menu. 98 // Displays the app menu.
117 void RunAppMenu(GdkEvent* button_press_event); 99 void RunAppMenu(GdkEvent* button_press_event);
118 100
119 // Construct the Home button. 101 // Construct the Home button.
120 CustomDrawButton* MakeHomeButton(); 102 CustomDrawButton* MakeHomeButton();
121 103
122 // Gtk widgets. The toolbar is an hbox with each of the other pieces of the 104 // Gtk widgets. The toolbar is an hbox with each of the other pieces of the
123 // toolbar placed side by side. 105 // toolbar placed side by side.
124 GtkWidget* toolbar_; 106 GtkWidget* toolbar_;
125 107
126 // Tooltip container for all GTK widgets in this class. 108 // Tooltip container for all GTK widgets in this class.
127 GtkTooltips* toolbar_tooltips_; 109 GtkTooltips* toolbar_tooltips_;
128 110
129 // Our temporary URL bar (until we get the omnibox up). 111 // The location bar view.
130 GtkWidget* entry_; 112 scoped_ptr<LocationBarViewGtk> location_bar_;
131 113
132 // A pointer to our window's accelerator list. 114 // A pointer to our window's accelerator list.
133 GtkAccelGroup* accel_group_; 115 GtkAccelGroup* accel_group_;
134 116
135 // All the buttons in the toolbar. 117 // All the buttons in the toolbar.
136 scoped_ptr<CustomDrawButton> back_, forward_; 118 scoped_ptr<CustomDrawButton> back_, forward_;
137 scoped_ptr<CustomDrawButton> reload_; 119 scoped_ptr<CustomDrawButton> reload_;
138 scoped_ptr<CustomDrawButton> home_; // May be NULL. 120 scoped_ptr<CustomDrawButton> home_; // May be NULL.
139 scoped_ptr<CustomDrawButton> star_, go_; 121 scoped_ptr<CustomDrawButton> star_, go_;
140 scoped_ptr<CustomContainerButton> page_menu_button_, app_menu_button_; 122 scoped_ptr<CustomContainerButton> page_menu_button_, app_menu_button_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // The back/forward menu gets reset every time it is shown. 159 // The back/forward menu gets reset every time it is shown.
178 scoped_ptr<MenuGtk> back_forward_menu_; 160 scoped_ptr<MenuGtk> back_forward_menu_;
179 161
180 scoped_ptr<BackForwardMenuModelGtk> back_menu_model_; 162 scoped_ptr<BackForwardMenuModelGtk> back_menu_model_;
181 scoped_ptr<BackForwardMenuModelGtk> forward_menu_model_; 163 scoped_ptr<BackForwardMenuModelGtk> forward_menu_model_;
182 164
183 ScopedRunnableMethodFactory<BrowserToolbarGtk> show_menu_factory_; 165 ScopedRunnableMethodFactory<BrowserToolbarGtk> show_menu_factory_;
184 }; 166 };
185 167
186 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ 168 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser.scons ('k') | chrome/browser/gtk/browser_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698