| OLD | NEW |
| 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_LAYOUT_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class Size; | 26 class Size; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace views { | 29 namespace views { |
| 30 class SingleSplitView; | 30 class SingleSplitView; |
| 31 } | 31 } |
| 32 | 32 |
| 33 // The layout manager used in chrome browser. | 33 // The layout manager used in chrome browser. |
| 34 class BrowserViewLayout : public views::LayoutManager { | 34 class BrowserViewLayout : public views::LayoutManager { |
| 35 public: | 35 public: |
| 36 // The vertical overlap between the TabStrip and the Toolbar. |
| 37 static const int kToolbarTabStripVerticalOverlap; |
| 38 |
| 36 BrowserViewLayout(); | 39 BrowserViewLayout(); |
| 37 virtual ~BrowserViewLayout(); | 40 virtual ~BrowserViewLayout(); |
| 38 | 41 |
| 39 WebContentsModalDialogHost* GetWebContentsModalDialogHost(); | 42 WebContentsModalDialogHost* GetWebContentsModalDialogHost(); |
| 40 | 43 |
| 41 // Returns the minimum size of the browser view. | 44 // Returns the minimum size of the browser view. |
| 42 gfx::Size GetMinimumSize(); | 45 gfx::Size GetMinimumSize(); |
| 43 | 46 |
| 44 // Returns the bounding box for the find bar. | 47 // Returns the bounding box for the find bar. |
| 45 gfx::Rect GetFindBarBoundingBox() const; | 48 gfx::Rect GetFindBarBoundingBox() const; |
| 46 | 49 |
| 47 // Returns true if the specified point(BrowserView coordinates) is in | 50 // Returns true if the specified point(BrowserView coordinates) is in |
| 48 // in the window caption area of the browser window. | 51 // in the window caption area of the browser window. |
| 49 bool IsPositionInWindowCaption(const gfx::Point& point); | 52 bool IsPositionInWindowCaption(const gfx::Point& point); |
| 50 | 53 |
| 51 // Tests to see if the specified |point| (in nonclient view's coordinates) | 54 // Tests to see if the specified |point| (in nonclient view's coordinates) |
| 52 // is within the views managed by the laymanager. Returns one of | 55 // is within the views managed by the laymanager. Returns one of |
| 53 // HitTestCompat enum defined in ui/base/hit_test.h. | 56 // HitTestCompat enum defined in ui/base/hit_test.h. |
| 54 // See also ClientView::NonClientHitTest. | 57 // See also ClientView::NonClientHitTest. |
| 55 int NonClientHitTest(const gfx::Point& point); | 58 int NonClientHitTest(const gfx::Point& point); |
| 56 | 59 |
| 57 // views::LayoutManager overrides: | 60 // views::LayoutManager overrides: |
| 58 virtual void Installed(views::View* host) OVERRIDE; | 61 virtual void Installed(views::View* host) OVERRIDE; |
| 59 virtual void Uninstalled(views::View* host) OVERRIDE; | 62 virtual void Uninstalled(views::View* host) OVERRIDE; |
| 60 virtual void ViewAdded(views::View* host, views::View* view) OVERRIDE; | 63 virtual void ViewAdded(views::View* host, views::View* view) OVERRIDE; |
| 61 virtual void Layout(views::View* host) OVERRIDE; | 64 virtual void Layout(views::View* host) OVERRIDE; |
| 62 virtual gfx::Size GetPreferredSize(views::View* host) OVERRIDE; | 65 virtual gfx::Size GetPreferredSize(views::View* host) OVERRIDE; |
| 63 | 66 |
| 64 protected: | 67 private: |
| 65 class WebContentsModalDialogHostViews; | 68 class WebContentsModalDialogHostViews; |
| 66 | 69 |
| 70 enum InstantUIState { |
| 71 // No instant suggestions are being shown. |
| 72 kInstantUINone, |
| 73 // Instant suggestions are displayed in a overlay overlapping the tab |
| 74 // contents. |
| 75 kInstantUIOverlay, |
| 76 // Instant suggestions are displayed in the main tab contents. |
| 77 kInstantUIFullPageResults, |
| 78 }; |
| 79 |
| 67 Browser* browser(); | 80 Browser* browser(); |
| 68 const Browser* browser() const; | 81 const Browser* browser() const; |
| 69 | 82 |
| 70 // Layout the tab strip region, returns the coordinate of the bottom of the | 83 // Layout the tab strip region, returns the coordinate of the bottom of the |
| 71 // TabStrip, for laying out subsequent controls. | 84 // TabStrip, for laying out subsequent controls. |
| 72 int LayoutTabStripRegion(); | 85 int LayoutTabStripRegion(); |
| 73 | 86 |
| 74 // Layout the following controls, starting at |top|, returns the coordinate | 87 // Layout the following controls, starting at |top|, returns the coordinate |
| 75 // of the bottom of the control, for laying out the next control. | 88 // of the bottom of the control, for laying out the next control. |
| 76 int LayoutToolbar(int top); | 89 int LayoutToolbar(int top); |
| 77 int LayoutBookmarkAndInfoBars(int top); | 90 int LayoutBookmarkAndInfoBars(int top); |
| 78 int LayoutBookmarkBar(int top); | 91 int LayoutBookmarkBar(int top); |
| 79 int LayoutInfoBar(int top); | 92 int LayoutInfoBar(int top); |
| 80 | 93 |
| 81 // Layout the WebContents container, between the coordinates |top| and | 94 // Layout the |contents_split_| view between the coordinates |top| and |
| 82 // |bottom|. | 95 // |bottom|. See browser_view.h for details of the relationship between |
| 83 void LayoutTabContents(int top, int bottom); | 96 // |contents_split_| and other views. |
| 97 void LayoutContentsSplitView(int top, int bottom); |
| 98 |
| 99 // Returns the vertical offset for the web contents to account for a |
| 100 // detached bookmarks bar. |
| 101 int GetContentsOffsetForBookmarkBar(); |
| 84 | 102 |
| 85 // Returns the top margin to adjust the contents_container_ by. This is used | 103 // Returns the top margin to adjust the contents_container_ by. This is used |
| 86 // to make the bookmark bar and contents_container_ overlap so that the | 104 // to make the bookmark bar and contents_container_ overlap so that the |
| 87 // preview contents hides the bookmark bar. | 105 // preview contents hides the bookmark bar. |
| 88 int GetTopMarginForActiveContent(); | 106 int GetTopMarginForActiveContent(); |
| 89 | 107 |
| 108 // Returns the top margin by which to adjust the instant overlay web |
| 109 // contents. Used to make instant extended suggestions align with the |
| 110 // omnibox in immersive fullscreen. |
| 111 int GetTopMarginForOverlayContent(); |
| 112 |
| 113 // Returns the top margin for the active or overlay web view in |
| 114 // |contents_container_| for an immersive fullscreen reveal while instant |
| 115 // extended is providing suggestions. |
| 116 int GetTopMarginForImmersiveInstant(); |
| 117 |
| 118 // Returns the state of instant extended suggestions. |
| 119 InstantUIState GetInstantUIState(); |
| 120 |
| 90 // Layout the Download Shelf, returns the coordinate of the top of the | 121 // Layout the Download Shelf, returns the coordinate of the top of the |
| 91 // control, for laying out the previous control. | 122 // control, for laying out the previous control. |
| 92 int LayoutDownloadShelf(int bottom); | 123 int LayoutDownloadShelf(int bottom); |
| 93 | 124 |
| 94 // Returns true if an infobar is showing. | 125 // Returns true if an infobar is showing. |
| 95 bool InfobarVisible() const; | 126 bool InfobarVisible() const; |
| 96 | 127 |
| 97 // See description above vertical_layout_rect_ for details. | |
| 98 void set_vertical_layout_rect(const gfx::Rect& bounds) { | |
| 99 vertical_layout_rect_ = bounds; | |
| 100 } | |
| 101 const gfx::Rect& vertical_layout_rect() const { | |
| 102 return vertical_layout_rect_; | |
| 103 } | |
| 104 | |
| 105 // Child views that the layout manager manages. | 128 // Child views that the layout manager manages. |
| 106 views::SingleSplitView* contents_split_; | 129 views::SingleSplitView* contents_split_; |
| 107 ContentsContainer* contents_container_; | 130 ContentsContainer* contents_container_; |
| 108 DownloadShelfView* download_shelf_; | 131 DownloadShelfView* download_shelf_; |
| 109 | 132 |
| 110 BrowserView* browser_view_; | 133 BrowserView* browser_view_; |
| 111 | 134 |
| 112 // The bounds within which the vertically-stacked contents of the BrowserView | 135 // The bounds within which the vertically-stacked contents of the BrowserView |
| 113 // should be laid out within. This is just the local bounds of the | 136 // should be laid out within. This is just the local bounds of the |
| 114 // BrowserView. | 137 // BrowserView. |
| 138 // TODO(jamescook): Remove this and just use browser_view_->GetLocalBounds(). |
| 115 gfx::Rect vertical_layout_rect_; | 139 gfx::Rect vertical_layout_rect_; |
| 116 | 140 |
| 117 // The distance the FindBar is from the top of the window, in pixels. | 141 // The distance the FindBar is from the top of the window, in pixels. |
| 118 int find_bar_y_; | 142 int find_bar_y_; |
| 119 | 143 |
| 120 // The host for use in positioning the web contents modal dialog. | 144 // The host for use in positioning the web contents modal dialog. |
| 121 scoped_ptr<WebContentsModalDialogHostViews> dialog_host_; | 145 scoped_ptr<WebContentsModalDialogHostViews> dialog_host_; |
| 122 | 146 |
| 123 // The distance the web contents modal dialog is from the top of the window, | 147 // The distance the web contents modal dialog is from the top of the window, |
| 124 // in pixels. | 148 // in pixels. |
| 125 int web_contents_modal_dialog_top_y_; | 149 int web_contents_modal_dialog_top_y_; |
| 126 | 150 |
| 127 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); | 151 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); |
| 128 }; | 152 }; |
| 129 | 153 |
| 130 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 154 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
| OLD | NEW |