OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/gtk_signal.h" | 11 #include "app/gtk_signal.h" |
12 #include "app/menus/simple_menu_model.h" | 12 #include "app/menus/simple_menu_model.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "chrome/browser/app_menu_model.h" | 14 #include "chrome/browser/app_menu_model.h" |
15 #include "chrome/browser/bubble_positioner.h" | |
16 #include "chrome/browser/command_updater.h" | 15 #include "chrome/browser/command_updater.h" |
17 #include "chrome/browser/gtk/custom_button.h" | 16 #include "chrome/browser/gtk/custom_button.h" |
18 #include "chrome/browser/gtk/menu_bar_helper.h" | 17 #include "chrome/browser/gtk/menu_bar_helper.h" |
19 #include "chrome/browser/gtk/menu_gtk.h" | 18 #include "chrome/browser/gtk/menu_gtk.h" |
20 #include "chrome/browser/page_menu_model.h" | 19 #include "chrome/browser/page_menu_model.h" |
21 #include "chrome/browser/pref_member.h" | 20 #include "chrome/browser/pref_member.h" |
22 #include "chrome/browser/sync/profile_sync_service.h" | 21 #include "chrome/browser/sync/profile_sync_service.h" |
23 #include "chrome/common/notification_observer.h" | 22 #include "chrome/common/notification_observer.h" |
24 #include "chrome/common/notification_registrar.h" | 23 #include "chrome/common/notification_registrar.h" |
25 #include "chrome/common/owned_widget_gtk.h" | 24 #include "chrome/common/owned_widget_gtk.h" |
(...skipping 11 matching lines...) Expand all Loading... |
37 class TabContents; | 36 class TabContents; |
38 class ToolbarModel; | 37 class ToolbarModel; |
39 | 38 |
40 // View class that displays the GTK version of the toolbar and routes gtk | 39 // View class that displays the GTK version of the toolbar and routes gtk |
41 // events back to the Browser. | 40 // events back to the Browser. |
42 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, | 41 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, |
43 public ProfileSyncServiceObserver, | 42 public ProfileSyncServiceObserver, |
44 public menus::SimpleMenuModel::Delegate, | 43 public menus::SimpleMenuModel::Delegate, |
45 public MenuGtk::Delegate, | 44 public MenuGtk::Delegate, |
46 public NotificationObserver, | 45 public NotificationObserver, |
47 public BubblePositioner, | |
48 public MenuBarHelper::Delegate { | 46 public MenuBarHelper::Delegate { |
49 public: | 47 public: |
50 explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); | 48 explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); |
51 virtual ~BrowserToolbarGtk(); | 49 virtual ~BrowserToolbarGtk(); |
52 | 50 |
53 // Create the contents of the toolbar. |top_level_window| is the GtkWindow | 51 // Create the contents of the toolbar. |top_level_window| is the GtkWindow |
54 // to which we attach our accelerators. | 52 // to which we attach our accelerators. |
55 void Init(Profile* profile, GtkWindow* top_level_window); | 53 void Init(Profile* profile, GtkWindow* top_level_window); |
56 | 54 |
57 // Set the various widgets' ViewIDs. | 55 // Set the various widgets' ViewIDs. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void Observe(NotificationType type, | 104 void Observe(NotificationType type, |
107 const NotificationSource& source, | 105 const NotificationSource& source, |
108 const NotificationDetails& details); | 106 const NotificationDetails& details); |
109 | 107 |
110 Profile* profile() { return profile_; } | 108 Profile* profile() { return profile_; } |
111 void SetProfile(Profile* profile); | 109 void SetProfile(Profile* profile); |
112 | 110 |
113 // Message that we should react to a state change. | 111 // Message that we should react to a state change. |
114 void UpdateTabContents(TabContents* contents, bool should_restore_state); | 112 void UpdateTabContents(TabContents* contents, bool should_restore_state); |
115 | 113 |
116 // BubblePositioner: | |
117 virtual gfx::Rect GetLocationStackBounds() const; | |
118 | |
119 // MenuBarHelper::Delegate implementation ------------------------------------ | 114 // MenuBarHelper::Delegate implementation ------------------------------------ |
120 virtual void PopupForButton(GtkWidget* button); | 115 virtual void PopupForButton(GtkWidget* button); |
121 virtual void PopupForButtonNextTo(GtkWidget* button, | 116 virtual void PopupForButtonNextTo(GtkWidget* button, |
122 GtkMenuDirectionType dir); | 117 GtkMenuDirectionType dir); |
123 | 118 |
124 private: | 119 private: |
125 // Builds a toolbar button with all the properties set. | 120 // Builds a toolbar button with all the properties set. |
126 // |spacing| is the width of padding (in pixels) on the left and right of the | 121 // |spacing| is the width of padding (in pixels) on the left and right of the |
127 // button. | 122 // button. |
128 CustomDrawButton* BuildToolbarButton(int normal_id, | 123 CustomDrawButton* BuildToolbarButton(int normal_id, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // A GtkEntry that isn't part of the hierarchy. We keep this for native | 235 // A GtkEntry that isn't part of the hierarchy. We keep this for native |
241 // rendering. | 236 // rendering. |
242 OwnedWidgetGtk offscreen_entry_; | 237 OwnedWidgetGtk offscreen_entry_; |
243 | 238 |
244 MenuBarHelper menu_bar_helper_; | 239 MenuBarHelper menu_bar_helper_; |
245 | 240 |
246 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); | 241 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); |
247 }; | 242 }; |
248 | 243 |
249 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ | 244 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ |
OLD | NEW |