Chromium Code Reviews| 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_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 | 7 |
| 8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 #include "chrome/common/instant_types.h" | |
|
sreeram
2012/09/18 22:28:08
Sort.
Jered
2012/09/18 22:46:24
Done.
| |
| 9 | 10 |
| 10 namespace content { | 11 namespace content { |
| 11 class WebContents; | 12 class WebContents; |
| 12 } | 13 } |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 class WebView; | 16 class WebView; |
| 16 } | 17 } |
| 17 | 18 |
| 18 // ContentsContainer is responsible for managing the WebContents views. | 19 // ContentsContainer is responsible for managing the WebContents views. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 38 | 39 |
| 39 // Makes the preview view the active view and nulls out the old active view. | 40 // Makes the preview view the active view and nulls out the old active view. |
| 40 // It's assumed the caller will delete or remove the old active view | 41 // It's assumed the caller will delete or remove the old active view |
| 41 // separately. | 42 // separately. |
| 42 void MakePreviewContentsActiveContents(); | 43 void MakePreviewContentsActiveContents(); |
| 43 | 44 |
| 44 // Sets the preview view. This does not delete the old. | 45 // Sets the preview view. This does not delete the old. |
| 45 void SetPreview(views::WebView* preview, | 46 void SetPreview(views::WebView* preview, |
| 46 content::WebContents* preview_web_contents); | 47 content::WebContents* preview_web_contents); |
| 47 views::WebView* preview() { return preview_; } | 48 views::WebView* preview() { return preview_; } |
| 49 | |
| 50 // Sets the height of the preview. | |
| 51 // | |
| 52 // The default height is 100%, and each time the preview is cleared, the | |
| 53 // default is restored. | |
| 54 // | |
| 55 // When the preview is not shown, the height has no effect. When the preview | |
| 56 // is shown, the active page is pushed down below the preview and will be | |
| 57 // visible if the preview height is less than 100%. | |
|
sreeram
2012/09/18 22:24:24
Update the comment. We don't actually push the act
Jered
2012/09/18 22:46:24
Done.
| |
| 58 void SetPreviewHeight(int height, InstantSizeUnits units); | |
| 59 | |
| 48 content::WebContents* preview_web_contents() const { | 60 content::WebContents* preview_web_contents() const { |
| 49 return preview_web_contents_; | 61 return preview_web_contents_; |
| 50 } | 62 } |
| 51 | 63 |
| 52 // Sets the active top margin. | 64 // Sets the active top margin. |
| 53 void SetActiveTopMargin(int margin); | 65 void SetActiveTopMargin(int margin); |
| 54 | 66 |
| 55 // Returns the bounds of the preview. If the preview isn't active this | 67 // Returns the bounds of the preview. If the preview isn't active this |
| 56 // retuns the bounds the preview would be shown at. | 68 // retuns the bounds the preview would be shown at. |
| 57 gfx::Rect GetPreviewBounds(); | 69 gfx::Rect GetPreviewBounds(); |
| 58 | 70 |
| 59 // View overrides: | 71 // View overrides: |
| 60 virtual void Layout() OVERRIDE; | 72 virtual void Layout() OVERRIDE; |
| 61 virtual std::string GetClassName() const OVERRIDE; | 73 virtual std::string GetClassName() const OVERRIDE; |
| 62 | 74 |
| 63 private: | 75 private: |
| 64 views::WebView* active_; | 76 views::WebView* active_; |
| 65 views::View* overlay_; | 77 views::View* overlay_; |
| 66 views::WebView* preview_; | 78 views::WebView* preview_; |
| 67 content::WebContents* preview_web_contents_; | 79 content::WebContents* preview_web_contents_; |
| 68 | 80 |
| 81 // Returns the current preview height, in pixels. | |
| 82 int PreviewHeightInPixels() const; | |
| 83 | |
| 69 // The margin between the top and the active view. This is used to make the | 84 // The margin between the top and the active view. This is used to make the |
| 70 // preview overlap the bookmark bar on the new tab page. | 85 // preview overlap the bookmark bar on the new tab page. |
| 71 int active_top_margin_; | 86 int active_top_margin_; |
| 72 | 87 |
| 88 // The desired height of the preview and units. | |
| 89 int preview_height_; | |
| 90 InstantSizeUnits preview_height_units_; | |
| 91 | |
| 73 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 92 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
| 74 }; | 93 }; |
| 75 | 94 |
| 76 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 95 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| OLD | NEW |