| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/common/instant_types.h" | 12 #include "chrome/common/instant_types.h" |
| 13 #include "chrome/common/search_types.h" | 13 #include "chrome/common/search_types.h" |
| 14 #include "ui/views/controls/webview/webview.h" |
| 14 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class WebContents; | 18 class WebContents; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace gfx { | 21 namespace gfx { |
| 21 class Rect; | 22 class Rect; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace views { | |
| 25 class WebView; | |
| 26 } | |
| 27 | |
| 28 // ContentsContainer is responsible for managing the WebContents views. | 25 // ContentsContainer is responsible for managing the WebContents views. |
| 29 // ContentsContainer has up to two children: one for the currently active | 26 // ContentsContainer has up to two children: one for the currently active |
| 30 // WebContents and one for Instant's WebContents. | 27 // WebContents and one for Instant's WebContents. |
| 31 class ContentsContainer : public views::View { | 28 class ContentsContainer : public views::View { |
| 32 public: | 29 public: |
| 33 // Internal class name | 30 // Internal class name |
| 34 static const char kViewClassName[]; | 31 static const char kViewClassName[]; |
| 35 | 32 |
| 36 explicit ContentsContainer(views::WebView* active); | 33 explicit ContentsContainer(views::WebView* active); |
| 37 virtual ~ContentsContainer(); | 34 virtual ~ContentsContainer(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 bool draw_drop_shadow); | 46 bool draw_drop_shadow); |
| 50 | 47 |
| 51 // When the active content is reset and we have a visible preview, | 48 // When the active content is reset and we have a visible preview, |
| 52 // the preview must be stacked back at top. | 49 // the preview must be stacked back at top. |
| 53 void MaybeStackPreviewAtTop(); | 50 void MaybeStackPreviewAtTop(); |
| 54 | 51 |
| 55 content::WebContents* preview_web_contents() const { | 52 content::WebContents* preview_web_contents() const { |
| 56 return preview_web_contents_; | 53 return preview_web_contents_; |
| 57 } | 54 } |
| 58 | 55 |
| 59 // Sets the active top margin. | 56 int preview_height() const { |
| 57 return preview_ ? preview_->bounds().height() : 0; |
| 58 } |
| 59 |
| 60 // Sets the active top margin; the active WebView's y origin would be |
| 61 // positioned at this |margin|, causing the active WebView to be pushed down |
| 62 // vertically by |margin| pixels in the |ContentsContainer|. |
| 60 void SetActiveTopMargin(int margin); | 63 void SetActiveTopMargin(int margin); |
| 61 | 64 |
| 62 // Returns the bounds the preview would be shown at. | 65 // Returns the bounds the preview would be shown at. |
| 63 gfx::Rect GetPreviewBounds() const; | 66 gfx::Rect GetPreviewBounds() const; |
| 64 | 67 |
| 65 // Returns true if preview occupies full height of content page. | 68 // Returns true if preview occupies full height of content page. |
| 66 bool IsPreviewFullHeight(int preview_height, | 69 bool IsPreviewFullHeight(int preview_height, |
| 67 InstantSizeUnits preview_height_units) const; | 70 InstantSizeUnits preview_height_units) const; |
| 68 | 71 |
| 69 private: | 72 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 89 int active_top_margin_; | 92 int active_top_margin_; |
| 90 | 93 |
| 91 // The desired height of the preview and units. | 94 // The desired height of the preview and units. |
| 92 int preview_height_; | 95 int preview_height_; |
| 93 InstantSizeUnits preview_height_units_; | 96 InstantSizeUnits preview_height_units_; |
| 94 | 97 |
| 95 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 98 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
| 96 }; | 99 }; |
| 97 | 100 |
| 98 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 101 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| OLD | NEW |