| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ui/base/models/simple_menu_model.h" | 24 #include "ui/base/models/simple_menu_model.h" |
| 25 | 25 |
| 26 class BackForwardButtonGtk; | 26 class BackForwardButtonGtk; |
| 27 class Browser; | 27 class Browser; |
| 28 class BrowserActionsToolbarGtk; | 28 class BrowserActionsToolbarGtk; |
| 29 class BrowserWindowGtk; | 29 class BrowserWindowGtk; |
| 30 class CustomDrawButton; | 30 class CustomDrawButton; |
| 31 class GtkThemeService; | 31 class GtkThemeService; |
| 32 class LocationBar; | 32 class LocationBar; |
| 33 class LocationBarViewGtk; | 33 class LocationBarViewGtk; |
| 34 class Profile; | |
| 35 class ReloadButtonGtk; | 34 class ReloadButtonGtk; |
| 36 class TabContents; | 35 class TabContents; |
| 37 class ToolbarModel; | 36 class ToolbarModel; |
| 38 | 37 |
| 39 // View class that displays the GTK version of the toolbar and routes gtk | 38 // View class that displays the GTK version of the toolbar and routes gtk |
| 40 // events back to the Browser. | 39 // events back to the Browser. |
| 41 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, | 40 class BrowserToolbarGtk : public CommandUpdater::CommandObserver, |
| 42 public ui::AcceleratorProvider, | 41 public ui::AcceleratorProvider, |
| 43 public MenuGtk::Delegate, | 42 public MenuGtk::Delegate, |
| 44 public NotificationObserver { | 43 public NotificationObserver { |
| 45 public: | 44 public: |
| 46 BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); | 45 BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window); |
| 47 virtual ~BrowserToolbarGtk(); | 46 virtual ~BrowserToolbarGtk(); |
| 48 | 47 |
| 49 // Create the contents of the toolbar. |top_level_window| is the GtkWindow | 48 // Create the contents of the toolbar. |top_level_window| is the GtkWindow |
| 50 // to which we attach our accelerators. | 49 // to which we attach our accelerators. |
| 51 void Init(Profile* profile, GtkWindow* top_level_window); | 50 void Init(GtkWindow* top_level_window); |
| 52 | 51 |
| 53 // Set the various widgets' ViewIDs. | 52 // Set the various widgets' ViewIDs. |
| 54 void SetViewIDs(); | 53 void SetViewIDs(); |
| 55 | 54 |
| 56 void Show(); | 55 void Show(); |
| 57 void Hide(); | 56 void Hide(); |
| 58 | 57 |
| 59 // Getter for the containing widget. | 58 // Getter for the containing widget. |
| 60 GtkWidget* widget() { | 59 GtkWidget* widget() { |
| 61 return event_box_; | 60 return event_box_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 93 |
| 95 // Overridden from ui::AcceleratorProvider: | 94 // Overridden from ui::AcceleratorProvider: |
| 96 virtual bool GetAcceleratorForCommandId(int id, | 95 virtual bool GetAcceleratorForCommandId(int id, |
| 97 ui::Accelerator* accelerator); | 96 ui::Accelerator* accelerator); |
| 98 | 97 |
| 99 // NotificationObserver implementation. | 98 // NotificationObserver implementation. |
| 100 virtual void Observe(int type, | 99 virtual void Observe(int type, |
| 101 const NotificationSource& source, | 100 const NotificationSource& source, |
| 102 const NotificationDetails& details); | 101 const NotificationDetails& details); |
| 103 | 102 |
| 104 Profile* profile() { return profile_; } | |
| 105 void SetProfile(Profile* profile); | |
| 106 | |
| 107 // Message that we should react to a state change. | 103 // Message that we should react to a state change. |
| 108 void UpdateTabContents(TabContents* contents, bool should_restore_state); | 104 void UpdateTabContents(TabContents* contents, bool should_restore_state); |
| 109 | 105 |
| 110 private: | 106 private: |
| 111 // Connect/Disconnect signals for dragging a url onto the home button. | 107 // Connect/Disconnect signals for dragging a url onto the home button. |
| 112 void SetUpDragForHomeButton(bool enable); | 108 void SetUpDragForHomeButton(bool enable); |
| 113 | 109 |
| 114 // Sets the top corners of the toolbar to rounded, or sets them to normal, | 110 // Sets the top corners of the toolbar to rounded, or sets them to normal, |
| 115 // depending on the state of the browser window. Returns false if no action | 111 // depending on the state of the browser window. Returns false if no action |
| 116 // was taken (the roundedness was already correct), true otherwise. | 112 // was taken (the roundedness was already correct), true otherwise. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 ToolbarModel* model_; | 183 ToolbarModel* model_; |
| 188 | 184 |
| 189 GtkThemeService* theme_service_; | 185 GtkThemeService* theme_service_; |
| 190 | 186 |
| 191 scoped_ptr<MenuGtk> wrench_menu_; | 187 scoped_ptr<MenuGtk> wrench_menu_; |
| 192 | 188 |
| 193 WrenchMenuModel wrench_menu_model_; | 189 WrenchMenuModel wrench_menu_model_; |
| 194 | 190 |
| 195 Browser* browser_; | 191 Browser* browser_; |
| 196 BrowserWindowGtk* window_; | 192 BrowserWindowGtk* window_; |
| 197 Profile* profile_; | |
| 198 | 193 |
| 199 // Controls whether or not a home button should be shown on the toolbar. | 194 // Controls whether or not a home button should be shown on the toolbar. |
| 200 BooleanPrefMember show_home_button_; | 195 BooleanPrefMember show_home_button_; |
| 201 | 196 |
| 202 // Preferences controlling the configured home page. | 197 // Preferences controlling the configured home page. |
| 203 StringPrefMember home_page_; | 198 StringPrefMember home_page_; |
| 204 BooleanPrefMember home_page_is_new_tab_page_; | 199 BooleanPrefMember home_page_is_new_tab_page_; |
| 205 | 200 |
| 206 NotificationRegistrar registrar_; | 201 NotificationRegistrar registrar_; |
| 207 | 202 |
| 208 // 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 |
| 209 // rendering. | 204 // rendering. |
| 210 OwnedWidgetGtk offscreen_entry_; | 205 OwnedWidgetGtk offscreen_entry_; |
| 211 | 206 |
| 212 // Manages the home button drop signal handler. | 207 // Manages the home button drop signal handler. |
| 213 scoped_ptr<ui::GtkSignalRegistrar> drop_handler_; | 208 scoped_ptr<ui::GtkSignalRegistrar> drop_handler_; |
| 214 | 209 |
| 215 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); | 210 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); |
| 216 }; | 211 }; |
| 217 | 212 |
| 218 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_ | 213 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TOOLBAR_GTK_H_ |
| OLD | NEW |