| OLD | NEW |
| 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 GoButtonGtk; |
| 21 class LocationBar; | 22 class LocationBar; |
| 22 class LocationBarViewGtk; | 23 class LocationBarViewGtk; |
| 23 class NineBox; | 24 class NineBox; |
| 24 class Profile; | 25 class Profile; |
| 25 class TabContents; | 26 class TabContents; |
| 26 class ToolbarModel; | 27 class ToolbarModel; |
| 27 class ToolbarStarToggleGtk; | 28 class ToolbarStarToggleGtk; |
| 28 | 29 |
| 29 // View class that displays the GTK version of the toolbar and routes gtk | 30 // View class that displays the GTK version of the toolbar and routes gtk |
| 30 // events back to the Browser. | 31 // events back to the Browser. |
| 31 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, | 32 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, |
| 32 public MenuGtk::Delegate, | 33 public MenuGtk::Delegate, |
| 33 public NotificationObserver { | 34 public NotificationObserver { |
| 34 public: | 35 public: |
| 35 // Height of the toolbar, in pixels. | 36 // Height of the toolbar, in pixels. |
| 36 static const int kToolbarHeight; | 37 static const int kToolbarHeight; |
| 37 | 38 |
| 38 explicit BrowserToolbarGtk(Browser* browser); | 39 explicit BrowserToolbarGtk(Browser* browser); |
| 39 virtual ~BrowserToolbarGtk(); | 40 virtual ~BrowserToolbarGtk(); |
| 40 | 41 |
| 41 // Create the contents of the toolbar. |top_level_window| is the GtkWindow | 42 // Create the contents of the toolbar. |top_level_window| is the GtkWindow |
| 42 // to which we attach our accelerators. | 43 // to which we attach our accelerators. |
| 43 void Init(Profile* profile, GtkWindow* top_level_window); | 44 void Init(Profile* profile, GtkWindow* top_level_window); |
| 44 | 45 |
| 45 // Adds this GTK toolbar into a sizing box. | 46 // Adds this GTK toolbar into a sizing box. |
| 46 void AddToolbarToBox(GtkWidget* box); | 47 void AddToolbarToBox(GtkWidget* box); |
| 47 | 48 |
| 48 virtual LocationBar* GetLocationBar() const; | 49 virtual LocationBar* GetLocationBar() const; |
| 49 | 50 |
| 51 GoButtonGtk* GetGoButton() { return go_.get(); } |
| 52 |
| 50 // Overridden from CommandUpdater::CommandObserver: | 53 // Overridden from CommandUpdater::CommandObserver: |
| 51 virtual void EnabledStateChangedForCommand(int id, bool enabled); | 54 virtual void EnabledStateChangedForCommand(int id, bool enabled); |
| 52 | 55 |
| 53 // Overridden from MenuGtk::Delegate: | 56 // Overridden from MenuGtk::Delegate: |
| 54 virtual bool IsCommandEnabled(int command_id) const; | 57 virtual bool IsCommandEnabled(int command_id) const; |
| 55 virtual bool IsItemChecked(int id) const; | 58 virtual bool IsItemChecked(int id) const; |
| 56 virtual void ExecuteCommand(int command_id); | 59 virtual void ExecuteCommand(int command_id); |
| 57 | 60 |
| 58 // NotificationObserver implementation. | 61 // NotificationObserver implementation. |
| 59 void Observe(NotificationType type, | 62 void Observe(NotificationType type, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 scoped_ptr<LocationBarViewGtk> location_bar_; | 126 scoped_ptr<LocationBarViewGtk> location_bar_; |
| 124 | 127 |
| 125 // A pointer to our window's accelerator list. | 128 // A pointer to our window's accelerator list. |
| 126 GtkAccelGroup* accel_group_; | 129 GtkAccelGroup* accel_group_; |
| 127 | 130 |
| 128 // All the buttons in the toolbar. | 131 // All the buttons in the toolbar. |
| 129 scoped_ptr<CustomDrawButton> back_, forward_; | 132 scoped_ptr<CustomDrawButton> back_, forward_; |
| 130 scoped_ptr<CustomDrawButton> reload_; | 133 scoped_ptr<CustomDrawButton> reload_; |
| 131 scoped_ptr<CustomDrawButton> home_; // May be NULL. | 134 scoped_ptr<CustomDrawButton> home_; // May be NULL. |
| 132 scoped_ptr<ToolbarStarToggleGtk> star_; | 135 scoped_ptr<ToolbarStarToggleGtk> star_; |
| 133 scoped_ptr<CustomDrawButton> go_; | 136 scoped_ptr<GoButtonGtk> go_; |
| 134 scoped_ptr<CustomContainerButton> page_menu_button_, app_menu_button_; | 137 scoped_ptr<CustomContainerButton> page_menu_button_, app_menu_button_; |
| 135 | 138 |
| 136 // The model that contains the security level, text, icon to display... | 139 // The model that contains the security level, text, icon to display... |
| 137 ToolbarModel* model_; | 140 ToolbarModel* model_; |
| 138 | 141 |
| 139 scoped_ptr<MenuGtk> page_menu_; | 142 scoped_ptr<MenuGtk> page_menu_; |
| 140 scoped_ptr<MenuGtk> app_menu_; | 143 scoped_ptr<MenuGtk> app_menu_; |
| 141 | 144 |
| 142 Browser* browser_; | 145 Browser* browser_; |
| 143 Profile* profile_; | 146 Profile* profile_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 171 // The back/forward menu gets reset every time it is shown. | 174 // The back/forward menu gets reset every time it is shown. |
| 172 scoped_ptr<MenuGtk> back_forward_menu_; | 175 scoped_ptr<MenuGtk> back_forward_menu_; |
| 173 | 176 |
| 174 scoped_ptr<BackForwardMenuModelGtk> back_menu_model_; | 177 scoped_ptr<BackForwardMenuModelGtk> back_menu_model_; |
| 175 scoped_ptr<BackForwardMenuModelGtk> forward_menu_model_; | 178 scoped_ptr<BackForwardMenuModelGtk> forward_menu_model_; |
| 176 | 179 |
| 177 ScopedRunnableMethodFactory<BrowserToolbarGtk> show_menu_factory_; | 180 ScopedRunnableMethodFactory<BrowserToolbarGtk> show_menu_factory_; |
| 178 }; | 181 }; |
| 179 | 182 |
| 180 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ | 183 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ |
| OLD | NEW |