| 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_CORE_CONTENTS_BLIMP_CONTENTS_VIEW_IMPL_H_ | |
| 6 #define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_VIEW_IMPL_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "blimp/client/core/contents/ime_feature.h" | |
| 14 #include "blimp/client/public/contents/blimp_contents_view.h" | |
| 15 #include "ui/gfx/native_widget_types.h" | |
| 16 | |
| 17 namespace cc { | |
| 18 class CopyOutputResult; | |
| 19 } | |
| 20 | |
| 21 namespace blimp { | |
| 22 namespace client { | |
| 23 class BlimpContentsImpl; | |
| 24 | |
| 25 // The internal generic implementation of a BlimpContentsView that implements | |
| 26 // the common functionality shared across platforms. Meant to be overridden and | |
| 27 // implemented for each supported platform. | |
| 28 class BlimpContentsViewImpl : public BlimpContentsView { | |
| 29 public: | |
| 30 // A factory method that needs to be implemented for each supported platform. | |
| 31 static std::unique_ptr<BlimpContentsViewImpl> Create( | |
| 32 BlimpContentsImpl* blimp_contents, | |
| 33 scoped_refptr<cc::Layer> contents_layer); | |
| 34 | |
| 35 ~BlimpContentsViewImpl() override; | |
| 36 | |
| 37 // Exposes the plaform specific ImeFeature::Delegate. This should handle text | |
| 38 // input requests and present them to the user. | |
| 39 virtual ImeFeature::Delegate* GetImeDelegate() = 0; | |
| 40 | |
| 41 // BlimpContentsView implementation. | |
| 42 scoped_refptr<cc::Layer> GetLayer() override; | |
| 43 void SetSizeAndScale(const gfx::Size& size, | |
| 44 float device_scale_factor) override; | |
| 45 bool OnTouchEvent(const ui::MotionEvent& motion_event) override; | |
| 46 void CopyFromCompositingSurface( | |
| 47 const ReadbackRequestCallback& callback) override; | |
| 48 | |
| 49 protected: | |
| 50 BlimpContentsViewImpl(BlimpContentsImpl* blimp_contents, | |
| 51 scoped_refptr<cc::Layer> contents_layer); | |
| 52 | |
| 53 private: | |
| 54 void StartReadbackRequest(const ReadbackRequestCallback& callback); | |
| 55 void OnReadbackComplete(const ReadbackRequestCallback& callback, | |
| 56 std::unique_ptr<cc::CopyOutputResult> result); | |
| 57 | |
| 58 BlimpContentsImpl* blimp_contents_; | |
| 59 scoped_refptr<cc::Layer> contents_layer_; | |
| 60 | |
| 61 base::WeakPtrFactory<BlimpContentsViewImpl> weak_ptr_factory_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(BlimpContentsViewImpl); | |
| 64 }; | |
| 65 | |
| 66 } // namespace client | |
| 67 } // namespace blimp | |
| 68 | |
| 69 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_VIEW_IMPL_H_ | |
| OLD | NEW |