OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_ | 5 #ifndef REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_ |
6 #define REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_ | 6 #define REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "remoting/client/jni/display_updater_factory.h" | 13 #include "remoting/client/jni/display_updater_factory.h" |
14 #include "remoting/protocol/cursor_shape_stub.h" | |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 | 17 |
17 namespace protocol { | 18 namespace protocol { |
18 class CursorShapeInfo; | |
19 class VideoRenderer; | 19 class VideoRenderer; |
20 } // namespace protocol | 20 } // namespace protocol |
21 | 21 |
22 class ChromotingJniRuntime; | 22 class ChromotingJniRuntime; |
23 | 23 |
24 // Handles display operations. Must be called and deleted on the display thread | 24 // Handles display operations. Must be called and deleted on the display thread |
25 // unless otherwise noted. | 25 // unless otherwise noted. |
26 class JniDisplayHandler : public DisplayUpdaterFactory { | 26 class JniDisplayHandler : public DisplayUpdaterFactory, |
27 public protocol::CursorShapeStub { | |
27 public: | 28 public: |
28 explicit JniDisplayHandler(ChromotingJniRuntime* runtime); | 29 explicit JniDisplayHandler(ChromotingJniRuntime* runtime); |
29 | 30 |
30 // Must be deleted on the display thread. | 31 // Must be deleted on the display thread. |
31 ~JniDisplayHandler() override; | 32 ~JniDisplayHandler() override; |
32 | 33 |
33 // Sets the DesktopViewFactory for the Java client. | 34 // Sets the DesktopViewFactory for the Java client. |
34 void InitializeClient( | 35 void InitializeClient( |
35 const base::android::JavaRef<jobject>& java_client); | 36 const base::android::JavaRef<jobject>& java_client); |
36 | 37 |
37 void UpdateCursorShape(const protocol::CursorShapeInfo& cursor_shape); | 38 // CursorShapeStub override. |
Sergey Ulanov
2016/07/27 20:38:01
nit: s/override/interface/
Sergey Ulanov
2016/07/27 20:38:01
nit: move this to private: section to make it clea
Yuwei
2016/07/27 21:01:36
Done.
Yuwei
2016/07/27 21:01:36
Done.
That's interesting C++ logic... By overridi
| |
39 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override; | |
38 | 40 |
39 // DisplayUpdaterFactory overrides (functions can be called on any thread). | 41 // DisplayUpdaterFactory overrides (functions can be called on any thread). |
40 std::unique_ptr<protocol::CursorShapeStub> CreateCursorShapeStub() override; | 42 std::unique_ptr<protocol::CursorShapeStub> CreateCursorShapeStub() override; |
41 std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() override; | 43 std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() override; |
42 | 44 |
43 // Creates a new Bitmap object to store a video frame. Can be called on any | 45 // Creates a new Bitmap object to store a video frame. Can be called on any |
44 // thread. | 46 // thread. |
45 static base::android::ScopedJavaLocalRef<jobject> NewBitmap(int width, | 47 static base::android::ScopedJavaLocalRef<jobject> NewBitmap(int width, |
46 int height); | 48 int height); |
47 | 49 |
(...skipping 16 matching lines...) Expand all Loading... | |
64 base::android::ScopedJavaGlobalRef<jobject> java_display_; | 66 base::android::ScopedJavaGlobalRef<jobject> java_display_; |
65 base::WeakPtr<JniDisplayHandler> weak_ptr_; | 67 base::WeakPtr<JniDisplayHandler> weak_ptr_; |
66 base::WeakPtrFactory<JniDisplayHandler> weak_factory_; | 68 base::WeakPtrFactory<JniDisplayHandler> weak_factory_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(JniDisplayHandler); | 70 DISALLOW_COPY_AND_ASSIGN(JniDisplayHandler); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace remoting | 73 } // namespace remoting |
72 | 74 |
73 #endif // REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_ | 75 #endif // REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_ |
OLD | NEW |