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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/DesktopView.java

Issue 2066683003: [Chromoting] Add InputInjector and InputInjectorWrapper for easy unittesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 package org.chromium.chromoting; 5 package org.chromium.chromoting;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.graphics.Canvas; 9 import android.graphics.Canvas;
10 import android.graphics.Color; 10 import android.graphics.Color;
(...skipping 20 matching lines...) Expand all
31 */ 31 */
32 /** GUI element that holds the drawing canvas. */ 32 /** GUI element that holds the drawing canvas. */
33 public class DesktopView extends SurfaceView implements DesktopViewInterface, 33 public class DesktopView extends SurfaceView implements DesktopViewInterface,
34 SurfaceHolder.Callback { 34 SurfaceHolder.Callback {
35 /** Used to define the animation feedback shown when a user touches the scre en. */ 35 /** Used to define the animation feedback shown when a user touches the scre en. */
36 public enum InputFeedbackType { NONE, SMALL_ANIMATION, LARGE_ANIMATION } 36 public enum InputFeedbackType { NONE, SMALL_ANIMATION, LARGE_ANIMATION }
37 37
38 private static final String TAG = "Chromoting"; 38 private static final String TAG = "Chromoting";
39 39
40 private final RenderData mRenderData; 40 private final RenderData mRenderData;
41 private final TouchInputHandlerInterface mInputHandler; 41 private final TouchInputHandler mInputHandler;
42 42
43 /** The parent Desktop activity. */ 43 /** The parent Desktop activity. */
44 private Desktop mDesktop; 44 private Desktop mDesktop;
45 45
46 /** The Client connection, used to inject input and fetch the video frames. */ 46 /** The Client connection, used to inject input and fetch the video frames. */
47 private Client mClient; 47 private Client mClient;
48 48
49 49
50 // Flag to prevent multiple repaint requests from being backed up. Requests for repainting will 50 // Flag to prevent multiple repaint requests from being backed up. Requests for repainting will
51 // be dropped if this is already set to true. This is used by the main threa d and the painting 51 // be dropped if this is already set to true. This is used by the main threa d and the painting
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 @Override 89 @Override
90 public void init(Desktop desktop, Client client) { 90 public void init(Desktop desktop, Client client) {
91 Preconditions.isNull(mDesktop); 91 Preconditions.isNull(mDesktop);
92 Preconditions.isNull(mClient); 92 Preconditions.isNull(mClient);
93 Preconditions.notNull(desktop); 93 Preconditions.notNull(desktop);
94 Preconditions.notNull(client); 94 Preconditions.notNull(client);
95 mDesktop = desktop; 95 mDesktop = desktop;
96 mClient = client; 96 mClient = client;
97 mInputHandler.init(desktop, client); 97 mInputHandler.init(desktop, new InputEventSender(client));
98 } 98 }
99 99
100 public Event<PaintEventParameter> onPaint() { 100 public Event<PaintEventParameter> onPaint() {
101 return mOnPaint; 101 return mOnPaint;
102 } 102 }
103 103
104 public Event<SizeChangedEventParameter> onClientSizeChanged() { 104 public Event<SizeChangedEventParameter> onClientSizeChanged() {
105 return mOnClientSizeChanged; 105 return mOnClientSizeChanged;
106 } 106 }
107 107
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 @Override 326 @Override
327 public void setAnimationEnabled(boolean enabled) { 327 public void setAnimationEnabled(boolean enabled) {
328 synchronized (mAnimationLock) { 328 synchronized (mAnimationLock) {
329 if (enabled && !mInputAnimationRunning) { 329 if (enabled && !mInputAnimationRunning) {
330 requestRepaint(); 330 requestRepaint();
331 } 331 }
332 mInputAnimationRunning = enabled; 332 mInputAnimationRunning = enabled;
333 } 333 }
334 } 334 }
335 } 335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698