Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/ui/views/frame/contents_container.h

Issue 22265009: Implement initial version of scroll end effect Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed another compile issue :-/ Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // When the scroll end effect is active the clipping layer is inserted into
35 // the layer hierarchy above the web contents and used to prevent it from
36 // occluding other elements of the browser. It also prevents the bounds of the
37 // contents from being updated by layouts of this class.
sadrul 2013/10/25 18:28:25 Don't mention the clipping layer here. Make a note
rharrison 2013/11/18 21:52:26 Done.
38 virtual void ActivateScrollEndEffect();
39 virtual void DeactivateScrollEndEffect();
40
41 // Adjusts the location of the contents and the clipping layer relative to
42 // each other in response to an update from the effect controller.
43 virtual void UpdateScrollEndEffectHeightDelta(int height_delta,
sadrul 2013/10/25 18:28:25 Don't really need the comment here. (the clipping
rharrison 2013/11/18 21:52:26 Done.
44 bool scrolling_down);
45
27 // Overridden from views::View: 46 // Overridden from views::View:
28 virtual void Layout() OVERRIDE; 47 virtual void Layout() OVERRIDE;
29 virtual const char* GetClassName() const OVERRIDE; 48 virtual const char* GetClassName() const OVERRIDE;
30 49
31 private: 50 private:
32 views::View* active_web_view_; 51 views::WebView* active_web_view_;
33 52
34 // The margin between the top and the active view. This is used to make the 53 // 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. 54 // find bar overlap the detached bookmark bar on the new tab page.
36 int active_top_margin_; 55 int active_top_margin_;
37 56
57 // When the effect is active the web contents will not have its bounds
58 // adjusted on layout and instead will just be clipped.
59 bool scroll_effect_active_;
60
61 // Stores the bounds of the web_view before the scroll end effect starts. This
62 // allows for restoring the bounds of the view at the end of the effect.
63 gfx::Rect web_view_bounds_;
64
38 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); 65 DISALLOW_COPY_AND_ASSIGN(ContentsContainer);
39 }; 66 };
40 67
41 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ 68 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698