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 WebContents container, between the coordinates |top| and |
82 // |bottom|. | 95 // |bottom|. |
83 void LayoutTabContents(int top, int bottom); | 96 void LayoutContentsSplitView(int top, int bottom); |
97 | |
98 // Returns the vertical offset for the web contents to account for a | |
99 // detached bookmarks bar. | |
100 int GetContentsOffsetForBookmarkBar(); | |
84 | 101 |
85 // Returns the top margin to adjust the contents_container_ by. This is used | 102 // 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 | 103 // to make the bookmark bar and contents_container_ overlap so that the |
87 // preview contents hides the bookmark bar. | 104 // preview contents hides the bookmark bar. |
88 int GetTopMarginForActiveContent(); | 105 int GetTopMarginForActiveContent(); |
89 | 106 |
107 // Returns the top margin by which to adjust the instant overlay web | |
108 // contents. Used to make instant extended suggestions align with the | |
109 // omnibox in immersive fullscreen. | |
110 int GetTopMarginForOverlayContent(); | |
111 | |
112 // Returns the top margin for the active or overlay web view in | |
113 // |contents_container_| for an immersive fullscreen reveal while instant | |
114 // extended is providing suggestions. | |
115 int GetImmersiveInstantContentTopMargin(); | |
kuan
2013/04/15 18:49:36
maybe name it like the above GetTopMarginFor...?
James Cook
2013/04/16 18:51:01
Done.
| |
116 | |
117 // Returns the state of instant extended suggestions. | |
118 InstantUIState GetInstantUIState(); | |
119 | |
90 // Layout the Download Shelf, returns the coordinate of the top of the | 120 // Layout the Download Shelf, returns the coordinate of the top of the |
91 // control, for laying out the previous control. | 121 // control, for laying out the previous control. |
92 int LayoutDownloadShelf(int bottom); | 122 int LayoutDownloadShelf(int bottom); |
93 | 123 |
94 // Returns true if an infobar is showing. | 124 // Returns true if an infobar is showing. |
95 bool InfobarVisible() const; | 125 bool InfobarVisible() const; |
96 | 126 |
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. | 127 // Child views that the layout manager manages. |
106 views::SingleSplitView* contents_split_; | 128 views::SingleSplitView* contents_split_; |
107 ContentsContainer* contents_container_; | 129 ContentsContainer* contents_container_; |
108 DownloadShelfView* download_shelf_; | 130 DownloadShelfView* download_shelf_; |
109 | 131 |
110 BrowserView* browser_view_; | 132 BrowserView* browser_view_; |
111 | 133 |
112 // The bounds within which the vertically-stacked contents of the BrowserView | 134 // 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 | 135 // should be laid out within. This is just the local bounds of the |
114 // BrowserView. | 136 // BrowserView. |
137 // TODO(jamescook): Remove this and just use browser_view_->GetLocalBounds(). | |
115 gfx::Rect vertical_layout_rect_; | 138 gfx::Rect vertical_layout_rect_; |
116 | 139 |
117 // The distance the FindBar is from the top of the window, in pixels. | 140 // The distance the FindBar is from the top of the window, in pixels. |
118 int find_bar_y_; | 141 int find_bar_y_; |
119 | 142 |
120 // The host for use in positioning the web contents modal dialog. | 143 // The host for use in positioning the web contents modal dialog. |
121 scoped_ptr<WebContentsModalDialogHostViews> dialog_host_; | 144 scoped_ptr<WebContentsModalDialogHostViews> dialog_host_; |
122 | 145 |
123 // The distance the web contents modal dialog is from the top of the window, | 146 // The distance the web contents modal dialog is from the top of the window, |
124 // in pixels. | 147 // in pixels. |
125 int web_contents_modal_dialog_top_y_; | 148 int web_contents_modal_dialog_top_y_; |
126 | 149 |
127 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); | 150 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); |
128 }; | 151 }; |
129 | 152 |
130 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 153 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
OLD | NEW |