Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/ui/views/toolbar_view.h

Issue 10630013: Adds LocationBarContainer that contains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed debugging code Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chrome/browser/command_updater.h" 14 #include "chrome/browser/command_updater.h"
15 #include "chrome/browser/prefs/pref_member.h" 15 #include "chrome/browser/prefs/pref_member.h"
16 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" 16 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
18 #include "chrome/browser/ui/views/reload_button.h" 18 #include "chrome/browser/ui/views/reload_button.h"
19 #include "ui/base/accelerators/accelerator.h" 19 #include "ui/base/accelerators/accelerator.h"
20 #include "ui/base/animation/slide_animation.h" 20 #include "ui/base/animation/slide_animation.h"
21 #include "ui/views/accessible_pane_view.h" 21 #include "ui/views/accessible_pane_view.h"
22 #include "ui/views/controls/button/menu_button.h" 22 #include "ui/views/controls/button/menu_button.h"
23 #include "ui/views/controls/button/menu_button_listener.h" 23 #include "ui/views/controls/button/menu_button_listener.h"
24 #include "ui/views/view.h" 24 #include "ui/views/view.h"
25 25
26 class BrowserActionsContainer; 26 class BrowserActionsContainer;
27 class Browser; 27 class Browser;
28 class LocationBarContainer;
28 class WrenchMenu; 29 class WrenchMenu;
29 30
30 namespace views { 31 namespace views {
31 class MenuListener; 32 class MenuListener;
32 } 33 }
33 34
34 // The Browser Window's toolbar. 35 // The Browser Window's toolbar.
35 class ToolbarView : public views::AccessiblePaneView, 36 class ToolbarView : public views::AccessiblePaneView,
36 public views::MenuButtonListener, 37 public views::MenuButtonListener,
37 public ui::AcceleratorProvider, 38 public ui::AcceleratorProvider,
38 public LocationBarView::Delegate, 39 public LocationBarView::Delegate,
39 public content::NotificationObserver, 40 public content::NotificationObserver,
40 public CommandUpdater::CommandObserver, 41 public CommandUpdater::CommandObserver,
41 public views::ButtonListener { 42 public views::ButtonListener {
42 public: 43 public:
43 // The view class name. 44 // The view class name.
44 static const char kViewClassName[]; 45 static const char kViewClassName[];
45 46
46 explicit ToolbarView(Browser* browser); 47 explicit ToolbarView(Browser* browser);
47 virtual ~ToolbarView(); 48 virtual ~ToolbarView();
48 49
49 // Create the contents of the Browser Toolbar 50 // Create the contents of the Browser Toolbar. |location_bar_parent| is the
50 void Init(); 51 // view the LocationBarContainer is added to.
52 void Init(views::View* location_bar_parent);
51 53
52 // Updates the toolbar (and transitively the location bar) with the states of 54 // Updates the toolbar (and transitively the location bar) with the states of
53 // the specified |tab|. If |should_restore_state| is true, we're switching 55 // the specified |tab|. If |should_restore_state| is true, we're switching
54 // (back?) to this tab and should restore any previous location bar state 56 // (back?) to this tab and should restore any previous location bar state
55 // (such as user editing) as well. 57 // (such as user editing) as well.
56 void Update(content::WebContents* tab, bool should_restore_state); 58 void Update(content::WebContents* tab, bool should_restore_state);
57 59
58 // Set focus to the toolbar with complete keyboard access, with the 60 // Set focus to the toolbar with complete keyboard access, with the
59 // focus initially set to the app menu. Focus will be restored 61 // focus initially set to the app menu. Focus will be restored
60 // to the last focused view if the user escapes. 62 // to the last focused view if the user escapes.
(...skipping 12 matching lines...) Expand all
73 // badge. 75 // badge.
74 gfx::ImageSkia GetAppMenuIcon(views::CustomButton::ButtonState state); 76 gfx::ImageSkia GetAppMenuIcon(views::CustomButton::ButtonState state);
75 77
76 virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); 78 virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel);
77 79
78 // Accessors... 80 // Accessors...
79 Browser* browser() const { return browser_; } 81 Browser* browser() const { return browser_; }
80 BrowserActionsContainer* browser_actions() const { return browser_actions_; } 82 BrowserActionsContainer* browser_actions() const { return browser_actions_; }
81 ReloadButton* reload_button() const { return reload_; } 83 ReloadButton* reload_button() const { return reload_; }
82 LocationBarView* location_bar() const { return location_bar_; } 84 LocationBarView* location_bar() const { return location_bar_; }
85 LocationBarContainer* location_bar_container() const {
86 return location_bar_container_;
87 }
83 views::MenuButton* app_menu() const { return app_menu_; } 88 views::MenuButton* app_menu() const { return app_menu_; }
84 89
85 // Overridden from AccessiblePaneView 90 // Overridden from AccessiblePaneView
86 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE; 91 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE;
87 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 92 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
88 93
89 // Overridden from views::MenuButtonListener: 94 // Overridden from views::MenuButtonListener:
90 virtual void OnMenuButtonClicked(views::View* source, 95 virtual void OnMenuButtonClicked(views::View* source,
91 const gfx::Point& point) OVERRIDE; 96 const gfx::Point& point) OVERRIDE;
92 97
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Shows the critical notification bubble against the wrench menu. 182 // Shows the critical notification bubble against the wrench menu.
178 void ShowCriticalNotification(); 183 void ShowCriticalNotification();
179 184
180 // Updates the badge and the accessible name of the app menu (Wrench). 185 // Updates the badge and the accessible name of the app menu (Wrench).
181 void UpdateAppMenuState(); 186 void UpdateAppMenuState();
182 187
183 // Gets a badge for the wrench icon corresponding to the number of 188 // Gets a badge for the wrench icon corresponding to the number of
184 // unacknowledged background pages in the system. 189 // unacknowledged background pages in the system.
185 gfx::ImageSkia GetBackgroundPageBadge(); 190 gfx::ImageSkia GetBackgroundPageBadge();
186 191
192 // Sets the bounds of the LocationBarContainer. |bounds| is in the coordinates
193 // of |this|.
194 void SetLocationBarContainerBounds(const gfx::Rect& bounds);
195
187 scoped_ptr<BackForwardMenuModel> back_menu_model_; 196 scoped_ptr<BackForwardMenuModel> back_menu_model_;
188 scoped_ptr<BackForwardMenuModel> forward_menu_model_; 197 scoped_ptr<BackForwardMenuModel> forward_menu_model_;
189 198
190 // The model that contains the security level, text, icon to display... 199 // The model that contains the security level, text, icon to display...
191 ToolbarModel* model_; 200 ToolbarModel* model_;
192 201
193 // Controls 202 // Controls
194 views::ImageButton* back_; 203 views::ImageButton* back_;
195 views::ImageButton* forward_; 204 views::ImageButton* forward_;
196 ReloadButton* reload_; 205 ReloadButton* reload_;
197 views::ImageButton* home_; 206 views::ImageButton* home_;
198 LocationBarView* location_bar_; 207 LocationBarView* location_bar_;
208 LocationBarContainer* location_bar_container_;
199 BrowserActionsContainer* browser_actions_; 209 BrowserActionsContainer* browser_actions_;
200 views::MenuButton* app_menu_; 210 views::MenuButton* app_menu_;
201 Browser* browser_; 211 Browser* browser_;
202 212
203 // Contents of the profiles menu to populate with profile names. 213 // Contents of the profiles menu to populate with profile names.
204 scoped_ptr<ui::SimpleMenuModel> profiles_menu_contents_; 214 scoped_ptr<ui::SimpleMenuModel> profiles_menu_contents_;
205 215
206 // Controls whether or not a home button should be shown on the toolbar. 216 // Controls whether or not a home button should be shown on the toolbar.
207 BooleanPrefMember show_home_button_; 217 BooleanPrefMember show_home_button_;
208 218
209 // The display mode used when laying out the toolbar. 219 // The display mode used when laying out the toolbar.
210 DisplayMode display_mode_; 220 DisplayMode display_mode_;
211 221
212 // Wrench menu. 222 // Wrench menu.
213 scoped_ptr<WrenchMenu> wrench_menu_; 223 scoped_ptr<WrenchMenu> wrench_menu_;
214 224
215 // A list of listeners to call when the menu opens. 225 // A list of listeners to call when the menu opens.
216 ObserverList<views::MenuListener> menu_listeners_; 226 ObserverList<views::MenuListener> menu_listeners_;
217 227
218 content::NotificationRegistrar registrar_; 228 content::NotificationRegistrar registrar_;
219 229
220 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); 230 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView);
221 }; 231 };
222 232
223 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ 233 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698