| 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" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 content::WebContents* overlay_web_contents() const { | 53 content::WebContents* overlay_web_contents() const { |
| 54 return overlay_web_contents_; | 54 return overlay_web_contents_; |
| 55 } | 55 } |
| 56 | 56 |
| 57 int overlay_height() const { | 57 int overlay_height() const { |
| 58 return overlay_ ? overlay_->bounds().height() : 0; | 58 return overlay_ ? overlay_->bounds().height() : 0; |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Sets the active top margin; the active WebView's y origin would be | 61 // Sets the active top margin; the active WebView's y origin would be |
| 62 // positioned at this |margin|, causing the active WebView to be pushed down | 62 // positioned at this |margin|, causing the active WebView to be pushed down |
| 63 // vertically by |margin| pixels in the |ContentsContainer|. | 63 // vertically by |margin| pixels in the |ContentsContainer|. Returns true |
| 64 void SetActiveTopMargin(int margin); | 64 // if the margin changed and this view needs Layout(). |
| 65 bool SetActiveTopMargin(int margin); |
| 66 |
| 67 // Sets a vertical offset of |margin| pixels for the |overlay_| content, |
| 68 // similar to SetActiveTopMargin(). Returns true if the margin changed and |
| 69 // this view needs Layout(). |
| 70 bool SetOverlayTopMargin(int margin); |
| 65 | 71 |
| 66 // Returns the bounds the overlay would be shown at. | 72 // Returns the bounds the overlay would be shown at. |
| 67 gfx::Rect GetOverlayBounds() const; | 73 gfx::Rect GetOverlayBounds() const; |
| 68 | 74 |
| 69 // Returns true if overlay will occupy full height of content page based on | 75 // Returns true if overlay will occupy full height of content page based on |
| 70 // |overlay_height| and |overlay_height_units|. | 76 // |overlay_height| and |overlay_height_units|. |
| 71 bool WillOverlayBeFullHeight(int overlay_height, | 77 bool WillOverlayBeFullHeight(int overlay_height, |
| 72 InstantSizeUnits overlay_height_units) const; | 78 InstantSizeUnits overlay_height_units) const; |
| 73 | 79 |
| 74 // Returns true if |overlay_| is not NULL and it is occupying full height of | 80 // Returns true if |overlay_| is not NULL and it is occupying full height of |
| 75 // the content page. | 81 // the content page. |
| 76 bool IsOverlayFullHeight() const; | 82 bool IsOverlayFullHeight() const; |
| 77 | 83 |
| 78 private: | |
| 79 // Overridden from views::View: | 84 // Overridden from views::View: |
| 80 virtual void Layout() OVERRIDE; | 85 virtual void Layout() OVERRIDE; |
| 81 virtual std::string GetClassName() const OVERRIDE; | 86 virtual std::string GetClassName() const OVERRIDE; |
| 82 | 87 |
| 88 // Testing interface: |
| 89 views::WebView* GetActiveWebViewForTest() { return active_; } |
| 90 views::WebView* GetOverlayWebViewForTest() { return overlay_; } |
| 91 |
| 92 private: |
| 83 // content::NotificationObserver implementation. | 93 // content::NotificationObserver implementation. |
| 84 virtual void Observe(int type, | 94 virtual void Observe(int type, |
| 85 const content::NotificationSource& source, | 95 const content::NotificationSource& source, |
| 86 const content::NotificationDetails& details) OVERRIDE; | 96 const content::NotificationDetails& details) OVERRIDE; |
| 87 | 97 |
| 88 views::WebView* active_; | 98 views::WebView* active_; |
| 89 views::WebView* overlay_; | 99 views::WebView* overlay_; |
| 90 scoped_ptr<views::View> shadow_view_; | 100 scoped_ptr<views::View> shadow_view_; |
| 91 content::WebContents* overlay_web_contents_; | 101 content::WebContents* overlay_web_contents_; |
| 92 bool draw_drop_shadow_; | 102 bool draw_drop_shadow_; |
| 93 | 103 |
| 94 // The margin between the top and the active view. This is used to make the | 104 // The margin between the top and the active view. This is used to make the |
| 95 // overlay overlap the bookmark bar on the new tab page. | 105 // overlay overlap the bookmark bar on the new tab page. |
| 96 int active_top_margin_; | 106 int active_top_margin_; |
| 97 | 107 |
| 108 // The margin between the top of this view and the overlay view. Used to |
| 109 // push down the instant extended suggestions during an immersive fullscreen |
| 110 // reveal. |
| 111 int overlay_top_margin_; |
| 112 |
| 98 // The desired height of the overlay and units. | 113 // The desired height of the overlay and units. |
| 99 int overlay_height_; | 114 int overlay_height_; |
| 100 InstantSizeUnits overlay_height_units_; | 115 InstantSizeUnits overlay_height_units_; |
| 101 | 116 |
| 102 content::NotificationRegistrar registrar_; | 117 content::NotificationRegistrar registrar_; |
| 103 | 118 |
| 104 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 119 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
| 105 }; | 120 }; |
| 106 | 121 |
| 107 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 122 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| OLD | NEW |