| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_GTK_BROWSER_TOOLBAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_observer.h" |
| 15 #include "chrome/browser/prefs/pref_member.h" | 15 #include "chrome/browser/prefs/pref_member.h" |
| 16 #include "chrome/browser/ui/gtk/custom_button.h" | 16 #include "chrome/browser/ui/gtk/custom_button.h" |
| 17 #include "chrome/browser/ui/gtk/menu_gtk.h" | 17 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 18 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 18 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "ui/base/accelerators/accelerator.h" | 21 #include "ui/base/accelerators/accelerator.h" |
| 22 #include "ui/base/gtk/gtk_signal.h" | 22 #include "ui/base/gtk/gtk_signal.h" |
| 23 #include "ui/base/gtk/gtk_signal_registrar.h" | 23 #include "ui/base/gtk/gtk_signal_registrar.h" |
| 24 #include "ui/base/gtk/owned_widget_gtk.h" | 24 #include "ui/base/gtk/owned_widget_gtk.h" |
| 25 #include "ui/base/models/simple_menu_model.h" | 25 #include "ui/base/models/simple_menu_model.h" |
| 26 | 26 |
| 27 class BackForwardButtonGtk; | 27 class BackForwardButtonGtk; |
| 28 class Browser; | 28 class Browser; |
| 29 class BrowserActionsToolbarGtk; | 29 class BrowserActionsToolbarGtk; |
| 30 class BrowserWindowGtk; | 30 class BrowserWindowGtk; |
| 31 class CustomDrawButton; | 31 class CustomDrawButton; |
| 32 class GtkThemeService; | 32 class GtkThemeService; |
| 33 class LocationBar; | 33 class LocationBar; |
| 34 class LocationBarViewGtk; | 34 class LocationBarViewGtk; |
| 35 class ReloadButtonGtk; | 35 class ReloadButtonGtk; |
| 36 class ToolbarModel; | 36 class ToolbarModel; |
| 37 | 37 |
| 38 namespace content { | 38 namespace content { |
| 39 class WebContents; | 39 class WebContents; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // View class that displays the GTK version of the toolbar and routes gtk | 42 // View class that displays the GTK version of the toolbar and routes gtk |
| 43 // events back to the Browser. | 43 // events back to the Browser. |
| 44 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, | 44 class BrowserToolbarGtk : public CommandObserver, |
| 45 public ui::AcceleratorProvider, | 45 public ui::AcceleratorProvider, |
| 46 public MenuGtk::Delegate, | 46 public MenuGtk::Delegate, |
| 47 public content::NotificationObserver { | 47 public content::NotificationObserver { |
| 48 public: | 48 public: |
| 49 BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); | 49 BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); |
| 50 virtual ~BrowserToolbarGtk(); | 50 virtual ~BrowserToolbarGtk(); |
| 51 | 51 |
| 52 // Create the contents of the toolbar. |top_level_window| is the GtkWindow | 52 // Create the contents of the toolbar. |top_level_window| is the GtkWindow |
| 53 // to which we attach our accelerators. | 53 // to which we attach our accelerators. |
| 54 void Init(GtkWindow* top_level_window); | 54 void Init(GtkWindow* top_level_window); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 LocationBarViewGtk* GetLocationBarView() { return location_bar_.get(); } | 82 LocationBarViewGtk* GetLocationBarView() { return location_bar_.get(); } |
| 83 | 83 |
| 84 // We have to show padding on the bottom of the toolbar when the bookmark | 84 // We have to show padding on the bottom of the toolbar when the bookmark |
| 85 // is in floating mode. Otherwise the bookmark bar will paint it for us. | 85 // is in floating mode. Otherwise the bookmark bar will paint it for us. |
| 86 void UpdateForBookmarkBarVisibility(bool show_bottom_padding); | 86 void UpdateForBookmarkBarVisibility(bool show_bottom_padding); |
| 87 | 87 |
| 88 void ShowAppMenu(); | 88 void ShowAppMenu(); |
| 89 | 89 |
| 90 // Overridden from CommandUpdater::CommandObserver: | 90 // Overridden from CommandObserver: |
| 91 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; | 91 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
| 92 | 92 |
| 93 // Overridden from MenuGtk::Delegate: | 93 // Overridden from MenuGtk::Delegate: |
| 94 virtual void StoppedShowing() OVERRIDE; | 94 virtual void StoppedShowing() OVERRIDE; |
| 95 virtual GtkIconSet* GetIconSetForId(int idr) OVERRIDE; | 95 virtual GtkIconSet* GetIconSetForId(int idr) OVERRIDE; |
| 96 virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE; | 96 virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE; |
| 97 | 97 |
| 98 // Overridden from ui::AcceleratorProvider: | 98 // Overridden from ui::AcceleratorProvider: |
| 99 virtual bool GetAcceleratorForCommandId( | 99 virtual bool GetAcceleratorForCommandId( |
| 100 int id, | 100 int id, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // rendering. | 216 // rendering. |
| 217 ui::OwnedWidgetGtk offscreen_entry_; | 217 ui::OwnedWidgetGtk offscreen_entry_; |
| 218 | 218 |
| 219 // Manages the home button drop signal handler. | 219 // Manages the home button drop signal handler. |
| 220 scoped_ptr<ui::GtkSignalRegistrar> drop_handler_; | 220 scoped_ptr<ui::GtkSignalRegistrar> drop_handler_; |
| 221 | 221 |
| 222 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); | 222 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_ | 225 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_ |
| OLD | NEW |