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

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

Issue 895543005: Refactor GestureNavigation to eliminate code redundancy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed some bugs related to back and forth 2nd case navigation Created 5 years, 9 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/slidable_wrapper.h
diff --git a/content/browser/web_contents/aura/slidable_wrapper.h b/content/browser/web_contents/aura/slidable_wrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d01909ab8800a4710a601a1dbd08a07e7213d14
--- /dev/null
+++ b/content/browser/web_contents/aura/slidable_wrapper.h
@@ -0,0 +1,60 @@
+// 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_SLIDABLE_WRAPPER_H_
+#define CONTENT_BROWSER_WEB_CONTENTS_AURA_SLIDABLE_WRAPPER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "ui/aura/window.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/transform.h"
+
+namespace ui {
+class Layer;
+class LayerAnimator;
+}
+
+namespace content {
+
+// Wraps a window or a layer, exposing some of their common API to allow
+// overscroll animations for both cases. For a window, it can either assume its
+// ownership or not.
+class SlidableWrapper {
+ public:
+ // Assumes ownership of the |window|.
+ explicit SlidableWrapper(scoped_ptr<aura::Window> window);
+
+ // Assumes ownership of the |layer|.
+ explicit SlidableWrapper(scoped_ptr<ui::Layer> layer);
+
+ ~SlidableWrapper();
+
+ // Returns a pointer to the underlying layer.
+ ui::Layer* GetLayer();
+
+ // Transfers ownership of the wrapped and owned |layer_|.
+ scoped_ptr<ui::Layer> AcquireLayer();
+
+ // Transfers ownership of the wrapped and owned |owned_window_|.
+ scoped_ptr<aura::Window> AcquireWindow();
+
+ // Returns the wrapped target bounds.
+ gfx::Rect GetBounds();
+
+ // Sets the wrapped target bounds.
+ void SetBounds(const gfx::Rect& bounds);
+
+ private:
+ // The wrapped layer.
+ scoped_ptr<ui::Layer> layer_;
+
+ // The wrapped and window.
+ scoped_ptr<aura::Window> window_;
+
+ DISALLOW_COPY_AND_ASSIGN(SlidableWrapper);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_SLIDABLE_WRAPPER_H_

Powered by Google App Engine
This is Rietveld 408576698