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

Unified Diff: content/browser/web_contents/aura/overscroll_layer_wrapper.h

Issue 895543005: Refactor GestureNavigation to eliminate code redundancy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Checked comments Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/aura/overscroll_layer_wrapper.h
diff --git a/content/browser/web_contents/aura/overscroll_layer_wrapper.h b/content/browser/web_contents/aura/overscroll_layer_wrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9d5d9293a3e67212f3f56cd8bbae9fb1243eb68
--- /dev/null
+++ b/content/browser/web_contents/aura/overscroll_layer_wrapper.h
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_WRAPPER_H_
+#define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_WRAPPER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/image/image.h"
+#include "ui/gfx/transform.h"
+
+namespace aura {
+class Window;
+}
+
+namespace ui {
+class Layer;
+class LayerAnimator;
+}
+
+namespace content {
+
+class ImageLayerDelegate;
+class ShadowLayerDelegate;
+
+// Wraps a window or a layer, exposing some of their common API to allow
+// overscroll animations for both cases.
+class OverscrollLayerWrapper {
mfomitchev 2015/02/27 21:33:42 Perhaps we don't need this - perhaps OWA could alw
Nina 2015/03/09 15:54:52 Ack, for now we decided to keep the wrapper.
+ public:
+ // The contructor takes ownership of the overscroll window.
+ OverscrollLayerWrapper();
+
+ ~OverscrollLayerWrapper();
+
+ // Wrap the given window or layer. For a given instance of
+ // OverscrollLayerWrapper, only call one of these, once.
+ void WrapWindow(aura::Window* window);
mfomitchev 2015/02/27 21:33:42 Just put these into constr
Nina 2015/03/09 15:54:52 Done.
+ void WrapLayer(ui::Layer* layer);
+
+ // Applies the |transform| to the wrapped target.
+ void SetTransform(const gfx::Transform& transform);
+
+ // Sets the bounds of the wrapped target.
+ void SetBounds(const gfx::Rect& bounds);
+
+ // Returns the wrapped target layer animator.
+ ui::LayerAnimator* GetAnimator();
+
+ // Returns the wrapped target layer bounds.
+ gfx::Rect GetBounds();
+
+ private:
+ // The wrapped layer.
+ ui::Layer* layer_;
mfomitchev 2015/02/27 21:33:42 Perhaps make it own window/layer and have ONO/WCVA
Nina 2015/03/09 15:54:52 I would love to, but by doing that we would lose t
+
+ // The wrapped window.
+ aura::Window* window_;
+
+ // Shadow shown under the animated layer.
+ scoped_ptr<ShadowLayerDelegate> shadow_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_WRAPPER_H_

Powered by Google App Engine
This is Rietveld 408576698