Chromium Code Reviews| 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 { | |
|
James Cook
2013/04/05 02:05:05
This mirrors an enum used in the Mac implementatio
| |
| 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 WebContents container, between the coordinates |top| and |
| 82 // |bottom|. | 95 // |bottom|. |contents_origin| must be the position of the web contents |
| 83 void LayoutTabContents(int top, int bottom); | 96 // at the beginning of the layout pass. |
| 97 void LayoutTabContents(int top, | |
| 98 int bottom, | |
| 99 const gfx::Point& contents_origin); | |
| 84 | 100 |
| 85 // Returns the top margin to adjust the contents_container_ by. This is used | 101 // 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 | 102 // to make the bookmark bar and contents_container_ overlap so that the |
| 87 // preview contents hides the bookmark bar. | 103 // preview contents hides the bookmark bar. |
| 88 int GetTopMarginForActiveContent(); | 104 int GetTopMarginForActiveContent(); |
| 89 | 105 |
| 106 // Returns the state of instant extended suggestions. | |
| 107 InstantUIState GetInstantUIState(); | |
| 108 | |
| 90 // Layout the Download Shelf, returns the coordinate of the top of the | 109 // Layout the Download Shelf, returns the coordinate of the top of the |
| 91 // control, for laying out the previous control. | 110 // control, for laying out the previous control. |
| 92 int LayoutDownloadShelf(int bottom); | 111 int LayoutDownloadShelf(int bottom); |
| 93 | 112 |
| 94 // Returns true if an infobar is showing. | 113 // Returns true if an infobar is showing. |
| 95 bool InfobarVisible() const; | 114 bool InfobarVisible() const; |
| 96 | 115 |
| 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. | 116 // Child views that the layout manager manages. |
| 106 views::SingleSplitView* contents_split_; | 117 views::SingleSplitView* contents_split_; |
| 107 ContentsContainer* contents_container_; | 118 ContentsContainer* contents_container_; |
| 108 DownloadShelfView* download_shelf_; | 119 DownloadShelfView* download_shelf_; |
| 109 | 120 |
| 110 BrowserView* browser_view_; | 121 BrowserView* browser_view_; |
| 111 | 122 |
| 112 // The bounds within which the vertically-stacked contents of the BrowserView | 123 // 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 | 124 // should be laid out within. This is just the local bounds of the |
| 114 // BrowserView. | 125 // BrowserView. |
| 126 // TODO(jamescook): Remove this and just use browser_view_->GetLocalBounds(). | |
| 115 gfx::Rect vertical_layout_rect_; | 127 gfx::Rect vertical_layout_rect_; |
| 116 | 128 |
| 117 // The distance the FindBar is from the top of the window, in pixels. | 129 // The distance the FindBar is from the top of the window, in pixels. |
| 118 int find_bar_y_; | 130 int find_bar_y_; |
| 119 | 131 |
| 120 // The host for use in positioning the web contents modal dialog. | 132 // The host for use in positioning the web contents modal dialog. |
| 121 scoped_ptr<WebContentsModalDialogHostViews> dialog_host_; | 133 scoped_ptr<WebContentsModalDialogHostViews> dialog_host_; |
| 122 | 134 |
| 123 // The distance the web contents modal dialog is from the top of the window, | 135 // The distance the web contents modal dialog is from the top of the window, |
| 124 // in pixels. | 136 // in pixels. |
| 125 int web_contents_modal_dialog_top_y_; | 137 int web_contents_modal_dialog_top_y_; |
| 126 | 138 |
| 127 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); | 139 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); |
| 128 }; | 140 }; |
| 129 | 141 |
| 130 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 142 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
| OLD | NEW |