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