OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CONTENTS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 class WebContents; | 12 class WebContents; |
13 } | 13 } |
14 | 14 |
15 // ContentsContainer is responsible for managing the WebContents views. | 15 // ContentsContainer is responsible for managing the WebContents views. |
16 // ContentsContainer has up to two children: one for the currently active | 16 // ContentsContainer has up to two children: one for the currently active |
17 // WebContents and one for instant's WebContents. | 17 // WebContents and one for instant's WebContents. |
18 class ContentsContainer : public views::View { | 18 class ContentsContainer : public views::View { |
19 public: | 19 public: |
20 // Internal class name | 20 // Internal class name |
21 static const char kViewClassName[]; | 21 static const char kViewClassName[]; |
22 | 22 |
23 explicit ContentsContainer(views::View* active); | 23 explicit ContentsContainer(views::View* active); |
24 virtual ~ContentsContainer(); | 24 virtual ~ContentsContainer(); |
25 | 25 |
| 26 // View positioned above the contents. The returned view is owned by this. |
| 27 // The header is sized to the preferred height of its single child (width |
| 28 // fills the available width). If the child is not visible the header is |
| 29 // sized to an empty rect. |
| 30 views::View* header(); |
| 31 |
26 // Makes the preview view the active view and nulls out the old active view. | 32 // Makes the preview view the active view and nulls out the old active view. |
27 // It's assumed the caller will delete or remove the old active view | 33 // It's assumed the caller will delete or remove the old active view |
28 // separately. | 34 // separately. |
29 void MakePreviewContentsActiveContents(); | 35 void MakePreviewContentsActiveContents(); |
30 | 36 |
31 // Sets the preview view. This does not delete the old. | 37 // Sets the preview view. This does not delete the old. |
32 void SetPreview(views::View* preview, | 38 void SetPreview(views::View* preview, |
33 content::WebContents* preview_web_contents); | 39 content::WebContents* preview_web_contents); |
34 | 40 |
35 content::WebContents* preview_web_contents() const { | 41 content::WebContents* preview_web_contents() const { |
36 return preview_web_contents_; | 42 return preview_web_contents_; |
37 } | 43 } |
38 | 44 |
39 // Sets the active top margin. | 45 // Sets the active top margin. |
40 void SetActiveTopMargin(int margin); | 46 void SetActiveTopMargin(int margin); |
41 | 47 |
42 // Returns the bounds of the preview. If the preview isn't active this | 48 // Returns the bounds of the preview. If the preview isn't active this |
43 // retuns the bounds the preview would be shown at. | 49 // retuns the bounds the preview would be shown at. |
44 gfx::Rect GetPreviewBounds(); | 50 gfx::Rect GetPreviewBounds(); |
45 | 51 |
46 // View overrides: | 52 // View overrides: |
47 virtual void Layout() OVERRIDE; | 53 virtual void Layout() OVERRIDE; |
48 virtual std::string GetClassName() const OVERRIDE; | 54 virtual std::string GetClassName() const OVERRIDE; |
49 | 55 |
50 private: | 56 private: |
| 57 class HeaderView; |
| 58 |
| 59 HeaderView* header_; |
51 views::View* active_; | 60 views::View* active_; |
52 views::View* preview_; | 61 views::View* preview_; |
53 content::WebContents* preview_web_contents_; | 62 content::WebContents* preview_web_contents_; |
54 | 63 |
55 // The margin between the top and the active view. This is used to make the | 64 // The margin between the top and the active view. This is used to make the |
56 // preview overlap the bookmark bar on the new tab page. | 65 // preview overlap the bookmark bar on the new tab page. |
57 int active_top_margin_; | 66 int active_top_margin_; |
58 | 67 |
59 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 68 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
60 }; | 69 }; |
61 | 70 |
62 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 71 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
OLD | NEW |