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

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: Remove set_view_to_focus 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. |popup_parent_view| is the 50 // Create the contents of the Browser Toolbar. |location_bar_parent| is the
51 // view the LocationBarContainer is added to. |popup_parent_view| is the
50 // View to add the omnibox popup view to. 52 // View to add the omnibox popup view to.
51 // TODO(sky): clearly describe when |popup_parent_view| is used. 53 // TODO(sky): clearly describe when |popup_parent_view| is used.
52 void Init(views::View* popup_parent_view); 54 void Init(views::View* location_bar_parent, views::View* popup_parent_view);
53 55
54 // Updates the toolbar (and transitively the location bar) with the states of 56 // Updates the toolbar (and transitively the location bar) with the states of
55 // the specified |tab|. If |should_restore_state| is true, we're switching 57 // the specified |tab|. If |should_restore_state| is true, we're switching
56 // (back?) to this tab and should restore any previous location bar state 58 // (back?) to this tab and should restore any previous location bar state
57 // (such as user editing) as well. 59 // (such as user editing) as well.
58 void Update(content::WebContents* tab, bool should_restore_state); 60 void Update(content::WebContents* tab, bool should_restore_state);
59 61
60 // Set focus to the toolbar with complete keyboard access, with the 62 // Set focus to the toolbar with complete keyboard access, with the
61 // focus initially set to the app menu. Focus will be restored 63 // focus initially set to the app menu. Focus will be restored
62 // to the last focused view if the user escapes. 64 // to the last focused view if the user escapes.
(...skipping 12 matching lines...) Expand all
75 // badge. 77 // badge.
76 gfx::ImageSkia GetAppMenuIcon(views::CustomButton::ButtonState state); 78 gfx::ImageSkia GetAppMenuIcon(views::CustomButton::ButtonState state);
77 79
78 virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); 80 virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel);
79 81
80 // Accessors... 82 // Accessors...
81 Browser* browser() const { return browser_; } 83 Browser* browser() const { return browser_; }
82 BrowserActionsContainer* browser_actions() const { return browser_actions_; } 84 BrowserActionsContainer* browser_actions() const { return browser_actions_; }
83 ReloadButton* reload_button() const { return reload_; } 85 ReloadButton* reload_button() const { return reload_; }
84 LocationBarView* location_bar() const { return location_bar_; } 86 LocationBarView* location_bar() const { return location_bar_; }
87 LocationBarContainer* location_bar_container() const {
88 return location_bar_container_;
89 }
85 views::MenuButton* app_menu() const { return app_menu_; } 90 views::MenuButton* app_menu() const { return app_menu_; }
86 91
87 // Overridden from AccessiblePaneView 92 // Overridden from AccessiblePaneView
88 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE; 93 virtual bool SetPaneFocus(View* initial_focus) OVERRIDE;
89 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 94 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
90 95
91 // Overridden from views::MenuButtonListener: 96 // Overridden from views::MenuButtonListener:
92 virtual void OnMenuButtonClicked(views::View* source, 97 virtual void OnMenuButtonClicked(views::View* source,
93 const gfx::Point& point) OVERRIDE; 98 const gfx::Point& point) OVERRIDE;
94 99
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Shows the critical notification bubble against the wrench menu. 184 // Shows the critical notification bubble against the wrench menu.
180 void ShowCriticalNotification(); 185 void ShowCriticalNotification();
181 186
182 // Updates the badge and the accessible name of the app menu (Wrench). 187 // Updates the badge and the accessible name of the app menu (Wrench).
183 void UpdateAppMenuState(); 188 void UpdateAppMenuState();
184 189
185 // Gets a badge for the wrench icon corresponding to the number of 190 // Gets a badge for the wrench icon corresponding to the number of
186 // unacknowledged background pages in the system. 191 // unacknowledged background pages in the system.
187 gfx::ImageSkia GetBackgroundPageBadge(); 192 gfx::ImageSkia GetBackgroundPageBadge();
188 193
194 // Sets the bounds of the LocationBarContainer. |bounds| is in the coordinates
195 // of |this|.
196 void SetLocationBarContainerBounds(const gfx::Rect& bounds);
197
189 scoped_ptr<BackForwardMenuModel> back_menu_model_; 198 scoped_ptr<BackForwardMenuModel> back_menu_model_;
190 scoped_ptr<BackForwardMenuModel> forward_menu_model_; 199 scoped_ptr<BackForwardMenuModel> forward_menu_model_;
191 200
192 // The model that contains the security level, text, icon to display... 201 // The model that contains the security level, text, icon to display...
193 ToolbarModel* model_; 202 ToolbarModel* model_;
194 203
195 // Controls 204 // Controls
196 views::ImageButton* back_; 205 views::ImageButton* back_;
197 views::ImageButton* forward_; 206 views::ImageButton* forward_;
198 ReloadButton* reload_; 207 ReloadButton* reload_;
199 views::ImageButton* home_; 208 views::ImageButton* home_;
200 LocationBarView* location_bar_; 209 LocationBarView* location_bar_;
210 LocationBarContainer* location_bar_container_;
201 BrowserActionsContainer* browser_actions_; 211 BrowserActionsContainer* browser_actions_;
202 views::MenuButton* app_menu_; 212 views::MenuButton* app_menu_;
203 Browser* browser_; 213 Browser* browser_;
204 214
205 // Contents of the profiles menu to populate with profile names. 215 // Contents of the profiles menu to populate with profile names.
206 scoped_ptr<ui::SimpleMenuModel> profiles_menu_contents_; 216 scoped_ptr<ui::SimpleMenuModel> profiles_menu_contents_;
207 217
208 // Controls whether or not a home button should be shown on the toolbar. 218 // Controls whether or not a home button should be shown on the toolbar.
209 BooleanPrefMember show_home_button_; 219 BooleanPrefMember show_home_button_;
210 220
211 // The display mode used when laying out the toolbar. 221 // The display mode used when laying out the toolbar.
212 DisplayMode display_mode_; 222 DisplayMode display_mode_;
213 223
214 // Wrench menu. 224 // Wrench menu.
215 scoped_ptr<WrenchMenu> wrench_menu_; 225 scoped_ptr<WrenchMenu> wrench_menu_;
216 226
217 // A list of listeners to call when the menu opens. 227 // A list of listeners to call when the menu opens.
218 ObserverList<views::MenuListener> menu_listeners_; 228 ObserverList<views::MenuListener> menu_listeners_;
219 229
220 content::NotificationRegistrar registrar_; 230 content::NotificationRegistrar registrar_;
221 231
222 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView); 232 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarView);
223 }; 233 };
224 234
225 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_ 235 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | chrome/browser/ui/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698