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

Unified Diff: blimp/client/public/contents/blimp_contents_view.h

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Addressed more comments, added thread restriction bypass for tests. Created 4 years, 3 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: blimp/client/public/contents/blimp_contents_view.h
diff --git a/blimp/client/public/contents/blimp_contents_view.h b/blimp/client/public/contents/blimp_contents_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..ddbec56e4bfcb4e9c35f2d2380b4f6739ae16def
--- /dev/null
+++ b/blimp/client/public/contents/blimp_contents_view.h
@@ -0,0 +1,80 @@
+// Copyright 2016 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 BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_VIEW_H_
+#define BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_VIEW_H_
+
+#include "base/macros.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace cc {
+class Layer;
+} // namespace cc
+
+namespace gfx {
+class Size;
+} // namespace gfx
+
+namespace ui {
+class MotionEvent;
+}
+
+namespace blimp {
+namespace client {
+
+// A BlimpContentsView exposes the classes required to visually represent a
+// BlimpContents (gfx::NativeView and cc::Layer). It also exposes methods that
+// let the embedder interact with the page content.
+class BlimpContentsView {
+ public:
+ using ReadbackRequestCallback =
+ base::Callback<void(std::unique_ptr<SkBitmap>)>;
+
+ virtual ~BlimpContentsView() = default;
+
+ // Returns the platform specific NativeView that represents the contents of
+ // this BlimpContents.
+ virtual gfx::NativeView GetNativeView() = 0;
+
+ // Returns the CC Layer that represents the contents of this BlimpContents.
+ // This can be used instead of |GetNativeView()| if only the CC Layer is
+ // required.
+ virtual scoped_refptr<cc::Layer> GetLayer() = 0;
+
+ // Called to set both the size and the scale of the BlimpContents. |size| is
+ // in pixels and |device_scale_factor| is in terms of dp to px.
+ virtual void SetSizeAndScale(const gfx::Size& size,
+ float device_scale_factor) = 0;
+
+ // Called to pass a ui::MotionEvent to the BlimpContents. Returns whether or
+ // not |motion_event| was handled.
+ virtual bool OnTouchEvent(const ui::MotionEvent& motion_event) = 0;
+
+ // Copies the current visible content from the BlimpContents and returns a
+ // SkBitmap through |callback|. If the readback fails |nullptr| is returned
+ // instead.
+ // Only one readback can be outstanding at a time, so subsequent readbacks
+ // will be treated like failures.
+ // If |flush_pending_commits| is |true|, the readback request will wait until
+ // all currently outstanding compositor commits have been pushed to the
+ // screen. If it is |false|, the readback will happen regardless of whether
+ // or not there are outstanding commits. If the underlying content layer is
+ // destroyed or swapped, this will also count as a valid flush and the
+ // readback will start immediately. This is mainly used for tests to
+ // guarantee compositor state at validation time.
+ virtual void CopyFromCompositingSurface(
Khushal 2016/09/13 23:47:10 This looks fine for now. Basically we want to expo
David Trainor- moved to gerrit 2016/09/14 00:31:09 Discussed offline. Removing flush_pending_commits
+ const ReadbackRequestCallback& callback,
+ bool flush_pending_commits) = 0;
+
+ protected:
+ BlimpContentsView() = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BlimpContentsView);
+};
+
+} // namespace client
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698