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

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

Issue 9006027: Rip Out the Sidebar API (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years 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/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/infobars/infobar_container.h" 17 #include "chrome/browser/infobars/infobar_container.h"
18 #include "chrome/browser/tabs/tab_strip_model_observer.h" 18 #include "chrome/browser/tabs/tab_strip_model_observer.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/views/frame/browser_frame.h" 21 #include "chrome/browser/ui/views/frame/browser_frame.h"
22 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" 22 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
23 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" 23 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h"
24 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" 24 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
25 #include "content/public/browser/notification_registrar.h"
26 #include "ui/base/models/simple_menu_model.h" 25 #include "ui/base/models/simple_menu_model.h"
27 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
28 #include "ui/views/controls/single_split_view_listener.h" 27 #include "ui/views/controls/single_split_view_listener.h"
29 #include "ui/views/widget/widget_delegate.h" 28 #include "ui/views/widget/widget_delegate.h"
30 #include "ui/views/window/client_view.h" 29 #include "ui/views/window/client_view.h"
31 30
32 #if defined(OS_WIN) 31 #if defined(OS_WIN)
33 #include "chrome/browser/hang_monitor/hung_plugin_action.h" 32 #include "chrome/browser/hang_monitor/hung_plugin_action.h"
34 #include "chrome/browser/hang_monitor/hung_window_detector.h" 33 #include "chrome/browser/hang_monitor/hung_window_detector.h"
35 #include "ui/views/controls/menu/native_menu_win.h" 34 #include "ui/views/controls/menu/native_menu_win.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 73 }
75 74
76 /////////////////////////////////////////////////////////////////////////////// 75 ///////////////////////////////////////////////////////////////////////////////
77 // BrowserView 76 // BrowserView
78 // 77 //
79 // A ClientView subclass that provides the contents of a browser window, 78 // A ClientView subclass that provides the contents of a browser window,
80 // including the TabStrip, toolbars, download shelves, the content area etc. 79 // including the TabStrip, toolbars, download shelves, the content area etc.
81 // 80 //
82 class BrowserView : public BrowserWindow, 81 class BrowserView : public BrowserWindow,
83 public BrowserWindowTesting, 82 public BrowserWindowTesting,
84 public content::NotificationObserver,
85 public TabStripModelObserver, 83 public TabStripModelObserver,
86 public ui::SimpleMenuModel::Delegate, 84 public ui::SimpleMenuModel::Delegate,
87 public views::WidgetDelegate, 85 public views::WidgetDelegate,
88 public views::Widget::Observer, 86 public views::Widget::Observer,
89 public views::ClientView, 87 public views::ClientView,
90 public InfoBarContainer::Delegate, 88 public InfoBarContainer::Delegate,
91 public views::SingleSplitViewListener { 89 public views::SingleSplitViewListener {
92 public: 90 public:
93 // The browser view's class name. 91 // The browser view's class name.
94 static const char kViewClassName[]; 92 static const char kViewClassName[];
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Returns the preferred height of the TabStrip. Used to position the OTR 133 // Returns the preferred height of the TabStrip. Used to position the OTR
136 // avatar icon. 134 // avatar icon.
137 virtual int GetTabStripHeight() const; 135 virtual int GetTabStripHeight() const;
138 136
139 // Takes some view's origin (relative to this BrowserView) and offsets it such 137 // Takes some view's origin (relative to this BrowserView) and offsets it such
140 // that it can be used as the source origin for seamlessly tiling the toolbar 138 // that it can be used as the source origin for seamlessly tiling the toolbar
141 // background image over that view. 139 // background image over that view.
142 gfx::Point OffsetPointForToolbarBackgroundImage( 140 gfx::Point OffsetPointForToolbarBackgroundImage(
143 const gfx::Point& point) const; 141 const gfx::Point& point) const;
144 142
145 // Returns the width of the currently displayed sidebar or 0.
146 int GetSidebarWidth() const;
147
148 // Accessor for the TabStrip. 143 // Accessor for the TabStrip.
149 AbstractTabStripView* tabstrip() const { return tabstrip_; } 144 AbstractTabStripView* tabstrip() const { return tabstrip_; }
150 145
151 // Accessor for the Toolbar. 146 // Accessor for the Toolbar.
152 ToolbarView* toolbar() const { return toolbar_; } 147 ToolbarView* toolbar() const { return toolbar_; }
153 148
154 // Returns true if various window components are visible. 149 // Returns true if various window components are visible.
155 virtual bool IsTabStripVisible() const; 150 virtual bool IsTabStripVisible() const;
156 151
157 // Returns true if the profile associated with this Browser window is 152 // Returns true if the profile associated with this Browser window is
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 virtual void ShowKeyboardOverlay(gfx::NativeWindow owning_window) OVERRIDE; 334 virtual void ShowKeyboardOverlay(gfx::NativeWindow owning_window) OVERRIDE;
340 #endif 335 #endif
341 virtual void ShowAvatarBubble(TabContents* tab_contents, 336 virtual void ShowAvatarBubble(TabContents* tab_contents,
342 const gfx::Rect& rect) OVERRIDE; 337 const gfx::Rect& rect) OVERRIDE;
343 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; 338 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE;
344 339
345 // Overridden from BrowserWindowTesting: 340 // Overridden from BrowserWindowTesting:
346 virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE; 341 virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE;
347 virtual LocationBarView* GetLocationBarView() const OVERRIDE; 342 virtual LocationBarView* GetLocationBarView() const OVERRIDE;
348 virtual views::View* GetTabContentsContainerView() const OVERRIDE; 343 virtual views::View* GetTabContentsContainerView() const OVERRIDE;
349 virtual views::View* GetSidebarContainerView() const OVERRIDE;
350 virtual ToolbarView* GetToolbarView() const OVERRIDE; 344 virtual ToolbarView* GetToolbarView() const OVERRIDE;
351 345
352 // Overridden from content::NotificationObserver:
353 virtual void Observe(int type,
354 const content::NotificationSource& source,
355 const content::NotificationDetails& details) OVERRIDE;
356
357 // Overridden from TabStripModelObserver: 346 // Overridden from TabStripModelObserver:
358 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; 347 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE;
359 virtual void TabDeactivated(TabContentsWrapper* contents) OVERRIDE; 348 virtual void TabDeactivated(TabContentsWrapper* contents) OVERRIDE;
360 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, 349 virtual void ActiveTabChanged(TabContentsWrapper* old_contents,
361 TabContentsWrapper* new_contents, 350 TabContentsWrapper* new_contents,
362 int index, 351 int index,
363 bool user_gesture) OVERRIDE; 352 bool user_gesture) OVERRIDE;
364 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 353 virtual void TabReplacedAt(TabStripModel* tab_strip_model,
365 TabContentsWrapper* old_contents, 354 TabContentsWrapper* old_contents,
366 TabContentsWrapper* new_contents, 355 TabContentsWrapper* new_contents,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // Browser type) and there should be a subsequent re-layout to show it. 482 // Browser type) and there should be a subsequent re-layout to show it.
494 // |contents| can be NULL. 483 // |contents| can be NULL.
495 bool MaybeShowBookmarkBar(TabContentsWrapper* contents); 484 bool MaybeShowBookmarkBar(TabContentsWrapper* contents);
496 485
497 // Prepare to show an Info Bar for the specified TabContents. Returns true 486 // Prepare to show an Info Bar for the specified TabContents. Returns true
498 // if there is an Info Bar to show and one is supported for this Browser 487 // if there is an Info Bar to show and one is supported for this Browser
499 // type, and there should be a subsequent re-layout to show it. 488 // type, and there should be a subsequent re-layout to show it.
500 // |contents| can be NULL. 489 // |contents| can be NULL.
501 bool MaybeShowInfoBar(TabContentsWrapper* contents); 490 bool MaybeShowInfoBar(TabContentsWrapper* contents);
502 491
503 // Updates sidebar UI according to the current tab and sidebar state.
504 void UpdateSidebar();
505 // Displays active sidebar linked to the |tab_contents| or hides sidebar UI,
506 // if there's no such sidebar.
507 void UpdateSidebarForContents(TabContentsWrapper* tab_contents);
508
509 // Updated devtools window for given contents. 492 // Updated devtools window for given contents.
510 void UpdateDevToolsForContents(TabContentsWrapper* tab_contents); 493 void UpdateDevToolsForContents(TabContentsWrapper* tab_contents);
511 494
512 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the 495 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
513 // Download Shelf in response to a change notification from the specified 496 // Download Shelf in response to a change notification from the specified
514 // |contents|. |contents| can be NULL. In this case, all optional UI will be 497 // |contents|. |contents| can be NULL. In this case, all optional UI will be
515 // removed. 498 // removed.
516 void UpdateUIForContents(TabContentsWrapper* contents); 499 void UpdateUIForContents(TabContentsWrapper* contents);
517 500
518 // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download 501 // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 // 569 //
587 // ---------------------------------------------------------------- 570 // ----------------------------------------------------------------
588 // | Tabs (1) | 571 // | Tabs (1) |
589 // |--------------------------------------------------------------| 572 // |--------------------------------------------------------------|
590 // | Navigation buttons, menus and the address bar (toolbar_) | 573 // | Navigation buttons, menus and the address bar (toolbar_) |
591 // |--------------------------------------------------------------| 574 // |--------------------------------------------------------------|
592 // | All infobars (infobar_container_) * | 575 // | All infobars (infobar_container_) * |
593 // |--------------------------------------------------------------| 576 // |--------------------------------------------------------------|
594 // | Bookmarks (bookmark_bar_view_) * | 577 // | Bookmarks (bookmark_bar_view_) * |
595 // |--------------------------------------------------------------| 578 // |--------------------------------------------------------------|
596 // |Page content (contents_) || | 579 // |Page content (contents_) ||
597 // |--------------------------------------|| Sidebar content | 580 // |-------------------------------------------------------------||
598 // || contents_container_ and/or ||| (sidebar_container_) | 581 // || contents_container_ and/or |||
599 // || preview_container_ ||| | 582 // || preview_container_ |||
600 // || |(2) | 583 // || |||
601 // || ||| | 584 // || |||
602 // || ||| | 585 // || |||
603 // || ||| | 586 // || |||
604 // || ||| | 587 // || |||
605 // |--------------------------------------|| | 588 // |-------------------------------------------------------------||
606 // |==(3)=========================================================| 589 // |==(2)=========================================================|
607 // | | 590 // | |
608 // | | 591 // | |
609 // | Debugger (devtools_container_) | 592 // | Debugger (devtools_container_) |
610 // | | 593 // | |
611 // | | 594 // | |
612 // |--------------------------------------------------------------| 595 // |--------------------------------------------------------------|
613 // | Active downloads (download_shelf_) | 596 // | Active downloads (download_shelf_) |
614 // ---------------------------------------------------------------- 597 // ----------------------------------------------------------------
615 // 598 //
616 // (1) - tabstrip_, default position 599 // (1) - tabstrip_, default position
617 // (2) - sidebar_split_ 600 // (2) - contents_split_
618 // (3) - contents_split_
619 // 601 //
620 // * - The bookmark bar and info bar are swapped when on the new tab page. 602 // * - The bookmark bar and info bar are swapped when on the new tab page.
621 // Additionally contents_ is positioned on top of the bookmark bar when 603 // Additionally contents_ is positioned on top of the bookmark bar when
622 // the bookmark bar is detached. This is done to allow the 604 // the bookmark bar is detached. This is done to allow the
623 // preview_container_ to appear over the bookmark bar. 605 // preview_container_ to appear over the bookmark bar.
624 606
625 // Tool/Info bars that we are currently showing. Used for layout. 607 // Tool/Info bars that we are currently showing. Used for layout.
626 // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing, 608 // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing,
627 // or is bookmark_bar_view_ if the bookmark bar is showing. 609 // or is bookmark_bar_view_ if the bookmark bar is showing.
628 views::View* active_bookmark_bar_; 610 views::View* active_bookmark_bar_;
629 611
630 // The TabStrip. 612 // The TabStrip.
631 AbstractTabStripView* tabstrip_; 613 AbstractTabStripView* tabstrip_;
632 614
633 // The Toolbar containing the navigation buttons, menus and the address bar. 615 // The Toolbar containing the navigation buttons, menus and the address bar.
634 ToolbarView* toolbar_; 616 ToolbarView* toolbar_;
635 617
636 // The Bookmark Bar View for this window. Lazily created. 618 // The Bookmark Bar View for this window. Lazily created.
637 scoped_ptr<BookmarkBarView> bookmark_bar_view_; 619 scoped_ptr<BookmarkBarView> bookmark_bar_view_;
638 620
639 #if !defined(OS_CHROMEOS) || defined(USE_AURA) 621 #if !defined(OS_CHROMEOS) || defined(USE_AURA)
640 // The download shelf view (view at the bottom of the page). ChromiumOS 622 // The download shelf view (view at the bottom of the page). ChromiumOS
641 // uses ActiveDownloadsUI instead. 623 // uses ActiveDownloadsUI instead.
642 scoped_ptr<DownloadShelfView> download_shelf_; 624 scoped_ptr<DownloadShelfView> download_shelf_;
643 #endif 625 #endif
644 626
645 // The InfoBarContainerView that contains InfoBars for the current tab. 627 // The InfoBarContainerView that contains InfoBars for the current tab.
646 InfoBarContainerView* infobar_container_; 628 InfoBarContainerView* infobar_container_;
647 629
648 // The view that contains sidebar for the current tab.
649 TabContentsContainer* sidebar_container_;
650
651 // Split view containing the contents container and sidebar container.
652 views::SingleSplitView* sidebar_split_;
653
654 // The view that contains the selected TabContents. 630 // The view that contains the selected TabContents.
655 TabContentsContainer* contents_container_; 631 TabContentsContainer* contents_container_;
656 632
657 // The view that contains devtools window for the selected TabContents. 633 // The view that contains devtools window for the selected TabContents.
658 TabContentsContainer* devtools_container_; 634 TabContentsContainer* devtools_container_;
659 635
660 // The view that contains instant's TabContents. 636 // The view that contains instant's TabContents.
661 TabContentsContainer* preview_container_; 637 TabContentsContainer* preview_container_;
662 638
663 // The view managing both the contents_container_ and preview_container_. 639 // The view managing both the contents_container_ and preview_container_.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 692
717 #if defined(USE_AURA) 693 #if defined(USE_AURA)
718 scoped_ptr<LauncherIconUpdater> icon_updater_; 694 scoped_ptr<LauncherIconUpdater> icon_updater_;
719 #endif 695 #endif
720 696
721 // The timer used to update frames for the Loading Animation. 697 // The timer used to update frames for the Loading Animation.
722 base::RepeatingTimer<BrowserView> loading_animation_timer_; 698 base::RepeatingTimer<BrowserView> loading_animation_timer_;
723 699
724 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; 700 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
725 701
726 content::NotificationRegistrar registrar_;
727
728 // Used to measure the loading spinner animation rate. 702 // Used to measure the loading spinner animation rate.
729 base::TimeTicks last_animation_time_; 703 base::TimeTicks last_animation_time_;
730 704
731 // If this flag is set then SetFocusToLocationBar() will set focus to the 705 // If this flag is set then SetFocusToLocationBar() will set focus to the
732 // location bar even if the browser window is not active. 706 // location bar even if the browser window is not active.
733 bool force_location_bar_focus_; 707 bool force_location_bar_focus_;
734 708
735 PendingFullscreenRequest fullscreen_request_; 709 PendingFullscreenRequest fullscreen_request_;
736 710
737 DISALLOW_COPY_AND_ASSIGN(BrowserView); 711 DISALLOW_COPY_AND_ASSIGN(BrowserView);
738 }; 712 };
739 713
740 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ 714 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698