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_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/views/frame/browser_view.h" | |
10 #include "views/layout_manager.h" | 9 #include "views/layout_manager.h" |
11 | 10 |
| 11 class BaseTabStrip; |
| 12 class BookmarkBarView; |
| 13 class Browser; |
| 14 class BrowserView; |
| 15 class ContentsContainer; |
| 16 class DownloadShelfView; |
| 17 class ToolbarView; |
| 18 |
12 // The layout manager used in chrome browser. | 19 // The layout manager used in chrome browser. |
13 class BrowserViewLayout : public views::LayoutManager { | 20 class BrowserViewLayout : public views::LayoutManager { |
14 public: | 21 public: |
15 BrowserViewLayout(); | 22 BrowserViewLayout(); |
16 virtual ~BrowserViewLayout() {} | 23 virtual ~BrowserViewLayout() {} |
17 | 24 |
18 // Returns the minimum size of the browser view. | 25 // Returns the minimum size of the browser view. |
19 virtual gfx::Size GetMinimumSize(); | 26 virtual gfx::Size GetMinimumSize(); |
20 | 27 |
21 // Returns the bounding box for the find bar. | 28 // Returns the bounding box for the find bar. |
(...skipping 11 matching lines...) Expand all Loading... |
33 | 40 |
34 // views::LayoutManager overrides: | 41 // views::LayoutManager overrides: |
35 virtual void Installed(views::View* host); | 42 virtual void Installed(views::View* host); |
36 virtual void Uninstalled(views::View* host); | 43 virtual void Uninstalled(views::View* host); |
37 virtual void ViewAdded(views::View* host, views::View* view); | 44 virtual void ViewAdded(views::View* host, views::View* view); |
38 virtual void ViewRemoved(views::View* host, views::View* view); | 45 virtual void ViewRemoved(views::View* host, views::View* view); |
39 virtual void Layout(views::View* host); | 46 virtual void Layout(views::View* host); |
40 virtual gfx::Size GetPreferredSize(views::View* host); | 47 virtual gfx::Size GetPreferredSize(views::View* host); |
41 | 48 |
42 protected: | 49 protected: |
43 Browser* browser() { | 50 Browser* browser(); |
44 return browser_view_->browser(); | 51 const Browser* browser() const; |
45 } | |
46 const Browser* browser() const { | |
47 return browser_view_->browser(); | |
48 } | |
49 | 52 |
50 // Layout the TabStrip, returns the coordinate of the bottom of the TabStrip, | 53 // Layout the TabStrip, returns the coordinate of the bottom of the TabStrip, |
51 // for laying out subsequent controls. | 54 // for laying out subsequent controls. |
52 virtual int LayoutTabStrip(); | 55 virtual int LayoutTabStrip(); |
53 | 56 |
54 // Layout the following controls, starting at |top|, returns the coordinate | 57 // Layout the following controls, starting at |top|, returns the coordinate |
55 // 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. |
56 virtual int LayoutToolbar(int top); | 59 virtual int LayoutToolbar(int top); |
57 int LayoutBookmarkAndInfoBars(int top); | 60 int LayoutBookmarkAndInfoBars(int top); |
58 int LayoutBookmarkBar(int top); | 61 int LayoutBookmarkBar(int top); |
59 int LayoutInfoBar(int top); | 62 int LayoutInfoBar(int top); |
60 | 63 |
61 // Layout the TabContents container, between the coordinates |top| and | 64 // Layout the TabContents container, between the coordinates |top| and |
62 // |bottom|. | 65 // |bottom|. |
63 void LayoutTabContents(int top, int bottom); | 66 void LayoutTabContents(int top, int bottom); |
64 | 67 |
| 68 // 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 |
| 70 // preview contents hides the bookmark bar. |
| 71 int GetTopMarginForActiveContent(); |
| 72 |
65 // 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 |
66 // control, for laying out the previous control. | 74 // control, for laying out the previous control. |
67 int LayoutDownloadShelf(int bottom); | 75 int LayoutDownloadShelf(int bottom); |
68 | 76 |
69 // Returns true if an infobar is showing. | 77 // Returns true if an infobar is showing. |
70 bool InfobarVisible() const; | 78 bool InfobarVisible() const; |
71 | 79 |
72 // See description above vertical_layout_rect_ for details. | 80 // See description above vertical_layout_rect_ for details. |
73 void set_vertical_layout_rect(const gfx::Rect& bounds) { | 81 void set_vertical_layout_rect(const gfx::Rect& bounds) { |
74 vertical_layout_rect_ = bounds; | 82 vertical_layout_rect_ = bounds; |
75 } | 83 } |
76 const gfx::Rect& vertical_layout_rect() const { | 84 const gfx::Rect& vertical_layout_rect() const { |
77 return vertical_layout_rect_; | 85 return vertical_layout_rect_; |
78 } | 86 } |
79 | 87 |
80 // Child views that the layout manager manages. | 88 // Child views that the layout manager manages. |
81 BaseTabStrip* tabstrip_; | 89 BaseTabStrip* tabstrip_; |
82 ToolbarView* toolbar_; | 90 ToolbarView* toolbar_; |
83 views::View* contents_split_; | 91 views::View* contents_split_; |
84 views::View* contents_container_; | 92 ContentsContainer* contents_container_; |
85 views::View* infobar_container_; | 93 views::View* infobar_container_; |
86 DownloadShelfView* download_shelf_; | 94 DownloadShelfView* download_shelf_; |
87 BookmarkBarView* active_bookmark_bar_; | 95 BookmarkBarView* active_bookmark_bar_; |
88 | 96 |
89 BrowserView* browser_view_; | 97 BrowserView* browser_view_; |
90 | 98 |
91 // The bounds within which the vertically-stacked contents of the BrowserView | 99 // The bounds within which the vertically-stacked contents of the BrowserView |
92 // 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 |
93 // 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 |
94 // of the BrowserView less the width of the SideTabstrip. | 102 // of the BrowserView less the width of the SideTabstrip. |
95 gfx::Rect vertical_layout_rect_; | 103 gfx::Rect vertical_layout_rect_; |
96 | 104 |
97 // 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. |
98 int find_bar_y_; | 106 int find_bar_y_; |
99 | 107 |
100 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); | 108 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); |
101 }; | 109 }; |
102 | 110 |
103 #endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ | 111 #endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_LAYOUT_H_ |
104 | 112 |
OLD | NEW |