Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.jni; | 5 package org.chromium.chromoting.jni; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.AlertDialog; | 8 import android.app.AlertDialog; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.DialogInterface; | 10 import android.content.DialogInterface; |
| 11 import android.content.SharedPreferences; | 11 import android.content.SharedPreferences; |
| 12 import android.graphics.Bitmap; | 12 import android.graphics.Bitmap; |
| 13 import android.graphics.Point; | 13 import android.graphics.Point; |
| 14 import android.os.Build; | 14 import android.os.Build; |
| 15 import android.os.Looper; | 15 import android.os.Looper; |
| 16 import android.util.Log; | 16 import android.util.Log; |
| 17 import android.view.KeyEvent; | 17 import android.view.KeyEvent; |
| 18 import android.view.View; | 18 import android.view.View; |
| 19 import android.widget.CheckBox; | 19 import android.widget.CheckBox; |
| 20 import android.widget.TextView; | 20 import android.widget.TextView; |
| 21 import android.widget.Toast; | |
|
Jamie
2014/03/05 20:51:31
Unused import.
| |
| 22 | 21 |
| 23 import org.chromium.base.CalledByNative; | 22 import org.chromium.base.CalledByNative; |
| 24 import org.chromium.base.JNINamespace; | 23 import org.chromium.base.JNINamespace; |
| 25 import org.chromium.chromoting.R; | 24 import org.chromium.chromoting.R; |
| 26 | 25 |
| 27 import java.nio.ByteBuffer; | 26 import java.nio.ByteBuffer; |
| 28 import java.nio.ByteOrder; | 27 import java.nio.ByteOrder; |
| 29 | 28 |
| 30 /** | 29 /** |
| 31 * Initializes the Chromium remoting library, and provides JNI calls into it. | 30 * Initializes the Chromium remoting library, and provides JNI calls into it. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 mValue = value; | 90 mValue = value; |
| 92 } | 91 } |
| 93 | 92 |
| 94 public int value() { | 93 public int value() { |
| 95 return mValue; | 94 return mValue; |
| 96 } | 95 } |
| 97 | 96 |
| 98 public static Error fromValue(int value) { | 97 public static Error fromValue(int value) { |
| 99 return values()[value]; | 98 return values()[value]; |
| 100 } | 99 } |
| 100 | |
| 101 public int toResourceId() { | |
|
Lambros
2014/03/05 23:36:54
Make this a public final member of the enum instea
Jamie
2014/03/06 01:29:32
I made it private instead, with an accessor for co
| |
| 102 switch (this) { | |
| 103 case PEER_IS_OFFLINE: | |
| 104 return R.string.error_host_is_offline; | |
| 105 case SESSION_REJECTED: | |
| 106 case AUTHENTICATION_FAILED: | |
| 107 return R.string.error_invalid_access_code; | |
| 108 case INCOMPATIBLE_PROTOCOL: | |
| 109 return R.string.error_incompatible_protocol; | |
| 110 case HOST_OVERLOAD: | |
| 111 return R.string.error_host_overload; | |
| 112 case CHANNEL_CONNECTION_ERROR: | |
| 113 case SIGNALING_ERROR: | |
| 114 case SIGNALING_TIMEOUT: | |
| 115 return R.string.error_p2p_failure; | |
| 116 default: | |
| 117 return R.string.error_unexpected; | |
| 118 } | |
| 119 } | |
| 101 } | 120 } |
| 102 | 121 |
| 122 | |
| 103 /** | 123 /** |
| 104 * Notified on connection state change. | 124 * Notified on connection state change. |
| 105 * @param state The new connection state. | 125 * @param state The new connection state. |
| 106 * @param error The error code, if state is STATE_FAILED. | 126 * @param error The error code, if state is STATE_FAILED. |
| 107 */ | 127 */ |
| 108 void onConnectionState(State state, Error error); | 128 void onConnectionState(State state, Error error); |
| 109 } | 129 } |
| 110 | 130 |
| 111 /* | 131 /* |
| 112 * Connection-initiating state machine. | 132 * Connection-initiating state machine. |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 buffer.asIntBuffer().get(data, 0, data.length); | 428 buffer.asIntBuffer().get(data, 0, data.length); |
| 409 sCursorBitmap = Bitmap.createBitmap(data, width, height, Bitmap.Config.A RGB_8888); | 429 sCursorBitmap = Bitmap.createBitmap(data, width, height, Bitmap.Config.A RGB_8888); |
| 410 } | 430 } |
| 411 | 431 |
| 412 /** Position of cursor hotspot within cursor image. Called on the graphics t hread. */ | 432 /** Position of cursor hotspot within cursor image. Called on the graphics t hread. */ |
| 413 public static Point getCursorHotspot() { return sCursorHotspot; } | 433 public static Point getCursorHotspot() { return sCursorHotspot; } |
| 414 | 434 |
| 415 /** Returns the current cursor shape. Called on the graphics thread. */ | 435 /** Returns the current cursor shape. Called on the graphics thread. */ |
| 416 public static Bitmap getCursorBitmap() { return sCursorBitmap; } | 436 public static Bitmap getCursorBitmap() { return sCursorBitmap; } |
| 417 } | 437 } |
| OLD | NEW |