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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.h

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 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) 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_VIEWS_FRAME_BROWSER_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/timer.h" 14 #include "base/timer.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/tabs/tab_strip_model_observer.h" 16 #include "chrome/browser/tabs/tab_strip_model_observer.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h"
19 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" 20 #include "chrome/browser/ui/views/frame/browser_bubble_host.h"
20 #include "chrome/browser/ui/views/frame/browser_frame.h" 21 #include "chrome/browser/ui/views/frame/browser_frame.h"
21 #include "chrome/browser/ui/views/infobars/infobar_container.h" 22 #include "chrome/browser/ui/views/infobars/infobar_container.h"
22 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" 23 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
23 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" 24 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h"
24 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" 25 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
25 #include "content/common/notification_registrar.h" 26 #include "content/common/notification_registrar.h"
26 #include "ui/base/models/simple_menu_model.h" 27 #include "ui/base/models/simple_menu_model.h"
27 #include "ui/gfx/native_widget_types.h" 28 #include "ui/gfx/native_widget_types.h"
28 #include "views/controls/single_split_view.h" 29 #include "views/controls/single_split_view.h"
29 #include "views/window/client_view.h" 30 #include "views/window/client_view.h"
30 #include "views/window/window_delegate.h" 31 #include "views/window/window_delegate.h"
31 32
32 #if defined(OS_WIN) 33 #if defined(OS_WIN)
33 #include "chrome/browser/hang_monitor/hung_plugin_action.h" 34 #include "chrome/browser/hang_monitor/hung_plugin_action.h"
34 #include "chrome/browser/hang_monitor/hung_window_detector.h" 35 #include "chrome/browser/hang_monitor/hung_window_detector.h"
35 #include "views/controls/menu/native_menu_win.h" 36 #include "views/controls/menu/native_menu_win.h"
36 #endif 37 #endif
37 38
38 // NOTE: For more information about the objects and files in this directory, 39 // NOTE: For more information about the objects and files in this directory,
39 // view: http://dev.chromium.org/developers/design-documents/browser-window 40 // view: http://dev.chromium.org/developers/design-documents/browser-window
40 41
41 class AccessiblePaneView; 42 class AccessiblePaneView;
42 class BookmarkBarView; 43 class BookmarkBarView;
43 class Browser; 44 class Browser;
44 class BrowserBubble; 45 class BrowserBubble;
45 class BrowserViewLayout; 46 class BrowserViewLayout;
46 class ContentsContainer; 47 class ContentsContainer;
48 class CompactLocationBar;
49 class CompactNavigationBar;
50 class CompactOptionsBar;
47 class DownloadShelfView; 51 class DownloadShelfView;
48 class EncodingMenuModel; 52 class EncodingMenuModel;
49 class FullscreenExitBubble; 53 class FullscreenExitBubble;
50 class HtmlDialogUIDelegate; 54 class HtmlDialogUIDelegate;
51 class InfoBarContainerView; 55 class InfoBarContainerView;
52 class LocationBarView; 56 class LocationBarView;
53 class SideTabStrip; 57 class SideTabStrip;
54 class StatusBubbleViews; 58 class StatusBubbleViews;
55 class TabContentsContainer; 59 class TabContentsContainer;
56 class TabStripModel; 60 class TabStripModel;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // instance of this object, typically) for a given native window, or NULL if 102 // instance of this object, typically) for a given native window, or NULL if
99 // there is no such association. 103 // there is no such association.
100 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window); 104 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
101 105
102 // Returns a Browser instance of this view. 106 // Returns a Browser instance of this view.
103 Browser* browser() const { return browser_.get(); } 107 Browser* browser() const { return browser_.get(); }
104 108
105 // Returns the apparent bounds of the toolbar, in BrowserView coordinates. 109 // Returns the apparent bounds of the toolbar, in BrowserView coordinates.
106 // These differ from |toolbar_.bounds()| in that they match where the toolbar 110 // These differ from |toolbar_.bounds()| in that they match where the toolbar
107 // background image is drawn -- slightly outside the "true" bounds 111 // background image is drawn -- slightly outside the "true" bounds
108 // horizontally, and, when using vertical tabs, behind the tab column. 112 // horizontally, and, when using vertical tabs, behind the tab column. Note
113 // that this returns the bounds for the toolbar area, which could just be the
114 // spacer bounds if in compact navigation mode.
109 virtual gfx::Rect GetToolbarBounds() const; 115 virtual gfx::Rect GetToolbarBounds() const;
110 116
111 // Returns the bounds of the content area, in the coordinates of the 117 // Returns the bounds of the content area, in the coordinates of the
112 // BrowserView's parent. 118 // BrowserView's parent.
113 gfx::Rect GetClientAreaBounds() const; 119 gfx::Rect GetClientAreaBounds() const;
114 120
115 // Returns the constraining bounding box that should be used to lay out the 121 // Returns the constraining bounding box that should be used to lay out the
116 // FindBar within. This is _not_ the size of the find bar, just the bounding 122 // FindBar within. This is _not_ the size of the find bar, just the bounding
117 // box it should be laid out within. The coordinate system of the returned 123 // box it should be laid out within. The coordinate system of the returned
118 // rect is in the coordinate system of the frame, since the FindBar is a child 124 // rect is in the coordinate system of the frame, since the FindBar is a child
119 // window. 125 // window.
120 gfx::Rect GetFindBarBoundingBox() const; 126 gfx::Rect GetFindBarBoundingBox() const;
121 127
128 // Returns the bounds of the compact navigation bar (back and forward
129 // buttons).
130 gfx::Rect GetCompactNavigationBarBounds() const;
131
132 // Returns the bounds of the compact options bar (browser actions and app
133 // menu).
134 gfx::Rect GetCompactOptionsBarBounds() const;
135
122 // Returns the preferred height of the TabStrip. Used to position the OTR 136 // Returns the preferred height of the TabStrip. Used to position the OTR
123 // avatar icon. 137 // avatar icon.
124 virtual int GetTabStripHeight() const; 138 virtual int GetTabStripHeight() const;
125 139
126 // Takes some view's origin (relative to this BrowserView) and offsets it such 140 // Takes some view's origin (relative to this BrowserView) and offsets it such
127 // that it can be used as the source origin for seamlessly tiling the toolbar 141 // that it can be used as the source origin for seamlessly tiling the toolbar
128 // background image over that view. 142 // background image over that view.
129 gfx::Point OffsetPointForToolbarBackgroundImage( 143 gfx::Point OffsetPointForToolbarBackgroundImage(
130 const gfx::Point& point) const; 144 const gfx::Point& point) const;
131 145
132 // Returns the width of the currently displayed sidebar or 0. 146 // Returns the width of the currently displayed sidebar or 0.
133 int GetSidebarWidth() const; 147 int GetSidebarWidth() const;
134 148
135 // Accessor for the TabStrip. 149 // Accessor for the TabStrip.
136 AbstractTabStripView* tabstrip() const { return tabstrip_; } 150 AbstractTabStripView* tabstrip() const { return tabstrip_; }
137 151
138 // Accessor for the Toolbar. 152 // Accessor for the Toolbar.
139 ToolbarView* toolbar() const { return toolbar_; } 153 ToolbarView* toolbar() const { return toolbar_; }
140 154
141 // Returns true if various window components are visible. 155 // Returns true if various window components are visible.
142 virtual bool IsTabStripVisible() const; 156 virtual bool IsTabStripVisible() const;
143 157
144 // Returns true if the vertical tabstrip is in use. 158 // Returns true if the vertical tabstrip is in use.
145 bool UseVerticalTabs() const; 159 bool UseVerticalTabs() const;
146 160
161 // Returns true if the compact navigation bar is in use.
162 bool UseCompactNavigationBar() const;
163
147 // Returns true if the profile associated with this Browser window is 164 // Returns true if the profile associated with this Browser window is
148 // incognito. 165 // incognito.
149 bool IsOffTheRecord() const; 166 bool IsOffTheRecord() const;
150 167
151 // Returns true if the non-client view should render the Incognito 168 // Returns true if the non-client view should render the Incognito
152 // avatar icon if the window is incognito. 169 // avatar icon if the window is incognito.
153 virtual bool ShouldShowOffTheRecordAvatar() const; 170 virtual bool ShouldShowOffTheRecordAvatar() const;
154 171
155 // Handle the specified |accelerator| being pressed. 172 // Handle the specified |accelerator| being pressed.
156 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); 173 virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 virtual bool IsFullscreenBubbleVisible() const; 230 virtual bool IsFullscreenBubbleVisible() const;
214 231
215 // Invoked from the frame when the full screen state changes. This is only 232 // Invoked from the frame when the full screen state changes. This is only
216 // used on Linux. 233 // used on Linux.
217 void FullScreenStateChanged(); 234 void FullScreenStateChanged();
218 235
219 // Restores the focused view. This is also used to set the initial focus 236 // Restores the focused view. This is also used to set the initial focus
220 // when a new browser window is created. 237 // when a new browser window is created.
221 void RestoreFocus(); 238 void RestoreFocus();
222 239
240 // Access the CompactLocationBarHost.
241 CompactLocationBarViewHost* compact_location_bar_view_host() {
242 return compact_location_bar_view_host_.get();
243 }
244
223 // Overridden from BrowserWindow: 245 // Overridden from BrowserWindow:
224 virtual void Show() OVERRIDE; 246 virtual void Show() OVERRIDE;
225 virtual void ShowInactive() OVERRIDE; 247 virtual void ShowInactive() OVERRIDE;
226 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 248 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
227 virtual void Close() OVERRIDE; 249 virtual void Close() OVERRIDE;
228 virtual void Activate() OVERRIDE; 250 virtual void Activate() OVERRIDE;
229 virtual void Deactivate() OVERRIDE; 251 virtual void Deactivate() OVERRIDE;
230 virtual bool IsActive() const OVERRIDE; 252 virtual bool IsActive() const OVERRIDE;
231 virtual void FlashFrame() OVERRIDE; 253 virtual void FlashFrame() OVERRIDE;
232 virtual gfx::NativeWindow GetNativeHandle() OVERRIDE; 254 virtual gfx::NativeWindow GetNativeHandle() OVERRIDE;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 bool show_history) OVERRIDE; 313 bool show_history) OVERRIDE;
292 virtual void ShowAppMenu() OVERRIDE; 314 virtual void ShowAppMenu() OVERRIDE;
293 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, 315 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
294 bool* is_keyboard_shortcut) OVERRIDE; 316 bool* is_keyboard_shortcut) OVERRIDE;
295 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) 317 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event)
296 OVERRIDE; 318 OVERRIDE;
297 virtual void ShowCreateWebAppShortcutsDialog(TabContentsWrapper* tab_contents) 319 virtual void ShowCreateWebAppShortcutsDialog(TabContentsWrapper* tab_contents)
298 OVERRIDE; 320 OVERRIDE;
299 virtual void ShowCreateChromeAppShortcutsDialog( 321 virtual void ShowCreateChromeAppShortcutsDialog(
300 Profile*, const Extension* app) OVERRIDE; 322 Profile*, const Extension* app) OVERRIDE;
323 virtual void ToggleUseCompactNavigationBar() OVERRIDE;
301 virtual void Cut() OVERRIDE; 324 virtual void Cut() OVERRIDE;
302 virtual void Copy() OVERRIDE; 325 virtual void Copy() OVERRIDE;
303 virtual void Paste() OVERRIDE; 326 virtual void Paste() OVERRIDE;
304 virtual void ToggleTabStripMode() OVERRIDE; 327 virtual void ToggleTabStripMode() OVERRIDE;
305 virtual void PrepareForInstant() OVERRIDE; 328 virtual void PrepareForInstant() OVERRIDE;
306 virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE; 329 virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE;
307 virtual void HideInstant(bool instant_is_active) OVERRIDE; 330 virtual void HideInstant(bool instant_is_active) OVERRIDE;
308 virtual gfx::Rect GetInstantBounds() OVERRIDE; 331 virtual gfx::Rect GetInstantBounds() OVERRIDE;
309 virtual WindowOpenDisposition GetDispositionForPopupBounds( 332 virtual WindowOpenDisposition GetDispositionForPopupBounds(
310 const gfx::Rect& bounds) OVERRIDE; 333 const gfx::Rect& bounds) OVERRIDE;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 virtual ToolbarView* CreateToolbar() const; 446 virtual ToolbarView* CreateToolbar() const;
424 447
425 // Browser window related initializations. 448 // Browser window related initializations.
426 virtual void Init(); 449 virtual void Init();
427 450
428 // Callback for the loading animation(s) associated with this view. 451 // Callback for the loading animation(s) associated with this view.
429 virtual void LoadingAnimationCallback(); 452 virtual void LoadingAnimationCallback();
430 453
431 private: 454 private:
432 friend class BrowserViewLayout; 455 friend class BrowserViewLayout;
456 friend class CompactLocationBarHostTest;
433 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, 457 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest,
434 TestAboutChromeViewAccObj); 458 TestAboutChromeViewAccObj);
435 459
436 #if defined(OS_WIN) 460 #if defined(OS_WIN)
437 // Creates the system menu. 461 // Creates the system menu.
438 void InitSystemMenu(); 462 void InitSystemMenu();
439 #endif 463 #endif
440 464
441 // Returns the BrowserViewLayout. 465 // Returns the BrowserViewLayout.
442 BrowserViewLayout* GetBrowserViewLayout() const; 466 BrowserViewLayout* GetBrowserViewLayout() const;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 // has already been added to the view hierarchy. 537 // has already been added to the view hierarchy.
514 void ProcessTabSelected(TabContentsWrapper* new_contents, 538 void ProcessTabSelected(TabContentsWrapper* new_contents,
515 bool change_tab_contents); 539 bool change_tab_contents);
516 540
517 // Exposes resize corner size to BrowserViewLayout. 541 // Exposes resize corner size to BrowserViewLayout.
518 gfx::Size GetResizeCornerSize() const; 542 gfx::Size GetResizeCornerSize() const;
519 543
520 // Shows the about chrome modal dialog and returns the Window object. 544 // Shows the about chrome modal dialog and returns the Window object.
521 views::Window* DoShowAboutChromeDialog(); 545 views::Window* DoShowAboutChromeDialog();
522 546
523 // Set the value of |toolbar_| and hook it into the views hiearchy 547 // Shows the Compact Location Bar under the selected tab.
548 void ShowCompactLocationBarUnderSelectedTab();
549
550 // Set the value of |toolbar_| and hook it into the views hierarchy
524 void SetToolbar(ToolbarView* toolbar); 551 void SetToolbar(ToolbarView* toolbar);
525 552
526 // Last focused view that issued a tab traversal. 553 // Last focused view that issued a tab traversal.
527 int last_focused_view_storage_id_; 554 int last_focused_view_storage_id_;
528 555
529 // The BrowserFrame that hosts this view. 556 // The BrowserFrame that hosts this view.
530 BrowserFrame* frame_; 557 BrowserFrame* frame_;
531 558
532 // The Browser object we are associated with. 559 // The Browser object we are associated with.
533 scoped_ptr<Browser> browser_; 560 scoped_ptr<Browser> browser_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing, 604 // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing,
578 // or is bookmark_bar_view_ if the bookmark bar is showing. 605 // or is bookmark_bar_view_ if the bookmark bar is showing.
579 views::View* active_bookmark_bar_; 606 views::View* active_bookmark_bar_;
580 607
581 // The TabStrip. 608 // The TabStrip.
582 AbstractTabStripView* tabstrip_; 609 AbstractTabStripView* tabstrip_;
583 610
584 // The Toolbar containing the navigation buttons, menus and the address bar. 611 // The Toolbar containing the navigation buttons, menus and the address bar.
585 ToolbarView* toolbar_; 612 ToolbarView* toolbar_;
586 613
614 // CompactNavigationBar view.
615 CompactNavigationBar* compact_navigation_bar_;
616
617 // CompactOptionsBar view.
618 CompactOptionsBar* compact_options_bar_;
619
620 // CompactLocationBarHost.
621 scoped_ptr<CompactLocationBarViewHost> compact_location_bar_view_host_;
622
623 // A spacer under the tap strip used when the compact navigation bar
624 // is active.
625 views::View* spacer_;
626
587 // The Bookmark Bar View for this window. Lazily created. 627 // The Bookmark Bar View for this window. Lazily created.
588 scoped_ptr<BookmarkBarView> bookmark_bar_view_; 628 scoped_ptr<BookmarkBarView> bookmark_bar_view_;
589 629
590 // The download shelf view (view at the bottom of the page). 630 // The download shelf view (view at the bottom of the page).
591 scoped_ptr<DownloadShelfView> download_shelf_; 631 scoped_ptr<DownloadShelfView> download_shelf_;
592 632
593 // The InfoBarContainerView that contains InfoBars for the current tab. 633 // The InfoBarContainerView that contains InfoBars for the current tab.
594 InfoBarContainerView* infobar_container_; 634 InfoBarContainerView* infobar_container_;
595 635
596 // The view that contains sidebar for the current tab. 636 // The view that contains sidebar for the current tab.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 709
670 NotificationRegistrar registrar_; 710 NotificationRegistrar registrar_;
671 711
672 // Used to measure the loading spinner animation rate. 712 // Used to measure the loading spinner animation rate.
673 base::TimeTicks last_animation_time_; 713 base::TimeTicks last_animation_time_;
674 714
675 DISALLOW_COPY_AND_ASSIGN(BrowserView); 715 DISALLOW_COPY_AND_ASSIGN(BrowserView);
676 }; 716 };
677 717
678 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ 718 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698