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 "base/memory/scoped_ptr.h" |
| 13 #include "ui/compositor/layer.h" |
| 14 #include "ui/gfx/rect.h" |
12 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
13 | 16 |
| 17 namespace views { |
| 18 class WebView; |
| 19 } |
| 20 |
14 // ContentsContainer is responsible for managing the active WebContents view. | 21 // ContentsContainer is responsible for managing the active WebContents view. |
15 // ContentsContainer has one child: the currently active WebContents. | 22 // ContentsContainer has one child: the currently active WebContents. |
16 class ContentsContainer : public views::View { | 23 class ContentsContainer : public views::View { |
17 public: | 24 public: |
18 explicit ContentsContainer(views::View* active_web_view); | 25 explicit ContentsContainer(views::WebView* active_web_view); |
19 virtual ~ContentsContainer(); | 26 virtual ~ContentsContainer(); |
20 | 27 |
21 // Sets the active top margin; the active WebView's y origin would be | 28 // Sets the active top margin; the active WebView's y origin would be |
22 // positioned at this |margin|, causing the active WebView to be pushed down | 29 // positioned at this |margin|, causing the active WebView to be pushed down |
23 // vertically by |margin| pixels in the |ContentsContainer|. Returns true | 30 // vertically by |margin| pixels in the |ContentsContainer|. Returns true |
24 // if the margin changed and this view needs Layout(). | 31 // if the margin changed and this view needs Layout(). |
25 bool SetActiveTopMargin(int margin); | 32 bool SetActiveTopMargin(int margin); |
26 | 33 |
| 34 // Fast-resize is used for |active_web_view_| while the scroll-end effect is |
| 35 // active. It also prevents the bounds of the contents from being updated by |
| 36 // layouts of this class. |
| 37 virtual void ActivateScrollEndEffect(); |
| 38 virtual void DeactivateScrollEndEffect(); |
| 39 |
| 40 virtual void UpdateScrollEndEffectHeightDelta(int height_delta, |
| 41 bool scrolling_down); |
| 42 |
27 // Overridden from views::View: | 43 // Overridden from views::View: |
28 virtual void Layout() OVERRIDE; | 44 virtual void Layout() OVERRIDE; |
29 virtual const char* GetClassName() const OVERRIDE; | 45 virtual const char* GetClassName() const OVERRIDE; |
30 | 46 |
31 private: | 47 private: |
32 views::View* active_web_view_; | 48 views::WebView* active_web_view_; |
33 | 49 |
34 // The margin between the top and the active view. This is used to make the | 50 // The margin between the top and the active view. This is used to make the |
35 // find bar overlap the detached bookmark bar on the new tab page. | 51 // find bar overlap the detached bookmark bar on the new tab page. |
36 int active_top_margin_; | 52 int active_top_margin_; |
37 | 53 |
| 54 // When the effect is active the web contents will not have its bounds |
| 55 // adjusted on layout and instead will just be clipped. |
| 56 bool scroll_effect_active_; |
| 57 |
| 58 // Stores the bounds of the web_view before the scroll end effect starts. This |
| 59 // allows for restoring the bounds of the view at the end of the effect. |
| 60 gfx::Rect web_view_bounds_; |
| 61 |
38 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 62 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
39 }; | 63 }; |
40 | 64 |
41 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 65 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
OLD | NEW |