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

Unified Diff: remoting/ios/bridge/client_instance.h

Issue 186733007: iOS Chromoting Client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
Index: remoting/ios/bridge/client_instance.h
diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/ios/bridge/client_instance.h
similarity index 52%
copy from remoting/client/jni/chromoting_jni_instance.h
copy to remoting/ios/bridge/client_instance.h
index 64be7415568fcddc7ea412cf49140a23c095aee5..928552d2afbc533b484db23a7381cc3bf4ac26ad 100644
--- a/remoting/client/jni/chromoting_jni_instance.h
+++ b/remoting/ios/bridge/client_instance.h
@@ -1,54 +1,49 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_
-#define REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_
+#ifndef REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_
+#define REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "remoting/client/chromoting_client.h"
#include "remoting/client/client_config.h"
#include "remoting/client/client_context.h"
#include "remoting/client/client_user_interface.h"
#include "remoting/client/frame_consumer_proxy.h"
-#include "remoting/client/jni/jni_frame_consumer.h"
+#include "remoting/jingle_glue/network_settings.h"
#include "remoting/jingle_glue/xmpp_signal_strategy.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/cursor_shape_stub.h"
-namespace remoting {
+#include "remoting/ios/bridge/frame_consumer_bridge.h"
-namespace protocol {
-class ClipboardEvent;
-class CursorShapeInfo;
-} // namespace protocol
+namespace remoting {
-class VideoRenderer;
+class ClientBridge;
-// ClientUserInterface that indirectly makes and receives JNI calls.
-class ChromotingJniInstance
- : public ClientUserInterface,
- public protocol::ClipboardStub,
- public protocol::CursorShapeStub,
- public base::RefCountedThreadSafe<ChromotingJniInstance> {
+// ClientUserInterface that indirectly makes and receives OBJ_C calls.
+class ClientInstance : public ClientUserInterface,
+ public protocol::ClipboardStub,
+ public protocol::CursorShapeStub,
+ public base::RefCountedThreadSafe<ClientInstance> {
public:
// Initiates a connection with the specified host. Call from the UI thread.
- // The instance does not take ownership of |jni_runtime|. To connect with an
+ // The instance does not take ownership of |objc_runtime|. To connect with an
dcaiafa 2014/03/19 01:14:15 s/objc_runtime/bridge/
dcaiafa 2014/03/19 01:14:15 ClientInstance does take ownership of bridge which
aboone 2014/03/21 16:42:07 Done.
aboone 2014/03/21 16:42:07 I've changed it to a WeakPtr to be explicit that b
// unpaired host, pass in |pairing_id| and |pairing_secret| as empty strings.
- ChromotingJniInstance(ChromotingJniRuntime* jni_runtime,
- const char* username,
- const char* auth_token,
- const char* host_jid,
- const char* host_id,
- const char* host_pubkey,
- const char* pairing_id,
- const char* pairing_secret);
+ ClientInstance(ClientBridge* bridge,
+ const char* username,
+ const char* auth_token,
+ const char* host_jid,
+ const char* host_id,
+ const char* host_pubkey,
+ const char* pairing_id,
+ const char* pairing_secret);
// Terminates the current connection (if it hasn't already failed) and cleans
// up. Must be called before destruction.
@@ -57,56 +52,46 @@ class ChromotingJniInstance
// Provides the user's PIN and resumes the host authentication attempt. Call
// on the UI thread once the user has finished entering this PIN into the UI,
// but only after the UI has been asked to provide a PIN (via FetchSecret()).
- void ProvideSecret(const std::string& pin, bool create_pair,
- const std::string& device_name);
-
- // Schedules a redraw on the display thread. May be called from any thread.
- void RedrawDesktop();
+ void ProvideSecret(const std::string& pin, bool create_pair);
// Moves the host's cursor to the specified coordinates, optionally with some
// mouse button depressed. If |button| is BUTTON_UNDEFINED, no click is made.
- void PerformMouseAction(int x, int y,
- protocol::MouseEvent_MouseButton button,
- bool button_down);
-
- void PerformMouseWheelDeltaAction(int delta_x, int delta_y);
+ void PerformMouseAction(
+ const webrtc::DesktopVector& position,
+ const webrtc::DesktopVector& wheel_delta,
+ int /* protocol::MouseEvent_MouseButton */ whichButton,
+ bool button_down);
// Sends the provided keyboard scan code to the host.
void PerformKeyboardAction(int key_code, bool key_down);
- // Records paint time for statistics logging, if enabled. May be called from
- // any thread.
- void RecordPaintTime(int64 paint_time_ms);
-
// ClientUserInterface implementation.
- virtual void OnConnectionState(
- protocol::ConnectionToHost::State state,
- protocol::ErrorCode error) OVERRIDE;
+ virtual void OnConnectionState(protocol::ConnectionToHost::State state,
+ protocol::ErrorCode error) OVERRIDE;
virtual void OnConnectionReady(bool ready) OVERRIDE;
virtual void OnRouteChanged(const std::string& channel_name,
const protocol::TransportRoute& route) OVERRIDE;
virtual void SetCapabilities(const std::string& capabilities) OVERRIDE;
- virtual void SetPairingResponse(
- const protocol::PairingResponse& response) OVERRIDE;
- virtual void DeliverHostMessage(
- const protocol::ExtensionMessage& message) OVERRIDE;
+ virtual void SetPairingResponse(const protocol::PairingResponse& response)
+ OVERRIDE;
+ virtual void DeliverHostMessage(const protocol::ExtensionMessage& message)
+ OVERRIDE;
virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE;
virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE;
virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>
GetTokenFetcher(const std::string& host_public_key) OVERRIDE;
// CursorShapeStub implementation.
- virtual void InjectClipboardEvent(
- const protocol::ClipboardEvent& event) OVERRIDE;
+ virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event)
+ OVERRIDE;
// ClipboardStub implementation.
virtual void SetCursorShape(const protocol::CursorShapeInfo& shape) OVERRIDE;
private:
// This object is ref-counted, so it cleans itself up.
- virtual ~ChromotingJniInstance();
+ virtual ~ClientInstance();
- void ConnectToHostOnDisplayThread();
void ConnectToHostOnNetworkThread();
void DisconnectFromHostOnNetworkThread();
@@ -116,33 +101,21 @@ class ChromotingJniInstance
void FetchSecret(bool pairable,
const protocol::SecretFetchedCallback& callback);
- // Sets the device name. Can be called on any thread.
- void SetDeviceName(const std::string& device_name);
-
- // Enables or disables periodic logging of performance statistics. Called on
- // the network thread.
- void EnableStatsLogging(bool enabled);
-
- // If logging is enabled, logs the current connection statistics, and
- // triggers another call to this function after the logging time interval.
- // Called on the network thread.
- void LogPerfStats();
-
- // Used to obtain task runner references and make calls to Java methods.
- ChromotingJniRuntime* jni_runtime_;
+ // Used to obtain task runner references and exchange messages between the
+ // common Chromoting protocol and ojbc interface.
+ scoped_refptr<ClientBridge> bridge_;
// ID of the host we are connecting to.
std::string host_id_;
// This group of variables is to be used on the display thread.
dcaiafa 2014/03/19 01:14:15 s/display/UI
aboone 2014/03/21 16:42:07 Done.
- scoped_refptr<FrameConsumerProxy> frame_consumer_;
- scoped_ptr<JniFrameConsumer> view_;
- scoped_ptr<base::WeakPtrFactory<JniFrameConsumer> > view_weak_factory_;
+ scoped_ptr<VideoRenderer> video_renderer_;
+ scoped_ptr<FrameConsumerBridge> view_;
+ scoped_ptr<base::WeakPtrFactory<FrameConsumer> > view_weak_factory_;
// This group of variables is to be used on the network thread.
ClientConfig client_config_;
- scoped_ptr<ClientContext> client_context_;
- scoped_ptr<VideoRenderer> video_renderer_;
+ ClientContext client_context_;
scoped_ptr<protocol::ConnectionToHost> connection_;
scoped_ptr<ChromotingClient> client_;
XmppSignalStrategy::XmppServerConfig xmpp_config_;
@@ -158,19 +131,11 @@ class ChromotingJniInstance
// once per run, and always before any reference to this flag.)
bool create_pairing_;
- // The device name to appear in the paired-clients list. Accessed on the
- // network thread.
- std::string device_name_;
-
- // If this is true, performance statistics will be periodically written to
- // the Android log. Used on the network thread.
- bool stats_logging_enabled_;
-
- friend class base::RefCountedThreadSafe<ChromotingJniInstance>;
+ friend class base::RefCountedThreadSafe<ClientInstance>;
- DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance);
+ DISALLOW_COPY_AND_ASSIGN(ClientInstance);
};
} // namespace remoting
-#endif
+#endif // REMOTING_IOS_BRIDGE_CLIENT_INSTANCE_H_

Powered by Google App Engine
This is Rietveld 408576698