OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_VIEW_H_ |
| 6 #define BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_VIEW_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "ui/gfx/native_widget_types.h" |
| 10 |
| 11 namespace cc { |
| 12 class Layer; |
| 13 } // namespace cc |
| 14 |
| 15 namespace gfx { |
| 16 class Size; |
| 17 } // namespace gfx |
| 18 |
| 19 namespace ui { |
| 20 class MotionEvent; |
| 21 } |
| 22 |
| 23 namespace blimp { |
| 24 namespace client { |
| 25 |
| 26 // A BlimpContentsView exposes the classes required to visually represent a |
| 27 // BlimpContents (gfx::NativeView and cc::Layer). It also exposes methods that |
| 28 // let the embedder interact with the page content. |
| 29 class BlimpContentsView { |
| 30 public: |
| 31 using ReadbackRequestCallback = |
| 32 base::Callback<void(std::unique_ptr<SkBitmap>)>; |
| 33 |
| 34 virtual ~BlimpContentsView() = default; |
| 35 |
| 36 // Returns the platform specific NativeView that represents the contents of |
| 37 // this BlimpContents. |
| 38 virtual gfx::NativeView GetNativeView() = 0; |
| 39 |
| 40 // Returns the CC Layer that represents the contents of this BlimpContents. |
| 41 // This can be used instead of |GetNativeView()| if only the CC Layer is |
| 42 // required. |
| 43 virtual scoped_refptr<cc::Layer> GetLayer() = 0; |
| 44 |
| 45 // Called to set both the size and the scale of the BlimpContents. |size| is |
| 46 // in pixels and |device_scale_factor| is in terms of dp to px. |
| 47 virtual void SetSizeAndScale(const gfx::Size& size, |
| 48 float device_scale_factor) = 0; |
| 49 |
| 50 // Called to pass a ui::MotionEvent to the BlimpContents. Returns whether or |
| 51 // not |motion_event| was handled. |
| 52 virtual bool OnTouchEvent(const ui::MotionEvent& motion_event) = 0; |
| 53 |
| 54 // Copies the current visible content from the BlimpContents and returns a |
| 55 // SkBitmap through |callback|. If the readback fails |nullptr| is returned |
| 56 // instead. |
| 57 virtual void CopyFromCompositingSurface( |
| 58 const ReadbackRequestCallback& callback) = 0; |
| 59 |
| 60 protected: |
| 61 BlimpContentsView() = default; |
| 62 |
| 63 private: |
| 64 DISALLOW_COPY_AND_ASSIGN(BlimpContentsView); |
| 65 }; |
| 66 |
| 67 } // namespace client |
| 68 } // namespace blimp |
| 69 |
| 70 #endif // BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_VIEW_H_ |
OLD | NEW |