OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "views/layout_manager.h" | 9 #include "views/layout_manager.h" |
10 | 10 |
11 class BaseTabStrip; | 11 class BaseTabStrip; |
12 class BookmarkBarView; | 12 class BookmarkBarView; |
13 class Browser; | 13 class Browser; |
14 class BrowserView; | 14 class BrowserView; |
15 class ContentsContainer; | 15 class ContentsContainer; |
16 class DownloadShelfView; | 16 class DownloadShelfView; |
17 class TabContentsContainer; | |
18 class ToolbarView; | 17 class ToolbarView; |
19 | 18 |
20 namespace views { | |
21 class SingleSplitView; | |
22 } | |
23 | |
24 // The layout manager used in chrome browser. | 19 // The layout manager used in chrome browser. |
25 class BrowserViewLayout : public views::LayoutManager { | 20 class BrowserViewLayout : public views::LayoutManager { |
26 public: | 21 public: |
27 BrowserViewLayout(); | 22 BrowserViewLayout(); |
28 virtual ~BrowserViewLayout() {} | 23 virtual ~BrowserViewLayout() {} |
29 | 24 |
30 // Returns the minimum size of the browser view. | 25 // Returns the minimum size of the browser view. |
31 virtual gfx::Size GetMinimumSize(); | 26 virtual gfx::Size GetMinimumSize(); |
32 | 27 |
33 // Returns the bounding box for the find bar. | 28 // Returns the bounding box for the find bar. |
(...skipping 25 matching lines...) Expand all Loading... |
59 // for laying out subsequent controls. | 54 // for laying out subsequent controls. |
60 virtual int LayoutTabStrip(); | 55 virtual int LayoutTabStrip(); |
61 | 56 |
62 // Layout the following controls, starting at |top|, returns the coordinate | 57 // Layout the following controls, starting at |top|, returns the coordinate |
63 // of the bottom of the control, for laying out the next control. | 58 // of the bottom of the control, for laying out the next control. |
64 virtual int LayoutToolbar(int top); | 59 virtual int LayoutToolbar(int top); |
65 int LayoutBookmarkAndInfoBars(int top); | 60 int LayoutBookmarkAndInfoBars(int top); |
66 int LayoutBookmarkBar(int top); | 61 int LayoutBookmarkBar(int top); |
67 int LayoutInfoBar(int top); | 62 int LayoutInfoBar(int top); |
68 | 63 |
69 // Updates |source|'s reserved contents rect by mapping BrowserView's | |
70 // |browser_reserved_rect| into |future_source_bounds| taking into | |
71 // account |source|'s |future_parent_offset| (offset is relative to | |
72 // browser_view_). | |
73 void UpdateReservedContentsRect(const gfx::Rect& browser_reserved_rect, | |
74 TabContentsContainer* source, | |
75 const gfx::Rect& future_source_bounds, | |
76 const gfx::Point& future_parent_offset); | |
77 | |
78 // Layout the TabContents container, between the coordinates |top| and | 64 // Layout the TabContents container, between the coordinates |top| and |
79 // |bottom|. | 65 // |bottom|. |
80 void LayoutTabContents(int top, int bottom); | 66 void LayoutTabContents(int top, int bottom); |
81 | 67 |
82 // Returns the top margin to adjust the contents_container_ by. This is used | 68 // Returns the top margin to adjust the contents_container_ by. This is used |
83 // to make the bookmark bar and contents_container_ overlap so that the | 69 // to make the bookmark bar and contents_container_ overlap so that the |
84 // preview contents hides the bookmark bar. | 70 // preview contents hides the bookmark bar. |
85 int GetTopMarginForActiveContent(); | 71 int GetTopMarginForActiveContent(); |
86 | 72 |
87 // Layout the Download Shelf, returns the coordinate of the top of the | 73 // Layout the Download Shelf, returns the coordinate of the top of the |
88 // control, for laying out the previous control. | 74 // control, for laying out the previous control. |
89 int LayoutDownloadShelf(int bottom); | 75 int LayoutDownloadShelf(int bottom); |
90 | 76 |
91 // Returns true if an infobar is showing. | 77 // Returns true if an infobar is showing. |
92 bool InfobarVisible() const; | 78 bool InfobarVisible() const; |
93 | 79 |
94 // See description above vertical_layout_rect_ for details. | 80 // See description above vertical_layout_rect_ for details. |
95 void set_vertical_layout_rect(const gfx::Rect& bounds) { | 81 void set_vertical_layout_rect(const gfx::Rect& bounds) { |
96 vertical_layout_rect_ = bounds; | 82 vertical_layout_rect_ = bounds; |
97 } | 83 } |
98 const gfx::Rect& vertical_layout_rect() const { | 84 const gfx::Rect& vertical_layout_rect() const { |
99 return vertical_layout_rect_; | 85 return vertical_layout_rect_; |
100 } | 86 } |
101 | 87 |
102 // Child views that the layout manager manages. | 88 // Child views that the layout manager manages. |
103 BaseTabStrip* tabstrip_; | 89 BaseTabStrip* tabstrip_; |
104 ToolbarView* toolbar_; | 90 ToolbarView* toolbar_; |
105 views::SingleSplitView* contents_split_; | 91 views::View* contents_split_; |
106 ContentsContainer* contents_container_; | 92 ContentsContainer* contents_container_; |
107 views::View* infobar_container_; | 93 views::View* infobar_container_; |
108 DownloadShelfView* download_shelf_; | 94 DownloadShelfView* download_shelf_; |
109 BookmarkBarView* active_bookmark_bar_; | 95 BookmarkBarView* active_bookmark_bar_; |
110 | 96 |
111 BrowserView* browser_view_; | 97 BrowserView* browser_view_; |
112 | 98 |
113 // The bounds within which the vertically-stacked contents of the BrowserView | 99 // The bounds within which the vertically-stacked contents of the BrowserView |
114 // should be laid out within. When the SideTabstrip is not visible, this is | 100 // should be laid out within. When the SideTabstrip is not visible, this is |
115 // just the local bounds of the BrowserView, otherwise it's the local bounds | 101 // just the local bounds of the BrowserView, otherwise it's the local bounds |
116 // of the BrowserView less the width of the SideTabstrip. | 102 // of the BrowserView less the width of the SideTabstrip. |
117 gfx::Rect vertical_layout_rect_; | 103 gfx::Rect vertical_layout_rect_; |
118 | 104 |
119 // The distance the FindBar is from the top of the window, in pixels. | 105 // The distance the FindBar is from the top of the window, in pixels. |
120 int find_bar_y_; | 106 int find_bar_y_; |
121 | 107 |
122 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); | 108 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); |
123 }; | 109 }; |
124 | 110 |
125 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 111 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
126 | 112 |
OLD | NEW |