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

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

Issue 63173016: DevTools: place DevTools WebContents underneath inspected WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 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
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 10 matching lines...) Expand all
21 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
22 #include "chrome/browser/ui/views/frame/browser_frame.h" 22 #include "chrome/browser/ui/views/frame/browser_frame.h"
23 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 23 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
24 #include "chrome/browser/ui/views/frame/scroll_end_effect_controller.h" 24 #include "chrome/browser/ui/views/frame/scroll_end_effect_controller.h"
25 #include "chrome/browser/ui/views/load_complete_listener.h" 25 #include "chrome/browser/ui/views/load_complete_listener.h"
26 #include "ui/base/accelerators/accelerator.h" 26 #include "ui/base/accelerators/accelerator.h"
27 #include "ui/base/models/simple_menu_model.h" 27 #include "ui/base/models/simple_menu_model.h"
28 #include "ui/gfx/native_widget_types.h" 28 #include "ui/gfx/native_widget_types.h"
29 #include "ui/gfx/sys_color_change_listener.h" 29 #include "ui/gfx/sys_color_change_listener.h"
30 #include "ui/views/controls/button/button.h" 30 #include "ui/views/controls/button/button.h"
31 #include "ui/views/controls/single_split_view_listener.h"
32 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" 31 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
33 #include "ui/views/widget/widget_delegate.h" 32 #include "ui/views/widget/widget_delegate.h"
34 #include "ui/views/widget/widget_observer.h" 33 #include "ui/views/widget/widget_observer.h"
35 #include "ui/views/window/client_view.h" 34 #include "ui/views/window/client_view.h"
36 35
37 #if defined(OS_WIN) 36 #if defined(OS_WIN)
38 #include "chrome/browser/hang_monitor/hung_plugin_action.h" 37 #include "chrome/browser/hang_monitor/hung_plugin_action.h"
39 #include "chrome/browser/hang_monitor/hung_window_detector.h" 38 #include "chrome/browser/hang_monitor/hung_window_detector.h"
40 #endif 39 #endif
41 40
42 // NOTE: For more information about the objects and files in this directory, 41 // NOTE: For more information about the objects and files in this directory,
43 // view: http://dev.chromium.org/developers/design-documents/browser-window 42 // view: http://dev.chromium.org/developers/design-documents/browser-window
44 43
45 class BookmarkBarView; 44 class BookmarkBarView;
46 class Browser; 45 class Browser;
47 class BrowserViewLayout; 46 class BrowserViewLayout;
48 class ContentsContainer; 47 class ContentsLayoutManager;
49 class DownloadShelfView; 48 class DownloadShelfView;
50 class FullscreenExitBubbleViews; 49 class FullscreenExitBubbleViews;
51 class InfoBarContainerView; 50 class InfoBarContainerView;
52 class LocationBarView; 51 class LocationBarView;
53 class StatusBubbleViews; 52 class StatusBubbleViews;
54 class SearchViewController; 53 class SearchViewController;
55 class TabStrip; 54 class TabStrip;
56 class TabStripModel; 55 class TabStripModel;
57 class ToolbarView; 56 class ToolbarView;
58 class TopContainerView; 57 class TopContainerView;
(...skipping 27 matching lines...) Expand all
86 // including the TabStrip, toolbars, download shelves, the content area etc. 85 // including the TabStrip, toolbars, download shelves, the content area etc.
87 // 86 //
88 class BrowserView : public BrowserWindow, 87 class BrowserView : public BrowserWindow,
89 public BrowserWindowTesting, 88 public BrowserWindowTesting,
90 public TabStripModelObserver, 89 public TabStripModelObserver,
91 public ui::AcceleratorProvider, 90 public ui::AcceleratorProvider,
92 public views::WidgetDelegate, 91 public views::WidgetDelegate,
93 public views::WidgetObserver, 92 public views::WidgetObserver,
94 public views::ClientView, 93 public views::ClientView,
95 public InfoBarContainer::Delegate, 94 public InfoBarContainer::Delegate,
96 public views::SingleSplitViewListener,
97 public gfx::SysColorChangeListener, 95 public gfx::SysColorChangeListener,
98 public LoadCompleteListener::Delegate, 96 public LoadCompleteListener::Delegate,
99 public OmniboxPopupModelObserver { 97 public OmniboxPopupModelObserver {
100 public: 98 public:
101 // The browser view's class name. 99 // The browser view's class name.
102 static const char kViewClassName[]; 100 static const char kViewClassName[];
103 101
104 BrowserView(); 102 BrowserView();
105 virtual ~BrowserView(); 103 virtual ~BrowserView();
106 104
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Overridden from views::ClientView: 425 // Overridden from views::ClientView:
428 virtual bool CanClose() OVERRIDE; 426 virtual bool CanClose() OVERRIDE;
429 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; 427 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
430 virtual gfx::Size GetMinimumSize() OVERRIDE; 428 virtual gfx::Size GetMinimumSize() OVERRIDE;
431 429
432 // InfoBarContainer::Delegate overrides 430 // InfoBarContainer::Delegate overrides
433 virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE; 431 virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE;
434 virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE; 432 virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE;
435 virtual bool DrawInfoBarArrows(int* x) const OVERRIDE; 433 virtual bool DrawInfoBarArrows(int* x) const OVERRIDE;
436 434
437 // views::SingleSplitViewListener overrides:
438 virtual bool SplitHandleMoved(views::SingleSplitView* sender) OVERRIDE;
439
440 // gfx::SysColorChangeListener overrides: 435 // gfx::SysColorChangeListener overrides:
441 virtual void OnSysColorChange() OVERRIDE; 436 virtual void OnSysColorChange() OVERRIDE;
442 437
443 // Overridden from views::View: 438 // Overridden from views::View:
444 virtual const char* GetClassName() const OVERRIDE; 439 virtual const char* GetClassName() const OVERRIDE;
445 virtual void Layout() OVERRIDE; 440 virtual void Layout() OVERRIDE;
446 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; 441 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE;
447 virtual void ViewHierarchyChanged( 442 virtual void ViewHierarchyChanged(
448 const ViewHierarchyChangedDetails& details) OVERRIDE; 443 const ViewHierarchyChangedDetails& details) OVERRIDE;
449 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; 444 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
450 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 445 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
451 446
452 // Overridden from ui::AcceleratorTarget: 447 // Overridden from ui::AcceleratorTarget:
453 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 448 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
454 449
455 // OmniboxPopupModelObserver overrides 450 // OmniboxPopupModelObserver overrides
456 virtual void OnOmniboxPopupShownOrHidden() OVERRIDE; 451 virtual void OnOmniboxPopupShownOrHidden() OVERRIDE;
457 452
458 // Testing interface: 453 // Testing interface:
459 views::SingleSplitView* GetContentsSplitForTest() { return contents_split_; } 454 views::View* GetContentsContainerForTest() { return contents_container_; }
460 ContentsContainer* GetContentsContainerForTest() {
461 return contents_container_;
462 }
463 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } 455 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; }
456 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; }
464 457
465 private: 458 private:
466 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate 459 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
467 // interface to keep these two classes decoupled and testable. 460 // interface to keep these two classes decoupled and testable.
468 friend class BrowserViewLayoutDelegateImpl; 461 friend class BrowserViewLayoutDelegateImpl;
469 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); 462 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView);
470 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, 463 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest,
471 TestAboutChromeViewAccObj); 464 TestAboutChromeViewAccObj);
472 465
473 enum FullscreenType { 466 enum FullscreenType {
(...skipping 11 matching lines...) Expand all
485 // Callback for the loading animation(s) associated with this view. 478 // Callback for the loading animation(s) associated with this view.
486 void LoadingAnimationCallback(); 479 void LoadingAnimationCallback();
487 480
488 // LoadCompleteListener::Delegate implementation. Creates and initializes the 481 // LoadCompleteListener::Delegate implementation. Creates and initializes the
489 // |jumplist_| after the first page load. 482 // |jumplist_| after the first page load.
490 virtual void OnLoadCompleted() OVERRIDE; 483 virtual void OnLoadCompleted() OVERRIDE;
491 484
492 // Returns the BrowserViewLayout. 485 // Returns the BrowserViewLayout.
493 BrowserViewLayout* GetBrowserViewLayout() const; 486 BrowserViewLayout* GetBrowserViewLayout() const;
494 487
488 // Returns the ContentsLayoutManager.
489 ContentsLayoutManager* GetContentsLayoutManager() const;
490
495 // Layout the Status Bubble. 491 // Layout the Status Bubble.
496 void LayoutStatusBubble(); 492 void LayoutStatusBubble();
497 493
498 // Prepare to show the Bookmark Bar for the specified WebContents. 494 // Prepare to show the Bookmark Bar for the specified WebContents.
499 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this 495 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this
500 // Browser type) and there should be a subsequent re-layout to show it. 496 // Browser type) and there should be a subsequent re-layout to show it.
501 // |contents| can be NULL. 497 // |contents| can be NULL.
502 bool MaybeShowBookmarkBar(content::WebContents* contents); 498 bool MaybeShowBookmarkBar(content::WebContents* contents);
503 499
504 // Moves the bookmark bar view to the specified parent, which may be NULL, 500 // Moves the bookmark bar view to the specified parent, which may be NULL,
505 // |this|, or |top_container_|. Ensures that |top_container_| stays in front 501 // |this|, or |top_container_|. Ensures that |top_container_| stays in front
506 // of |bookmark_bar_view_|. 502 // of |bookmark_bar_view_|.
507 void SetBookmarkBarParent(views::View* new_parent); 503 void SetBookmarkBarParent(views::View* new_parent);
508 504
509 // Prepare to show an Info Bar for the specified WebContents. Returns 505 // Prepare to show an Info Bar for the specified WebContents. Returns
510 // true if there is an Info Bar to show and one is supported for this Browser 506 // true if there is an Info Bar to show and one is supported for this Browser
511 // type, and there should be a subsequent re-layout to show it. 507 // type, and there should be a subsequent re-layout to show it.
512 // |contents| can be NULL. 508 // |contents| can be NULL.
513 bool MaybeShowInfoBar(content::WebContents* contents); 509 bool MaybeShowInfoBar(content::WebContents* contents);
514 510
515 // Updates devtools window for given contents. This method will show docked 511 // Updates devtools window for given contents. This method will show docked
516 // devtools window for inspected |web_contents| that has docked devtools 512 // devtools window for inspected |web_contents| that has docked devtools
517 // and hide it for NULL or not inspected |web_contents|. It will also make 513 // and hide it for NULL or not inspected |web_contents|. It will also make
518 // sure devtools window size and position are restored for given tab. 514 // sure devtools window size and position are restored for given tab.
519 void UpdateDevToolsForContents(content::WebContents* web_contents); 515 // This method will not update actual DevTools WebContents, if not
520 516 // |update_devtools_web_contents|. In this case, manual update is required.
521 // Shows docked devtools. 517 void UpdateDevToolsForContents(content::WebContents* web_contents,
522 void ShowDevToolsContainer(); 518 bool update_devtools_web_contents);
523
524 // Hides docked devtools.
525 void HideDevToolsContainer();
526
527 // Reads split position from the current tab's devtools window and applies
528 // it to the devtools split.
529 void UpdateDevToolsSplitPosition();
530 519
531 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the 520 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
532 // Download Shelf in response to a change notification from the specified 521 // Download Shelf in response to a change notification from the specified
533 // |contents|. |contents| can be NULL. In this case, all optional UI will be 522 // |contents|. |contents| can be NULL. In this case, all optional UI will be
534 // removed. 523 // removed.
535 void UpdateUIForContents(content::WebContents* contents); 524 void UpdateUIForContents(content::WebContents* contents);
536 525
537 // Invoked to update the necessary things when our fullscreen state changes 526 // Invoked to update the necessary things when our fullscreen state changes
538 // to |fullscreen|. On Windows this is invoked immediately when we toggle the 527 // to |fullscreen|. On Windows this is invoked immediately when we toggle the
539 // full screen state. On Linux changing the fullscreen state is async, so we 528 // full screen state. On Linux changing the fullscreen state is async, so we
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 // | -------------------------------------------------------------- | 593 // | -------------------------------------------------------------- |
605 // | | Tabs (tabstrip_) | | 594 // | | Tabs (tabstrip_) | |
606 // | |------------------------------------------------------------| | 595 // | |------------------------------------------------------------| |
607 // | | Navigation buttons, address bar, menu (toolbar_) | | 596 // | | Navigation buttons, address bar, menu (toolbar_) | |
608 // | -------------------------------------------------------------- | 597 // | -------------------------------------------------------------- |
609 // |------------------------------------------------------------------| 598 // |------------------------------------------------------------------|
610 // | All infobars (infobar_container_) [1] | 599 // | All infobars (infobar_container_) [1] |
611 // |------------------------------------------------------------------| 600 // |------------------------------------------------------------------|
612 // | Bookmarks (bookmark_bar_view_) [1] | 601 // | Bookmarks (bookmark_bar_view_) [1] |
613 // |------------------------------------------------------------------| 602 // |------------------------------------------------------------------|
614 // | Debugger splitter (contents_split_) | 603 // | Contents container (contents_container_) |
615 // | -------------------------------------------------------------- | 604 // | -------------------------------------------------------------- |
616 // | | Page content (contents_container_) | | 605 // | | devtools_web_view_ | |
617 // | | -------------------------------------------------------- | | 606 // | |------------------------------------------------------------| |
618 // | | | contents_web_view_ | | | 607 // | | contents_web_view_ | |
619 // | | -------------------------------------------------------- | |
620 // | -------------------------------------------------------------- |
621 // | -------------------------------------------------------------- |
622 // | | Debugger (devtools_container_) | |
623 // | | | |
624 // | -------------------------------------------------------------- | 608 // | -------------------------------------------------------------- |
625 // |------------------------------------------------------------------| 609 // |------------------------------------------------------------------|
626 // | Active downloads (download_shelf_) | 610 // | Active downloads (download_shelf_) |
627 // -------------------------------------------------------------------- 611 // --------------------------------------------------------------------
628 // 612 //
629 // [1] The bookmark bar and info bar are swapped when on the new tab page. 613 // [1] The bookmark bar and info bar are swapped when on the new tab page.
630 // Additionally when the bookmark bar is detached, contents_container_ is 614 // Additionally when the bookmark bar is detached, contents_container_ is
631 // positioned on top of the bar while the tab's contents are placed below 615 // positioned on top of the bar while the tab's contents are placed below
632 // the bar. This allows the find bar to always align with the top of 616 // the bar. This allows the find bar to always align with the top of
633 // contents_container_ regardless if there's bookmark or info bars. 617 // contents_container_ regardless if there's bookmark or info bars.
(...skipping 26 matching lines...) Expand all
660 // The download shelf view (view at the bottom of the page). 644 // The download shelf view (view at the bottom of the page).
661 scoped_ptr<DownloadShelfView> download_shelf_; 645 scoped_ptr<DownloadShelfView> download_shelf_;
662 646
663 // The InfoBarContainerView that contains InfoBars for the current tab. 647 // The InfoBarContainerView that contains InfoBars for the current tab.
664 InfoBarContainerView* infobar_container_; 648 InfoBarContainerView* infobar_container_;
665 649
666 // The view that contains the selected WebContents. 650 // The view that contains the selected WebContents.
667 views::WebView* contents_web_view_; 651 views::WebView* contents_web_view_;
668 652
669 // The view that contains devtools window for the selected WebContents. 653 // The view that contains devtools window for the selected WebContents.
670 views::WebView* devtools_container_; 654 views::WebView* devtools_web_view_;
671 655
672 // The view managing the |contents_web_view_|. 656 // The view managing the devtools and contents positions.
673 ContentsContainer* contents_container_; 657 // Handled by ContentsLayoutManager.
674 658 views::View* contents_container_;
675 // Split view containing the contents container and devtools container.
676 views::SingleSplitView* contents_split_;
677
678 // Side to dock devtools to.
679 DevToolsDockSide devtools_dock_side_;
680 659
681 // Docked devtools window instance. NULL when current tab is not inspected 660 // Docked devtools window instance. NULL when current tab is not inspected
682 // or is inspected with undocked version of DevToolsWindow. 661 // or is inspected with undocked version of DevToolsWindow.
683 DevToolsWindow* devtools_window_; 662 DevToolsWindow* devtools_window_;
684 663
685 // Tracks and stores the last focused view which is not the 664 // Tracks and stores the last focused view which is not the
686 // devtools_container_ or any of its children. Used to restore focus once 665 // devtools_web_view_ or any of its children. Used to restore focus once
687 // the devtools_container_ is hidden. 666 // the devtools_web_view_ is hidden.
688 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_; 667 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_;
689 668
690 // The Status information bubble that appears at the bottom of the window. 669 // The Status information bubble that appears at the bottom of the window.
691 scoped_ptr<StatusBubbleViews> status_bubble_; 670 scoped_ptr<StatusBubbleViews> status_bubble_;
692 671
693 // A mapping between accelerators and commands. 672 // A mapping between accelerators and commands.
694 std::map<ui::Accelerator, int> accelerator_table_; 673 std::map<ui::Accelerator, int> accelerator_table_;
695 674
696 // True if we have already been initialized. 675 // True if we have already been initialized.
697 bool initialized_; 676 bool initialized_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 scoped_ptr<ScrollEndEffectController> scroll_end_effect_controller_; 720 scoped_ptr<ScrollEndEffectController> scroll_end_effect_controller_;
742 721
743 gfx::ScopedSysColorChangeListener color_change_listener_; 722 gfx::ScopedSysColorChangeListener color_change_listener_;
744 723
745 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; 724 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_;
746 725
747 DISALLOW_COPY_AND_ASSIGN(BrowserView); 726 DISALLOW_COPY_AND_ASSIGN(BrowserView);
748 }; 727 };
749 728
750 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ 729 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698