diff options
-rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/Chromoting.java | 30 | ||||
-rw-r--r-- | remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java | 30 | ||||
-rw-r--r-- | remoting/protocol/connection_to_host.h | 3 | ||||
-rw-r--r-- | remoting/protocol/errors.h | 2 | ||||
-rw-r--r-- | remoting/resources/android/values/strings.xml | 34 | ||||
-rw-r--r-- | remoting/resources/remoting_strings.grd | 10 |
6 files changed, 35 insertions, 74 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java index 1abc5b8..8a8f74c 100644 --- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java +++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java @@ -224,6 +224,14 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe /** Called when the user taps on a host entry. */ public void connectToHost(HostInfo host) { + mProgressIndicator = ProgressDialog.show(this, + host.name, getString(R.string.footer_connecting), true, true, + new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + JniInterface.disconnectFromHost(); + } + }); SessionConnector connector = new SessionConnector(this, this, mHostListLoader); connector.connectToHost(mAccount.name, mToken, host); } @@ -360,41 +368,23 @@ public class Chromoting extends Activity implements JniInterface.ConnectionListe @Override public void onConnectionState(JniInterface.ConnectionListener.State state, JniInterface.ConnectionListener.Error error) { - String stateText = getResources().getStringArray(R.array.protoc_states)[state.value()]; boolean dismissProgress = false; switch (state) { case INITIALIZING: case CONNECTING: case AUTHENTICATED: - // The connection is still being established, so we'll report the current progress. - if (mProgressIndicator == null) { - mProgressIndicator = ProgressDialog.show(this, - getString(R.string.footer_connecting), stateText, true, true, - new DialogInterface.OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - JniInterface.disconnectFromHost(); - } - }); - } else { - mProgressIndicator.setMessage(stateText); - } + // The connection is still being established. break; case CONNECTED: dismissProgress = true; - Toast.makeText(this, stateText, Toast.LENGTH_SHORT).show(); - // Display the remote desktop. startActivityForResult(new Intent(this, Desktop.class), 0); break; case FAILED: dismissProgress = true; - Toast.makeText(this, stateText + ": " - + getResources().getStringArray(R.array.protoc_errors)[error.value()], - Toast.LENGTH_LONG).show(); - + Toast.makeText(this, getString(error.message()), Toast.LENGTH_LONG).show(); // Close the Desktop view, if it is currently running. finishActivity(0); break; diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java index cf4db0e..79533a3 100644 --- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java +++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java @@ -18,7 +18,6 @@ import android.view.KeyEvent; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; -import android.widget.Toast; import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; @@ -74,32 +73,39 @@ public class JniInterface { * This enum must match the C++ enumeration remoting::protocol::ErrorCode. */ public enum Error { - OK(0), - PEER_IS_OFFLINE(1), - SESSION_REJECTED(2), - INCOMPATIBLE_PROTOCOL(3), - AUTHENTICATION_FAILED(4), - CHANNEL_CONNECTION_ERROR(5), - SIGNALING_ERROR(6), - SIGNALING_TIMEOUT(7), - HOST_OVERLOAD(8), - UNKNOWN_ERROR(9); + OK(0, 0), + PEER_IS_OFFLINE(1, R.string.error_host_is_offline), + SESSION_REJECTED(2, R.string.error_invalid_access_code), + INCOMPATIBLE_PROTOCOL(3, R.string.error_incompatible_protocol), + AUTHENTICATION_FAILED(4, R.string.error_invalid_access_code), + CHANNEL_CONNECTION_ERROR(5, R.string.error_p2p_failure), + SIGNALING_ERROR(6, R.string.error_p2p_failure), + SIGNALING_TIMEOUT(7, R.string.error_p2p_failure), + HOST_OVERLOAD(8, R.string.error_host_overload), + UNKNOWN_ERROR(9, R.string.error_unexpected); private final int mValue; + private final int mMessage; - Error(int value) { + Error(int value, int message) { mValue = value; + mMessage = message; } public int value() { return mValue; } + public int message() { + return mMessage; + } + public static Error fromValue(int value) { return values()[value]; } } + /** * Notified on connection state change. * @param state The new connection state. diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h index 6b3d1c4..154c8ac 100644 --- a/remoting/protocol/connection_to_host.h +++ b/remoting/protocol/connection_to_host.h @@ -52,8 +52,7 @@ class ConnectionToHost : public SignalStrategy::Listener, public base::NonThreadSafe { public: // The UI implementations maintain corresponding definitions of this - // enumeration in webapp/client_session.js, - // android/java/res/values/strings.xml and + // enumeration in webapp/client_session.js and // android/java/src/org/chromium/chromoting/jni/JniInterface.java. Be sure to // update these locations if you make any changes to the ordering. enum State { diff --git a/remoting/protocol/errors.h b/remoting/protocol/errors.h index f7dce9e..7f4daf6 100644 --- a/remoting/protocol/errors.h +++ b/remoting/protocol/errors.h @@ -9,7 +9,7 @@ namespace remoting { namespace protocol { // The UI implementations maintain corresponding definitions of this -// enumeration in webapp/error.js, android/java/res/values/strings.xml and +// enumeration in webapp/error.js and // android/java/src/org/chromium/chromoting/jni/JniInterface.java. // Be sure to update these locations if you make any changes to the ordering. enum ErrorCode { diff --git a/remoting/resources/android/values/strings.xml b/remoting/resources/android/values/strings.xml deleted file mode 100644 index 5ed64b7..0000000 --- a/remoting/resources/android/values/strings.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- Copyright 2014 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. ---> - -<!--User-facing strings for the Android app--> -<!--TODO(solb) Merge in with localized strings--> -<resources> - <!--Protocol states (see remoting/protocol/connection_to_host.h)--> - <string-array name="protoc_states"> - <item>Initializing protocol</item> - <item>Connecting to host</item> - <item>Authenticated to host</item> - <item>Connected to host</item> - <item>Connection failed</item> - <item>Connection closed</item> - </string-array> - - <!--Protocol errors (see remoting/protocol/errors.h)--> - <string-array name="protoc_errors"> - <item></item> - <item>Host is offline</item> - <item>Host rejected connection</item> - <item>Host using incompatible protocol</item> - <item>Host rejected authentication</item> - <item>Unable to establish data channel</item> - <item>Bad signal</item> - <item>Signal timed out</item> - <item>Host received too many bad PINs</item> - <item>Unknown error</item> - </string-array> -</resources> diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index cf26466..d30476b 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd @@ -210,7 +210,7 @@ <message desc="Error displayed if the host or client plugin are missing or if they could not be loaded." name="IDS_ERROR_BAD_PLUGIN_VERSION"> Some components required for Chrome Remote Desktop are missing. Please make sure you have installed the latest version and try again. </message> - <message desc="Error that is shown on the client side when incompatible Chrome Remote Desktop versions are installed on host and client." name="IDS_ERROR_INCOMPATIBLE_PROTOCOL"> + <message desc="Error that is shown on the client side when incompatible Chrome Remote Desktop versions are installed on host and client." name="IDS_ERROR_INCOMPATIBLE_PROTOCOL" formatter_data="android_java"> An incompatible version of Chrome Remote Desktop was detected. Please make sure that you have the latest version of Chrome and Chrome Remote Desktop on both computers and try again. </message> <message desc="Error displayed when the computer has a policy that only users in a particular domain may use it as a Chrome Remote Desktop host, and a user in a different domain is trying to use it as a Chrome Remote Desktop host." name="IDS_ERROR_INVALID_HOST_DOMAIN"> @@ -312,7 +312,7 @@ <message desc="Error displayed if the host or client plugin are missing or if they could not be loaded." name="IDS_ERROR_BAD_PLUGIN_VERSION"> Some components required for Chromoting are missing. Please make sure you have installed the latest version and try again. </message> - <message desc="Error that is shown on the client side when incompatible Chromoting versions are installed on host and client." name="IDS_ERROR_INCOMPATIBLE_PROTOCOL"> + <message desc="Error that is shown on the client side when incompatible Chromoting versions are installed on host and client." name="IDS_ERROR_INCOMPATIBLE_PROTOCOL" formatter_data="android_java"> An incompatible version of Chromoting was detected. Please make sure that you have the latest version of Chrome and Chromoting on both computers and try again. </message> <message desc="Error displayed when the computer has a policy that only users in a particular domain may use it as a Chromoting host, and a user in a different domain is trying to use it as a Chromoting host." name="IDS_ERROR_INVALID_HOST_DOMAIN"> @@ -482,16 +482,16 @@ <message desc="Column header in the connection history table showing the length of time for which a connection was active, if available." name="IDS_DURATION_HEADER"> Duration </message> - <message desc="Error that is shown on the client side when the host is blocking all connections due to failed authentication attempts." name="IDS_ERROR_HOST_OVERLOAD"> + <message desc="Error that is shown on the client side when the host is blocking all connections due to failed authentication attempts." name="IDS_ERROR_HOST_OVERLOAD" formatter_data="android_java"> Connections to the remote computer are temporarily blocked because somebody was trying to connect to it with invalid PIN. Please try again later. </message> <message desc="Error that is shown on the client side when we don't get a response from the host." name="IDS_ERROR_HOST_IS_OFFLINE" formatter_data="android_java"> The remote computer is not responding to connection requests. Please verify that it is online and try again. </message> - <message desc="Error displayed if an invalid access code is entered." name="IDS_ERROR_INVALID_ACCESS_CODE"> + <message desc="Error displayed if an invalid access code is entered." name="IDS_ERROR_INVALID_ACCESS_CODE" formatter_data="android_java"> The access code is invalid. Please try again. </message> - <message desc="Error displayed when the host is online, but we are unable to connect to it due to network configuration." name="IDS_ERROR_P2P_FAILURE"> + <message desc="Error displayed when the host is online, but we are unable to connect to it due to network configuration." name="IDS_ERROR_P2P_FAILURE" formatter_data="android_java"> Unable to reach the host. This is probably due to the configuration of the network you are using. </message> <message desc="Error displayed when the host is online, but we are unable to connect to it due to network configuration." name="IDS_ERROR_NETWORK_FAILURE"> |