| 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 "chrome/common/instant_types.h" |
| 8 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
| 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 |
| (...skipping 20 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. The default height is 100%, and each time |
| 51 // the preview is cleared, the default is restored. |
| 52 void SetPreviewHeight(int height, InstantSizeUnits units); |
| 53 |
| 48 content::WebContents* preview_web_contents() const { | 54 content::WebContents* preview_web_contents() const { |
| 49 return preview_web_contents_; | 55 return preview_web_contents_; |
| 50 } | 56 } |
| 51 | 57 |
| 52 // Sets the active top margin. | 58 // Sets the active top margin. |
| 53 void SetActiveTopMargin(int margin); | 59 void SetActiveTopMargin(int margin); |
| 54 | 60 |
| 55 // Returns the bounds of the preview. If the preview isn't active this | 61 // Returns the bounds of the preview. If the preview isn't active this |
| 56 // retuns the bounds the preview would be shown at. | 62 // retuns the bounds the preview would be shown at. |
| 57 gfx::Rect GetPreviewBounds(); | 63 gfx::Rect GetPreviewBounds(); |
| 58 | 64 |
| 59 // View overrides: | 65 // View overrides: |
| 60 virtual void Layout() OVERRIDE; | 66 virtual void Layout() OVERRIDE; |
| 61 virtual std::string GetClassName() const OVERRIDE; | 67 virtual std::string GetClassName() const OVERRIDE; |
| 62 | 68 |
| 63 private: | 69 private: |
| 64 views::WebView* active_; | 70 views::WebView* active_; |
| 65 views::View* overlay_; | 71 views::View* overlay_; |
| 66 views::WebView* preview_; | 72 views::WebView* preview_; |
| 67 content::WebContents* preview_web_contents_; | 73 content::WebContents* preview_web_contents_; |
| 68 | 74 |
| 75 // Returns the current preview height, in pixels. |
| 76 int PreviewHeightInPixels() const; |
| 77 |
| 69 // The margin between the top and the active view. This is used to make the | 78 // 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. | 79 // preview overlap the bookmark bar on the new tab page. |
| 71 int active_top_margin_; | 80 int active_top_margin_; |
| 72 | 81 |
| 82 // The desired height of the preview and units. |
| 83 int preview_height_; |
| 84 InstantSizeUnits preview_height_units_; |
| 85 |
| 73 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 86 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
| 74 }; | 87 }; |
| 75 | 88 |
| 76 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 89 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| OLD | NEW |