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

Unified Diff: remoting/client/jni/jni_client.h

Issue 2753963002: Refactoring and rewriting the chromoting jni instance to be chromoting session. (Closed)
Patch Set: Updating based on feedback. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/jni/connect_to_host_info.cc ('k') | remoting/client/jni/jni_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/jni_client.h
diff --git a/remoting/client/jni/jni_client.h b/remoting/client/jni/jni_client.h
index 4428091c7513216a3c972cb1cd89f4ea63508acf..3e164b7dfdc17a251b2c3702ed5dad37410442d5 100644
--- a/remoting/client/jni/jni_client.h
+++ b/remoting/client/jni/jni_client.h
@@ -10,13 +10,14 @@
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "remoting/client/chromoting_session.h"
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/cursor_shape_stub.h"
namespace remoting {
+class AudioPlayerAndroid;
class ChromotingClientRuntime;
-class ChromotingJniInstance;
class JniGlDisplayHandler;
class JniPairingSecretFetcher;
@@ -25,10 +26,10 @@ struct ConnectToHostInfo;
// Houses resources scoped to a session and exposes JNI interface to the
// Java client during a session. All its methods should be invoked exclusively
// from the UI thread unless otherwise noted.
-class JniClient {
+class JniClient : public ChromotingSession::Delegate {
public:
JniClient(base::android::ScopedJavaGlobalRef<jobject> java_client);
- virtual ~JniClient();
+ ~JniClient() override;
// Initiates a connection with the specified host. To skip the attempt at
// pair-based authentication, leave |pairing_id| and |pairing_secret| as
@@ -39,34 +40,36 @@ class JniClient {
// |session_|. This is a no-op unless |session| is currently non-null.
void DisconnectFromHost();
- // Notifies Java code of the current connection status. Call on UI thread.
- void OnConnectionState(protocol::ConnectionToHost::State state,
- protocol::ErrorCode error);
-
// Pops up a dialog box asking the user to enter a PIN. Call on UI thread.
void DisplayAuthenticationPrompt(bool pairing_supported);
+ // Register C++ methods exposed to Java using JNI.
+ static bool RegisterJni(JNIEnv* env);
+
+ // ChromotingSession::Delegate implementation
+
+ // Notifies Java code of the current connection status. Call on UI thread.
+ void OnConnectionState(protocol::ConnectionToHost::State state,
+ protocol::ErrorCode error) override;
+
// Saves new pairing credentials to permanent storage. Call on UI thread.
void CommitPairingCredentials(const std::string& host,
const std::string& id,
- const std::string& secret);
+ const std::string& secret) override;
// Pops up a third party login page to fetch token required for
// authentication. Call on UI thread.
void FetchThirdPartyToken(const std::string& token_url,
const std::string& client_id,
- const std::string& scope);
+ const std::string& scope) override;
// Pass on the set of negotiated capabilities to the client.
- void SetCapabilities(const std::string& capabilities);
+ void SetCapabilities(const std::string& capabilities) override;
// Passes on the deconstructed ExtensionMessage to the client to handle
// appropriately.
void HandleExtensionMessage(const std::string& type,
- const std::string& message);
-
- // Register C++ methods exposed to Java using JNI.
- static bool RegisterJni(JNIEnv* env);
+ const std::string& message) override;
// The following methods are exposed to Java via JNI.
@@ -154,12 +157,13 @@ class JniClient {
base::android::ScopedJavaGlobalRef<jobject> java_client_;
std::unique_ptr<JniGlDisplayHandler> display_handler_;
+ std::unique_ptr<AudioPlayerAndroid> audio_player_;
// Deleted on UI thread.
std::unique_ptr<JniPairingSecretFetcher> secret_fetcher_;
// Deleted on Network thread.
- std::unique_ptr<ChromotingJniInstance> session_;
+ std::unique_ptr<ChromotingSession> session_;
// Holds pointer for the UI thread.
base::WeakPtr<JniClient> weak_ptr_;
« no previous file with comments | « remoting/client/jni/connect_to_host_info.cc ('k') | remoting/client/jni/jni_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698