| 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 "chrome/browser/autocomplete/autocomplete_popup_view.h" | 12 #include "chrome/browser/bubble_positioner.h" |
| 13 #include "chrome/browser/command_updater.h" | 13 #include "chrome/browser/command_updater.h" |
| 14 #include "chrome/browser/gtk/menu_bar_helper.h" | 14 #include "chrome/browser/gtk/menu_bar_helper.h" |
| 15 #include "chrome/browser/gtk/menu_gtk.h" | 15 #include "chrome/browser/gtk/menu_gtk.h" |
| 16 #include "chrome/common/notification_observer.h" | 16 #include "chrome/common/notification_observer.h" |
| 17 #include "chrome/common/notification_registrar.h" | 17 #include "chrome/common/notification_registrar.h" |
| 18 #include "chrome/common/pref_member.h" | 18 #include "chrome/common/pref_member.h" |
| 19 | 19 |
| 20 class BackForwardButtonGtk; | 20 class BackForwardButtonGtk; |
| 21 class Browser; | 21 class Browser; |
| 22 class BrowserWindowGtk; | 22 class BrowserWindowGtk; |
| 23 class CustomDrawButton; | 23 class CustomDrawButton; |
| 24 class GtkThemeProvider; | 24 class GtkThemeProvider; |
| 25 class GoButtonGtk; | 25 class GoButtonGtk; |
| 26 class LocationBar; | 26 class LocationBar; |
| 27 class LocationBarViewGtk; | 27 class LocationBarViewGtk; |
| 28 class Profile; | 28 class Profile; |
| 29 class TabContents; | 29 class TabContents; |
| 30 class ToolbarModel; | 30 class ToolbarModel; |
| 31 class ToolbarStarToggleGtk; | 31 class ToolbarStarToggleGtk; |
| 32 | 32 |
| 33 // View class that displays the GTK version of the toolbar and routes gtk | 33 // View class that displays the GTK version of the toolbar and routes gtk |
| 34 // events back to the Browser. | 34 // events back to the Browser. |
| 35 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, | 35 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, |
| 36 public MenuGtk::Delegate, | 36 public MenuGtk::Delegate, |
| 37 public NotificationObserver, | 37 public NotificationObserver, |
| 38 public AutocompletePopupPositioner, | 38 public BubblePositioner, |
| 39 public MenuBarHelper::Delegate { | 39 public MenuBarHelper::Delegate { |
| 40 public: | 40 public: |
| 41 explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); | 41 explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); |
| 42 virtual ~BrowserToolbarGtk(); | 42 virtual ~BrowserToolbarGtk(); |
| 43 | 43 |
| 44 // Create the contents of the toolbar. |top_level_window| is the GtkWindow | 44 // Create the contents of the toolbar. |top_level_window| is the GtkWindow |
| 45 // to which we attach our accelerators. | 45 // to which we attach our accelerators. |
| 46 void Init(Profile* profile, GtkWindow* top_level_window); | 46 void Init(Profile* profile, GtkWindow* top_level_window); |
| 47 | 47 |
| 48 // Set the various widgets' ViewIDs. | 48 // Set the various widgets' ViewIDs. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 const NotificationDetails& details); | 80 const NotificationDetails& details); |
| 81 | 81 |
| 82 Profile* profile() { return profile_; } | 82 Profile* profile() { return profile_; } |
| 83 void SetProfile(Profile* profile); | 83 void SetProfile(Profile* profile); |
| 84 | 84 |
| 85 // Message that we should react to a state change. | 85 // Message that we should react to a state change. |
| 86 void UpdateTabContents(TabContents* contents, bool should_restore_state); | 86 void UpdateTabContents(TabContents* contents, bool should_restore_state); |
| 87 | 87 |
| 88 ToolbarStarToggleGtk* star() { return star_.get(); } | 88 ToolbarStarToggleGtk* star() { return star_.get(); } |
| 89 | 89 |
| 90 // Implement AutocompletePopupPositioner, return the position of where the | 90 // BubblePositioner: |
| 91 // Omnibox results popup should go (from the star to the go buttons). | 91 virtual gfx::Rect GetLocationStackBounds() const; |
| 92 virtual gfx::Rect GetPopupBounds() const; | |
| 93 | 92 |
| 94 // MenuBarHelper::Delegate implementation ------------------------------------ | 93 // MenuBarHelper::Delegate implementation ------------------------------------ |
| 95 virtual void PopupForButton(GtkWidget* button); | 94 virtual void PopupForButton(GtkWidget* button); |
| 96 virtual void PopupForButtonNextTo(GtkWidget* button, | 95 virtual void PopupForButtonNextTo(GtkWidget* button, |
| 97 GtkMenuDirectionType dir); | 96 GtkMenuDirectionType dir); |
| 98 | 97 |
| 99 private: | 98 private: |
| 100 // Builds a toolbar button with all the properties set. | 99 // Builds a toolbar button with all the properties set. |
| 101 // |spacing| is the width of padding (in pixels) on the left and right of the | 100 // |spacing| is the width of padding (in pixels) on the left and right of the |
| 102 // button. | 101 // button. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // A GtkEntry that isn't part of the hierarchy. We keep this for native | 203 // A GtkEntry that isn't part of the hierarchy. We keep this for native |
| 205 // rendering. | 204 // rendering. |
| 206 OwnedWidgetGtk offscreen_entry_; | 205 OwnedWidgetGtk offscreen_entry_; |
| 207 | 206 |
| 208 MenuBarHelper menu_bar_helper_; | 207 MenuBarHelper menu_bar_helper_; |
| 209 | 208 |
| 210 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); | 209 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); |
| 211 }; | 210 }; |
| 212 | 211 |
| 213 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ | 212 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ |
| OLD | NEW |