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

Side by Side Diff: remoting/client/jni/jni_display_handler.h

Issue 2187723002: [Remoting Android] Refactor CursorShapeStubProxy from JniDisplayHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « remoting/client/cursor_shape_stub_proxy.cc ('k') | remoting/client/jni/jni_display_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
39 // DisplayUpdaterFactory overrides (functions can be called on any thread). 38 // DisplayUpdaterFactory overrides (functions can be called on any thread).
40 std::unique_ptr<protocol::CursorShapeStub> CreateCursorShapeStub() override; 39 std::unique_ptr<protocol::CursorShapeStub> CreateCursorShapeStub() override;
41 std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() override; 40 std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() override;
42 41
43 // Creates a new Bitmap object to store a video frame. Can be called on any 42 // Creates a new Bitmap object to store a video frame. Can be called on any
44 // thread. 43 // thread.
45 static base::android::ScopedJavaLocalRef<jobject> NewBitmap(int width, 44 static base::android::ScopedJavaLocalRef<jobject> NewBitmap(int width,
46 int height); 45 int height);
47 46
48 // Updates video frame bitmap. |bitmap| must be an instance of 47 // Updates video frame bitmap. |bitmap| must be an instance of
49 // android.graphics.Bitmap. 48 // android.graphics.Bitmap.
50 void UpdateFrameBitmap(base::android::ScopedJavaGlobalRef<jobject> bitmap); 49 void UpdateFrameBitmap(base::android::ScopedJavaGlobalRef<jobject> bitmap);
51 50
52 // Draws the latest image buffer onto the canvas. 51 // Draws the latest image buffer onto the canvas.
53 void RedrawCanvas(); 52 void RedrawCanvas();
54 53
55 static bool RegisterJni(JNIEnv* env); 54 static bool RegisterJni(JNIEnv* env);
56 55
57 // Schedule redraw. Can be called on any thread. 56 // Schedule redraw. Can be called on any thread.
58 void ScheduleRedraw(JNIEnv* env, 57 void ScheduleRedraw(JNIEnv* env,
59 const base::android::JavaParamRef<jobject>& caller); 58 const base::android::JavaParamRef<jobject>& caller);
60 59
61 private: 60 private:
61 // CursorShapeStub interface.
62 void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
63
62 ChromotingJniRuntime* runtime_; 64 ChromotingJniRuntime* runtime_;
63 65
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_
OLDNEW
« no previous file with comments | « remoting/client/cursor_shape_stub_proxy.cc ('k') | remoting/client/jni/jni_display_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698