| 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_VIEWS_TOOLBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/prefs/public/pref_observer.h" |
| 13 #include "chrome/browser/api/prefs/pref_member.h" | 14 #include "chrome/browser/api/prefs/pref_member.h" |
| 14 #include "chrome/browser/command_observer.h" | 15 #include "chrome/browser/command_observer.h" |
| 15 #include "chrome/browser/ui/search/search_model_observer.h" | 16 #include "chrome/browser/ui/search/search_model_observer.h" |
| 16 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 17 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
| 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 18 #include "chrome/browser/ui/views/reload_button.h" | 19 #include "chrome/browser/ui/views/reload_button.h" |
| 19 #include "ui/base/accelerators/accelerator.h" | 20 #include "ui/base/accelerators/accelerator.h" |
| 20 #include "ui/base/animation/slide_animation.h" | 21 #include "ui/base/animation/slide_animation.h" |
| 21 #include "ui/views/accessible_pane_view.h" | 22 #include "ui/views/accessible_pane_view.h" |
| 22 #include "ui/views/controls/button/menu_button.h" | 23 #include "ui/views/controls/button/menu_button.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 } | 41 } |
| 41 | 42 |
| 42 // The Browser Window's toolbar. | 43 // The Browser Window's toolbar. |
| 43 class ToolbarView : public views::AccessiblePaneView, | 44 class ToolbarView : public views::AccessiblePaneView, |
| 44 public views::MenuButtonListener, | 45 public views::MenuButtonListener, |
| 45 public ui::AcceleratorProvider, | 46 public ui::AcceleratorProvider, |
| 46 public LocationBarView::Delegate, | 47 public LocationBarView::Delegate, |
| 47 public chrome::search::SearchModelObserver, | 48 public chrome::search::SearchModelObserver, |
| 48 public content::NotificationObserver, | 49 public content::NotificationObserver, |
| 49 public CommandObserver, | 50 public CommandObserver, |
| 50 public views::ButtonListener { | 51 public views::ButtonListener, |
| 52 public PrefObserver { |
| 51 public: | 53 public: |
| 52 // The view class name. | 54 // The view class name. |
| 53 static const char kViewClassName[]; | 55 static const char kViewClassName[]; |
| 54 | 56 |
| 55 explicit ToolbarView(Browser* browser); | 57 explicit ToolbarView(Browser* browser); |
| 56 virtual ~ToolbarView(); | 58 virtual ~ToolbarView(); |
| 57 | 59 |
| 58 // Create the contents of the Browser Toolbar. |location_bar_parent| is the | 60 // Create the contents of the Browser Toolbar. |location_bar_parent| is the |
| 59 // view the LocationBarContainer is added to. | 61 // view the LocationBarContainer is added to. |
| 60 void Init(views::View* location_bar_parent); | 62 void Init(views::View* location_bar_parent); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 137 |
| 136 // Overridden from views::ButtonListener: | 138 // Overridden from views::ButtonListener: |
| 137 virtual void ButtonPressed(views::Button* sender, | 139 virtual void ButtonPressed(views::Button* sender, |
| 138 const ui::Event& event) OVERRIDE; | 140 const ui::Event& event) OVERRIDE; |
| 139 | 141 |
| 140 // Overridden from content::NotificationObserver: | 142 // Overridden from content::NotificationObserver: |
| 141 virtual void Observe(int type, | 143 virtual void Observe(int type, |
| 142 const content::NotificationSource& source, | 144 const content::NotificationSource& source, |
| 143 const content::NotificationDetails& details) OVERRIDE; | 145 const content::NotificationDetails& details) OVERRIDE; |
| 144 | 146 |
| 147 // Overridden from PrefObserver: |
| 148 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 149 const std::string& pref_name) OVERRIDE; |
| 150 |
| 145 // Overridden from ui::AcceleratorProvider: | 151 // Overridden from ui::AcceleratorProvider: |
| 146 virtual bool GetAcceleratorForCommandId( | 152 virtual bool GetAcceleratorForCommandId( |
| 147 int command_id, ui::Accelerator* accelerator) OVERRIDE; | 153 int command_id, ui::Accelerator* accelerator) OVERRIDE; |
| 148 | 154 |
| 149 // Overridden from views::View: | 155 // Overridden from views::View: |
| 150 virtual gfx::Size GetPreferredSize() OVERRIDE; | 156 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 151 virtual void Layout() OVERRIDE; | 157 virtual void Layout() OVERRIDE; |
| 152 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 158 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
| 153 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 159 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 154 virtual bool GetDropFormats( | 160 virtual bool GetDropFormats( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 257 |
| 252 // A list of listeners to call when the menu opens. | 258 // A list of listeners to call when the menu opens. |
| 253 ObserverList<views::MenuListener> menu_listeners_; | 259 ObserverList<views::MenuListener> menu_listeners_; |
| 254 | 260 |
| 255 content::NotificationRegistrar registrar_; | 261 content::NotificationRegistrar registrar_; |
| 256 | 262 |
| 257 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); | 263 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); |
| 258 }; | 264 }; |
| 259 | 265 |
| 260 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ | 266 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ |
| OLD | NEW |