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

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

Issue 1169823005: Add sidebar views implementation using ExtensionSystem SidebarManager Base URL: https://chromium.googlesource.com/chromium/src.git@patch-a
Patch Set: Rebased patch set to 1168383002/#ps220001 Created 5 years, 3 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
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_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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/ui/views/frame/browser_frame.h" 23 #include "chrome/browser/ui/views/frame/browser_frame.h"
24 #include "chrome/browser/ui/views/frame/contents_web_view.h" 24 #include "chrome/browser/ui/views/frame/contents_web_view.h"
25 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 25 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
26 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" 26 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
27 #include "chrome/browser/ui/views/load_complete_listener.h" 27 #include "chrome/browser/ui/views/load_complete_listener.h"
28 #include "components/omnibox/browser/omnibox_popup_model_observer.h" 28 #include "components/omnibox/browser/omnibox_popup_model_observer.h"
29 #include "ui/base/accelerators/accelerator.h" 29 #include "ui/base/accelerators/accelerator.h"
30 #include "ui/base/models/simple_menu_model.h" 30 #include "ui/base/models/simple_menu_model.h"
31 #include "ui/gfx/native_widget_types.h" 31 #include "ui/gfx/native_widget_types.h"
32 #include "ui/views/controls/button/button.h" 32 #include "ui/views/controls/button/button.h"
33 #include "ui/views/controls/single_split_view_listener.h"
33 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" 34 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
34 #include "ui/views/widget/widget_delegate.h" 35 #include "ui/views/widget/widget_delegate.h"
35 #include "ui/views/widget/widget_observer.h" 36 #include "ui/views/widget/widget_observer.h"
36 #include "ui/views/window/client_view.h" 37 #include "ui/views/window/client_view.h"
37 38
38 #if defined(OS_WIN) 39 #if defined(OS_WIN)
39 #include "chrome/browser/hang_monitor/hung_plugin_action.h" 40 #include "chrome/browser/hang_monitor/hung_plugin_action.h"
40 #include "chrome/browser/hang_monitor/hung_window_detector.h" 41 #include "chrome/browser/hang_monitor/hung_window_detector.h"
41 #endif 42 #endif
42 43
(...skipping 18 matching lines...) Expand all
61 class JumpList; 62 class JumpList;
62 #endif 63 #endif
63 64
64 namespace extensions { 65 namespace extensions {
65 class Extension; 66 class Extension;
66 } 67 }
67 68
68 namespace views { 69 namespace views {
69 class AccessiblePaneView; 70 class AccessiblePaneView;
70 class ExternalFocusTracker; 71 class ExternalFocusTracker;
72 class SingleSplitView;
71 class WebView; 73 class WebView;
72 } 74 }
73 75
74 /////////////////////////////////////////////////////////////////////////////// 76 ///////////////////////////////////////////////////////////////////////////////
75 // BrowserView 77 // BrowserView
76 // 78 //
77 // A ClientView subclass that provides the contents of a browser window, 79 // A ClientView subclass that provides the contents of a browser window,
78 // including the TabStrip, toolbars, download shelves, the content area etc. 80 // including the TabStrip, toolbars, download shelves, the content area etc.
79 // 81 //
80 class BrowserView : public BrowserWindow, 82 class BrowserView : public BrowserWindow,
81 public TabStripModelObserver, 83 public TabStripModelObserver,
82 public ui::AcceleratorProvider, 84 public ui::AcceleratorProvider,
83 public views::WidgetDelegate, 85 public views::WidgetDelegate,
84 public views::WidgetObserver, 86 public views::WidgetObserver,
85 public views::ClientView, 87 public views::ClientView,
86 public InfoBarContainerDelegate, 88 public InfoBarContainerDelegate,
87 public LoadCompleteListener::Delegate, 89 public LoadCompleteListener::Delegate,
88 public OmniboxPopupModelObserver, 90 public OmniboxPopupModelObserver,
91 public views::SingleSplitViewListener,
89 public ExclusiveAccessContext, 92 public ExclusiveAccessContext,
90 public ExclusiveAccessBubbleViewsContext { 93 public ExclusiveAccessBubbleViewsContext {
91 public: 94 public:
92 // The browser view's class name. 95 // The browser view's class name.
93 static const char kViewClassName[]; 96 static const char kViewClassName[];
94 97
95 BrowserView(); 98 BrowserView();
96 ~BrowserView() override; 99 ~BrowserView() override;
97 100
98 // Takes ownership of |browser|. 101 // Takes ownership of |browser|.
99 void Init(Browser* browser); 102 void Init(Browser* browser);
100 103
101 void set_frame(BrowserFrame* frame) { frame_ = frame; } 104 void set_frame(BrowserFrame* frame) { frame_ = frame; }
102 BrowserFrame* frame() const { return frame_; } 105 BrowserFrame* frame() const { return frame_; }
103 106 int GetSidebarWidth() const;
104 // Returns a pointer to the BrowserView* interface implementation (an 107 // Returns a pointer to the BrowserView* interface implementation (an
105 // instance of this object, typically) for a given native window, or null if 108 // instance of this object, typically) for a given native window, or null if
106 // there is no such association. 109 // there is no such association.
107 // 110 //
108 // Don't use this unless you only have a NativeWindow. In nearly all 111 // Don't use this unless you only have a NativeWindow. In nearly all
109 // situations plumb through browser and use it. 112 // situations plumb through browser and use it.
110 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window); 113 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
111 114
112 // Returns the BrowserView used for the specified Browser. 115 // Returns the BrowserView used for the specified Browser.
113 static BrowserView* GetBrowserViewForBrowser(const Browser* browser); 116 static BrowserView* GetBrowserViewForBrowser(const Browser* browser);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 ExclusiveAccessManager* GetExclusiveAccessManager() override; 452 ExclusiveAccessManager* GetExclusiveAccessManager() override;
450 bool IsImmersiveModeEnabled() override; 453 bool IsImmersiveModeEnabled() override;
451 views::Widget* GetBubbleAssociatedWidget() override; 454 views::Widget* GetBubbleAssociatedWidget() override;
452 gfx::Rect GetTopContainerBoundsInScreen() override; 455 gfx::Rect GetTopContainerBoundsInScreen() override;
453 456
454 // Testing interface: 457 // Testing interface:
455 views::View* GetContentsContainerForTest() { return contents_container_; } 458 views::View* GetContentsContainerForTest() { return contents_container_; }
456 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } 459 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; }
457 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; } 460 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; }
458 461
462 // Handle Sidebar
463 void ShowSidebar(content::WebContents* sidebar_contents);
464 void HideSidebar();
465
459 private: 466 private:
460 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate 467 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
461 // interface to keep these two classes decoupled and testable. 468 // interface to keep these two classes decoupled and testable.
462 friend class BrowserViewLayoutDelegateImpl; 469 friend class BrowserViewLayoutDelegateImpl;
463 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); 470 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView);
464 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, 471 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest,
465 TestAboutChromeViewAccObj); 472 TestAboutChromeViewAccObj);
466 473
467 enum FullscreenMode { 474 enum FullscreenMode {
468 NORMAL_FULLSCREEN, 475 NORMAL_FULLSCREEN,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 // This method will not update actual DevTools WebContents, if not 520 // This method will not update actual DevTools WebContents, if not
514 // |update_devtools_web_contents|. In this case, manual update is required. 521 // |update_devtools_web_contents|. In this case, manual update is required.
515 void UpdateDevToolsForContents(content::WebContents* web_contents, 522 void UpdateDevToolsForContents(content::WebContents* web_contents,
516 bool update_devtools_web_contents); 523 bool update_devtools_web_contents);
517 524
518 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the 525 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
519 // Download Shelf in response to a change notification from the specified 526 // Download Shelf in response to a change notification from the specified
520 // |contents|. |contents| can be null. In this case, all optional UI will be 527 // |contents|. |contents| can be null. In this case, all optional UI will be
521 // removed. 528 // removed.
522 void UpdateUIForContents(content::WebContents* contents); 529 void UpdateUIForContents(content::WebContents* contents);
523 530 bool SplitHandleMoved(views::SingleSplitView* sender) override;
524 // Invoked to update the necessary things when our fullscreen state changes 531 // Invoked to update the necessary things when our fullscreen state changes
525 // to |fullscreen|. On Windows this is invoked immediately when we toggle the 532 // to |fullscreen|. On Windows this is invoked immediately when we toggle the
526 // full screen state. On Linux changing the fullscreen state is async, so we 533 // full screen state. On Linux changing the fullscreen state is async, so we
527 // ask the window to change its fullscreen state, then when we get 534 // ask the window to change its fullscreen state, then when we get
528 // notification that it succeeded this method is invoked. 535 // notification that it succeeded this method is invoked.
529 // If |url| is not empty, it is the URL of the page that requested fullscreen 536 // If |url| is not empty, it is the URL of the page that requested fullscreen
530 // (via the fullscreen JS API). 537 // (via the fullscreen JS API).
531 // |bubble_type| determines what should be shown in the fullscreen exit 538 // |bubble_type| determines what should be shown in the fullscreen exit
532 // bubble. 539 // bubble.
533 void ProcessFullscreen(bool fullscreen, 540 void ProcessFullscreen(bool fullscreen,
534 FullscreenMode mode, 541 FullscreenMode mode,
535 const GURL& url, 542 const GURL& url,
536 ExclusiveAccessBubbleType bubble_type); 543 ExclusiveAccessBubbleType bubble_type);
537 544
538 // Returns whether immmersive fullscreen should replace fullscreen. This 545 // Returns whether immmersive fullscreen should replace fullscreen. This
539 // should only occur for "browser-fullscreen" for tabbed-typed windows (not 546 // should only occur for "browser-fullscreen" for tabbed-typed windows (not
540 // for tab-fullscreen and not for app/popup type windows). 547 // for tab-fullscreen and not for app/popup type windows).
541 bool ShouldUseImmersiveFullscreenForUrl(const GURL& url) const; 548 bool ShouldUseImmersiveFullscreenForUrl(const GURL& url) const;
542 549
543 // Copy the accelerator table from the app resources into something we can 550 // Copy the accelerator table from the app resources into something we can
544 // use. 551 // use.
545 void LoadAccelerators(); 552 void LoadAccelerators();
546 553
547 // Retrieves the command id for the specified Windows app command. 554 // Retrieves the command id for the specified Windows app command.
548 int GetCommandIDForAppCommandID(int app_command_id) const; 555 int GetCommandIDForAppCommandID(int app_command_id) const;
549 556
550 // Initialize the hung plugin detector. 557 // Initialize the hung plugin detector.
551 void InitHangMonitor(); 558 void InitHangMonitor();
559 void UpdateSidebarForContents(content::WebContents* sidebar_contents);
552 560
553 // Possibly records a user metrics action corresponding to the passed-in 561 // Possibly records a user metrics action corresponding to the passed-in
554 // accelerator. Only implemented for Chrome OS, where we're interested in 562 // accelerator. Only implemented for Chrome OS, where we're interested in
555 // learning about how frequently the top-row keys are used. 563 // learning about how frequently the top-row keys are used.
556 void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator, 564 void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
557 int command_id); 565 int command_id);
558 566
559 // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste on 567 // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste on
560 // the given WebContents, returning true if it consumed the event. 568 // the given WebContents, returning true if it consumed the event.
561 bool DoCutCopyPasteForWebContents( 569 bool DoCutCopyPasteForWebContents(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 692
685 // The custom JumpList for Windows 7. 693 // The custom JumpList for Windows 7.
686 scoped_refptr<JumpList> jumplist_; 694 scoped_refptr<JumpList> jumplist_;
687 #endif 695 #endif
688 696
689 // The timer used to update frames for the Loading Animation. 697 // The timer used to update frames for the Loading Animation.
690 base::RepeatingTimer<BrowserView> loading_animation_timer_; 698 base::RepeatingTimer<BrowserView> loading_animation_timer_;
691 699
692 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; 700 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
693 701
702 views::WebView* sidebar_web_view_;
703
704 views::View* sidebar_container_;
705
706 views::SingleSplitView* sidebar_split_;
707
694 // Used to measure the loading spinner animation rate. 708 // Used to measure the loading spinner animation rate.
695 base::TimeTicks last_animation_time_; 709 base::TimeTicks last_animation_time_;
696 710
697 // If this flag is set then SetFocusToLocationBar() will set focus to the 711 // If this flag is set then SetFocusToLocationBar() will set focus to the
698 // location bar even if the browser window is not active. 712 // location bar even if the browser window is not active.
699 bool force_location_bar_focus_; 713 bool force_location_bar_focus_;
700 714
701 scoped_ptr<ImmersiveModeController> immersive_mode_controller_; 715 scoped_ptr<ImmersiveModeController> immersive_mode_controller_;
702 716
703 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_; 717 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_;
704 718
705 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; 719 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_;
706 720
707 DISALLOW_COPY_AND_ASSIGN(BrowserView); 721 DISALLOW_COPY_AND_ASSIGN(BrowserView);
708 }; 722 };
709 723
710 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ 724 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698