summaryrefslogtreecommitdiff
path: root/remoting
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-09-26 13:24:57 +0100
committerTorne (Richard Coles) <torne@google.com>2013-09-26 13:24:57 +0100
commit68043e1e95eeb07d5cae7aca370b26518b0867d6 (patch)
treecc6a216bce6aa9319a216327b73a07f49200dab5 /remoting
parentcede44592cfb9ec370925d10c2df733349a94a82 (diff)
downloadchromium_org-68043e1e95eeb07d5cae7aca370b26518b0867d6.tar.gz
Merge from Chromium at DEPS revision 225410
This commit was generated by merge_to_master.py. Change-Id: Ifa1539ca216abb163295ee7a77f81bb67f52e178
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/auto_thread_unittest.cc1
-rw-r--r--remoting/client/jni/chromoting_jni_instance.cc9
-rw-r--r--remoting/client/plugin/pepper_input_handler.cc8
-rw-r--r--remoting/client/plugin/pepper_network_manager.cc9
-rw-r--r--remoting/client/plugin/pepper_network_manager.h10
-rw-r--r--remoting/client/plugin/pepper_packet_socket_factory.cc12
-rw-r--r--remoting/client/plugin/pepper_port_allocator.cc6
-rw-r--r--remoting/client/rectangle_update_decoder.cc11
-rw-r--r--remoting/codec/audio_encoder_opus.cc6
-rw-r--r--remoting/codec/codec_test.cc8
-rw-r--r--remoting/codec/video_decoder.h19
-rw-r--r--remoting/codec/video_decoder_verbatim.cc44
-rw-r--r--remoting/codec/video_decoder_verbatim.h4
-rw-r--r--remoting/codec/video_decoder_vp8.cc39
-rw-r--r--remoting/codec/video_decoder_vp8.h4
-rw-r--r--remoting/codec/video_encoder_verbatim.cc2
-rw-r--r--remoting/host/DEPS1
-rw-r--r--remoting/host/OWNERS1
-rw-r--r--remoting/host/config_file_watcher.cc2
-rw-r--r--remoting/host/constants_mac.cc4
-rw-r--r--remoting/host/input_injector_linux.cc11
-rw-r--r--remoting/host/input_injector_mac.cc11
-rw-r--r--remoting/host/input_injector_win.cc72
-rw-r--r--remoting/host/mac/me2me_preference_pane.mm13
-rw-r--r--remoting/host/plugin/host_script_object.cc9
-rw-r--r--remoting/host/register_support_host_request_unittest.cc1
-rw-r--r--remoting/host/remoting_me2me_host.cc10
-rw-r--r--remoting/host/server_log_entry.cc12
-rw-r--r--remoting/host/service_urls.cc6
-rw-r--r--remoting/host/win/elevated_controller.cc14
-rw-r--r--remoting/jingle_glue/chromium_port_allocator.cc13
-rw-r--r--remoting/jingle_glue/chromium_socket_factory.cc16
-rw-r--r--remoting/jingle_glue/chromium_socket_factory_unittest.cc3
-rw-r--r--remoting/jingle_glue/xmpp_signal_strategy.cc14
-rw-r--r--remoting/jingle_glue/xmpp_signal_strategy.h13
-rw-r--r--remoting/protocol/libjingle_transport_factory.cc3
-rw-r--r--remoting/remoting.gyp3
-rw-r--r--remoting/resources/remoting_strings.grd2
-rw-r--r--remoting/test/DEPS1
-rw-r--r--remoting/test/key_code_conv.cc36
-rw-r--r--remoting/test/key_code_conv.h25
-rw-r--r--remoting/test/key_code_map.h94
-rw-r--r--remoting/test/me2me_browsertest.cc28
-rw-r--r--remoting/test/remote_desktop_browsertest.cc43
-rw-r--r--remoting/test/remote_desktop_browsertest.h13
-rw-r--r--remoting/webapp/all_js_load.gtestjs1
-rw-r--r--remoting/webapp/cs_oauth2_trampoline.js12
-rw-r--r--remoting/webapp/jscompiler_hacks.js27
-rw-r--r--remoting/webapp/oauth2.js31
-rw-r--r--remoting/webapp/oauth2_callback.html16
-rw-r--r--remoting/webapp/oauth2_callback.js39
51 files changed, 460 insertions, 332 deletions
diff --git a/remoting/base/auto_thread_unittest.cc b/remoting/base/auto_thread_unittest.cc
index f78bbf9861..3862900f46 100644
--- a/remoting/base/auto_thread_unittest.cc
+++ b/remoting/base/auto_thread_unittest.cc
@@ -17,7 +17,6 @@
namespace {
const char kThreadName[] = "Test thread";
-const char kThreadName2[] = "Test thread 2";
void SetFlagTask(bool* success) {
*success = true;
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc
index 28822f6654..84d94d6448 100644
--- a/remoting/client/jni/chromoting_jni_instance.cc
+++ b/remoting/client/jni/chromoting_jni_instance.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/logging.h"
-#include "jingle/glue/xmpp_client_socket_factory.h"
#include "net/socket/client_socket_factory.h"
#include "remoting/client/audio_player.h"
#include "remoting/client/jni/android_keymap.h"
@@ -256,11 +255,9 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
view_->set_frame_producer(client_->GetFrameProducer());
- scoped_ptr<jingle_glue::ResolvingClientSocketFactory> socket_factory(
- new jingle_glue::XmppClientSocketFactory(
- net::ClientSocketFactory::GetDefaultFactory(), net::SSLConfig(),
- jni_runtime_->url_requester(), false));
- signaling_.reset(new XmppSignalStrategy(socket_factory.Pass(), xmpp_config_));
+ signaling_.reset(new XmppSignalStrategy(
+ net::ClientSocketFactory::GetDefaultFactory(),
+ jni_runtime_->url_requester(), xmpp_config_));
network_settings_.reset(new NetworkSettings(
NetworkSettings::NAT_TRAVERSAL_ENABLED));
diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc
index cc1bef7d23..a34db14e15 100644
--- a/remoting/client/plugin/pepper_input_handler.cc
+++ b/remoting/client/plugin/pepper_input_handler.cc
@@ -95,6 +95,14 @@ bool PepperInputHandler::HandleInputEvent(const pp::InputEvent& event) {
mouse_event.set_button_down(is_down);
mouse_event.set_x(pp_mouse_event.GetPosition().x());
mouse_event.set_y(pp_mouse_event.GetPosition().y());
+
+ // Add relative movement if the mouse is locked.
+ if (mouse_lock_state_ == MouseLockOn) {
+ pp::Point delta = pp_mouse_event.GetMovement();
+ mouse_event.set_delta_x(delta.x());
+ mouse_event.set_delta_y(delta.y());
+ }
+
input_stub_->InjectMouseEvent(mouse_event);
}
return true;
diff --git a/remoting/client/plugin/pepper_network_manager.cc b/remoting/client/plugin/pepper_network_manager.cc
index 424deded99..b4787ca7c8 100644
--- a/remoting/client/plugin/pepper_network_manager.cc
+++ b/remoting/client/plugin/pepper_network_manager.cc
@@ -10,7 +10,7 @@
#include "base/thread_task_runner_handle.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/net_address.h"
-#include "ppapi/cpp/private/network_list_private.h"
+#include "ppapi/cpp/network_list.h"
#include "remoting/client/plugin/pepper_util.h"
#include "third_party/libjingle/source/talk/base/socketaddress.h"
@@ -22,7 +22,7 @@ PepperNetworkManager::PepperNetworkManager(const pp::InstanceHandle& instance)
network_list_received_(false),
callback_factory_(this),
weak_factory_(this) {
- pp::CompletionCallbackWithOutput<pp::NetworkListPrivate> callback =
+ pp::CompletionCallbackWithOutput<pp::NetworkList> callback =
callback_factory_.NewCallbackWithOutput(
&PepperNetworkManager::OnNetworkList);
monitor_.UpdateNetworkList(callback);
@@ -47,9 +47,8 @@ void PepperNetworkManager::StopUpdating() {
--start_count_;
}
-
void PepperNetworkManager::OnNetworkList(int32_t result,
- const pp::NetworkListPrivate& list) {
+ const pp::NetworkList& list) {
if (result != PP_OK) {
SignalError();
return;
@@ -59,7 +58,7 @@ void PepperNetworkManager::OnNetworkList(int32_t result,
network_list_received_ = true;
// Request for the next update.
- pp::CompletionCallbackWithOutput<pp::NetworkListPrivate> callback =
+ pp::CompletionCallbackWithOutput<pp::NetworkList> callback =
callback_factory_.NewCallbackWithOutput(
&PepperNetworkManager::OnNetworkList);
monitor_.UpdateNetworkList(callback);
diff --git a/remoting/client/plugin/pepper_network_manager.h b/remoting/client/plugin/pepper_network_manager.h
index 4bfe9457ee..7711eed662 100644
--- a/remoting/client/plugin/pepper_network_manager.h
+++ b/remoting/client/plugin/pepper_network_manager.h
@@ -8,17 +8,17 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "ppapi/cpp/instance_handle.h"
-#include "ppapi/cpp/private/network_monitor_private.h"
+#include "ppapi/cpp/network_monitor.h"
#include "ppapi/utility/completion_callback_factory.h"
#include "third_party/libjingle/source/talk/base/network.h"
namespace pp {
-class NetworkListPrivate;
+class NetworkList;
} // namespace pp
namespace remoting {
-// PepperNetworkManager uses the PPB_NetworkMonitor_Private API to
+// PepperNetworkManager uses the PPB_NetworkMonitor API to
// implement the NetworkManager interface that libjingle uses to
// monitor the host system's network interfaces.
class PepperNetworkManager : public talk_base::NetworkManagerBase {
@@ -34,11 +34,11 @@ class PepperNetworkManager : public talk_base::NetworkManagerBase {
static void OnNetworkListCallbackHandler(void* user_data,
PP_Resource list_resource);
- void OnNetworkList(int32_t result, const pp::NetworkListPrivate& list);
+ void OnNetworkList(int32_t result, const pp::NetworkList& list);
void SendNetworksChangedSignal();
- pp::NetworkMonitorPrivate monitor_;
+ pp::NetworkMonitor monitor_;
int start_count_;
bool network_list_received_;
diff --git a/remoting/client/plugin/pepper_packet_socket_factory.cc b/remoting/client/plugin/pepper_packet_socket_factory.cc
index 2f37ee2bcc..1295a601cd 100644
--- a/remoting/client/plugin/pepper_packet_socket_factory.cc
+++ b/remoting/client/plugin/pepper_packet_socket_factory.cc
@@ -40,10 +40,12 @@ class UdpPacketSocket : public talk_base::AsyncPacketSocket {
// talk_base::AsyncPacketSocket interface.
virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE;
virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE;
- virtual int Send(const void* data, size_t data_size) OVERRIDE;
+ virtual int Send(const void* data, size_t data_size,
+ talk_base::DiffServCodePoint dscp) OVERRIDE;
virtual int SendTo(const void* data,
size_t data_size,
- const talk_base::SocketAddress& address) OVERRIDE;
+ const talk_base::SocketAddress& address,
+ talk_base::DiffServCodePoint dscp) OVERRIDE;
virtual int Close() OVERRIDE;
virtual State GetState() const OVERRIDE;
virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE;
@@ -190,7 +192,8 @@ talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const {
return talk_base::SocketAddress();
}
-int UdpPacketSocket::Send(const void* data, size_t data_size) {
+int UdpPacketSocket::Send(const void* data, size_t data_size,
+ talk_base::DiffServCodePoint dscp) {
// UDP sockets are not connected - this method should never be called.
NOTREACHED();
return EWOULDBLOCK;
@@ -198,7 +201,8 @@ int UdpPacketSocket::Send(const void* data, size_t data_size) {
int UdpPacketSocket::SendTo(const void* data,
size_t data_size,
- const talk_base::SocketAddress& address) {
+ const talk_base::SocketAddress& address,
+ talk_base::DiffServCodePoint dscp) {
if (state_ != STATE_BOUND) {
// TODO(sergeyu): StunPort may try to send stun request before we
// are bound. Fix that problem and change this to DCHECK.
diff --git a/remoting/client/plugin/pepper_port_allocator.cc b/remoting/client/plugin/pepper_port_allocator.cc
index c04d7aaf83..e0d0b4037f 100644
--- a/remoting/client/plugin/pepper_port_allocator.cc
+++ b/remoting/client/plugin/pepper_port_allocator.cc
@@ -22,9 +22,6 @@ namespace remoting {
namespace {
-// URL used to create a relay session.
-const char kCreateRelaySessionURL[] = "/create_session";
-
// Read buffer we allocate per read when reading response from
// URLLoader. Normally the response from URL loader is smaller than 1kB.
const int kReadSize = 1024;
@@ -320,7 +317,8 @@ PepperPortAllocator::PepperPortAllocator(
// username fragment is shared between all candidates for this
// channel.
set_flags(cricket::PORTALLOCATOR_DISABLE_TCP |
- cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
+ cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG|
+ cricket::PORTALLOCATOR_ENABLE_IPV6);
}
PepperPortAllocator::~PepperPortAllocator() {
diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc
index e7c2f2ff2d..af123e85b8 100644
--- a/remoting/client/rectangle_update_decoder.cc
+++ b/remoting/client/rectangle_update_decoder.cc
@@ -88,14 +88,11 @@ void RectangleUpdateDecoder::DecodePacket(scoped_ptr<VideoPacket> packet,
if (notify_size_or_dpi_change)
consumer_->SetSourceSize(source_size_, source_dpi_);
- if (!decoder_->IsReadyForData()) {
- // TODO(ajwong): This whole thing should move into an invalid state.
- LOG(ERROR) << "Decoder is unable to process data. Dropping packet.";
- return;
- }
-
- if (decoder_->DecodePacket(packet.get()) == VideoDecoder::DECODE_DONE)
+ if (decoder_->DecodePacket(*packet.get())) {
SchedulePaint();
+ } else {
+ LOG(ERROR) << "DecodePacket() failed.";
+ }
}
void RectangleUpdateDecoder::SchedulePaint() {
diff --git a/remoting/codec/audio_encoder_opus.cc b/remoting/codec/audio_encoder_opus.cc
index 51b66f09b5..53bfe0b0c0 100644
--- a/remoting/codec/audio_encoder_opus.cc
+++ b/remoting/codec/audio_encoder_opus.cc
@@ -18,12 +18,6 @@ namespace {
// Output 160 kb/s bitrate.
const int kOutputBitrateBps = 160 * 1024;
-// Encoded buffer size.
-const int kFrameDefaultBufferSize = 4096;
-
-// Maximum buffer size we'll allocate when encoding before giving up.
-const int kMaxBufferSize = 65536;
-
// Opus doesn't support 44100 sampling rate so we always resample to 48kHz.
const AudioPacket::SamplingRate kOpusSamplingRate =
AudioPacket::SAMPLING_RATE_48000;
diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc
index 26bd84c293..e63ec3e507 100644
--- a/remoting/codec/codec_test.cc
+++ b/remoting/codec/codec_test.cc
@@ -78,13 +78,9 @@ class VideoDecoderTester {
}
void ReceivedPacket(VideoPacket* packet) {
- VideoDecoder::DecodeResult result = decoder_->DecodePacket(packet);
+ ASSERT_TRUE(decoder_->DecodePacket(*packet));
- ASSERT_NE(VideoDecoder::DECODE_ERROR, result);
-
- if (result == VideoDecoder::DECODE_DONE) {
- RenderFrame();
- }
+ RenderFrame();
}
void RenderFrame() {
diff --git a/remoting/codec/video_decoder.h b/remoting/codec/video_decoder.h
index 83197b8c9d..b3048a9088 100644
--- a/remoting/codec/video_decoder.h
+++ b/remoting/codec/video_decoder.h
@@ -20,14 +20,7 @@ namespace remoting {
// outputs frames of data.
class VideoDecoder {
public:
- // DecodeResult is returned from DecodePacket() and indicates current state
- // of the decoder. DECODE_DONE means that last packet for the frame was
- // processed, and the frame can be displayed now. DECODE_ERROR is returned if
- // there was an error in the stream.
- enum DecodeResult {
- DECODE_ERROR,
- DECODE_DONE,
- };
+ static const int kBytesPerPixel = 4;
VideoDecoder() {}
virtual ~VideoDecoder() {}
@@ -36,13 +29,9 @@ class VideoDecoder {
// |screen size| must not be empty.
virtual void Initialize(const webrtc::DesktopSize& screen_size) = 0;
- // Feeds more data into the decoder.
- virtual DecodeResult DecodePacket(const VideoPacket* packet) = 0;
-
- // Returns true if decoder is ready to accept data via DecodePacket.
- virtual bool IsReadyForData() = 0;
-
- virtual VideoPacketFormat::Encoding Encoding() = 0;
+ // Feeds more data into the decoder. Returns true if |packet| was processed
+ // and the frame can be displayed now.
+ virtual bool DecodePacket(const VideoPacket& packet) = 0;
// Marks the specified |region| of the view for update the next time
// RenderFrame() is called. |region| is expressed in |view_size| coordinates.
diff --git a/remoting/codec/video_decoder_verbatim.cc b/remoting/codec/video_decoder_verbatim.cc
index 81c3b48225..05af0ceeab 100644
--- a/remoting/codec/video_decoder_verbatim.cc
+++ b/remoting/codec/video_decoder_verbatim.cc
@@ -9,19 +9,10 @@
namespace remoting {
-namespace {
-// Both input and output data are assumed to be RGBA32.
-const int kBytesPerPixel = 4;
-} // namespace
-
VideoDecoderVerbatim::VideoDecoderVerbatim() {}
VideoDecoderVerbatim::~VideoDecoderVerbatim() {}
-bool VideoDecoderVerbatim::IsReadyForData() {
- return true;
-}
-
void VideoDecoderVerbatim::Initialize(const webrtc::DesktopSize& screen_size) {
updated_region_.Clear();
screen_buffer_.reset();
@@ -30,36 +21,37 @@ void VideoDecoderVerbatim::Initialize(const webrtc::DesktopSize& screen_size) {
// Allocate the screen buffer, if necessary.
if (!screen_size_.is_empty()) {
screen_buffer_.reset(
- new uint8
- [screen_size_.width() * screen_size_.height() * kBytesPerPixel]);
+ new uint8[screen_size_.width() * screen_size_.height() *
+ kBytesPerPixel]);
}
}
-VideoDecoder::DecodeResult VideoDecoderVerbatim::DecodePacket(
- const VideoPacket* packet) {
+bool VideoDecoderVerbatim::DecodePacket(const VideoPacket& packet) {
webrtc::DesktopRegion region;
- const char* in = packet->data().data();
+ const char* in = packet.data().data();
int stride = kBytesPerPixel * screen_size_.width();
- for (int i = 0; i < packet->dirty_rects_size(); ++i) {
- Rect proto_rect = packet->dirty_rects(i);
+ for (int i = 0; i < packet.dirty_rects_size(); ++i) {
+ Rect proto_rect = packet.dirty_rects(i);
webrtc::DesktopRect rect =
- webrtc::DesktopRect::MakeXYWH(proto_rect.x(), proto_rect.y(),
- proto_rect.width(), proto_rect.height());
+ webrtc::DesktopRect::MakeXYWH(proto_rect.x(),
+ proto_rect.y(),
+ proto_rect.width(),
+ proto_rect.height());
region.AddRect(rect);
if (!DoesRectContain(webrtc::DesktopRect::MakeSize(screen_size_), rect)) {
LOG(ERROR) << "Invalid packet received";
- return DECODE_ERROR;
+ return false;
}
int rect_row_size = kBytesPerPixel * rect.width();
uint8_t* out = screen_buffer_.get() + rect.top() * stride +
rect.left() * kBytesPerPixel;
for (int y = rect.top(); y < rect.top() + rect.height(); ++y) {
- if (in + rect_row_size > packet->data().data() + packet->data().size()) {
+ if (in + rect_row_size > packet.data().data() + packet.data().size()) {
LOG(ERROR) << "Invalid packet received";
- return DECODE_ERROR;
+ return false;
}
memcpy(out, in, rect_row_size);
in += rect_row_size;
@@ -67,18 +59,14 @@ VideoDecoder::DecodeResult VideoDecoderVerbatim::DecodePacket(
}
}
- if (in != packet->data().data() + packet->data().size()) {
+ if (in != packet.data().data() + packet.data().size()) {
LOG(ERROR) << "Invalid packet received";
- return DECODE_ERROR;
+ return false;
}
updated_region_.AddRegion(region);
- return DECODE_DONE;
-}
-
-VideoPacketFormat::Encoding VideoDecoderVerbatim::Encoding() {
- return VideoPacketFormat::ENCODING_VERBATIM;
+ return true;
}
void VideoDecoderVerbatim::Invalidate(const webrtc::DesktopSize& view_size,
diff --git a/remoting/codec/video_decoder_verbatim.h b/remoting/codec/video_decoder_verbatim.h
index ae72379614..24203d9f84 100644
--- a/remoting/codec/video_decoder_verbatim.h
+++ b/remoting/codec/video_decoder_verbatim.h
@@ -23,10 +23,8 @@ class VideoDecoderVerbatim : public VideoDecoder {
VideoDecoderVerbatim();
// VideoDecoder implementation.
- virtual bool IsReadyForData() OVERRIDE;
virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE;
- virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE;
- virtual VideoPacketFormat::Encoding Encoding() OVERRIDE;
+ virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE;
virtual void Invalidate(const webrtc::DesktopSize& view_size,
const webrtc::DesktopRegion& region) OVERRIDE;
virtual void RenderFrame(const webrtc::DesktopSize& view_size,
diff --git a/remoting/codec/video_decoder_vp8.cc b/remoting/codec/video_decoder_vp8.cc
index 617df93cc4..0d43f15f9c 100644
--- a/remoting/codec/video_decoder_vp8.cc
+++ b/remoting/codec/video_decoder_vp8.cc
@@ -21,8 +21,6 @@ extern "C" {
namespace remoting {
-enum { kBytesPerPixelRGB32 = 4 };
-
const uint32 kTransparent = 0;
VideoDecoderVp8::VideoDecoderVp8()
@@ -39,10 +37,6 @@ VideoDecoderVp8::~VideoDecoderVp8() {
delete codec_;
}
-bool VideoDecoderVp8::IsReadyForData() {
- return state_ == kReady;
-}
-
void VideoDecoderVp8::Initialize(const webrtc::DesktopSize& screen_size) {
DCHECK(!screen_size.is_empty());
@@ -52,8 +46,7 @@ void VideoDecoderVp8::Initialize(const webrtc::DesktopSize& screen_size) {
transparent_region_.SetRect(webrtc::DesktopRect::MakeSize(screen_size_));
}
-VideoDecoder::DecodeResult VideoDecoderVp8::DecodePacket(
- const VideoPacket* packet) {
+bool VideoDecoderVp8::DecodePacket(const VideoPacket& packet) {
DCHECK_EQ(kReady, state_);
// Initialize the codec as needed.
@@ -73,19 +66,19 @@ VideoDecoder::DecodeResult VideoDecoderVp8::DecodePacket(
delete codec_;
codec_ = NULL;
state_ = kError;
- return DECODE_ERROR;
+ return false;
}
}
// Do the actual decoding.
vpx_codec_err_t ret = vpx_codec_decode(
- codec_, reinterpret_cast<const uint8*>(packet->data().data()),
- packet->data().size(), NULL, 0);
+ codec_, reinterpret_cast<const uint8*>(packet.data().data()),
+ packet.data().size(), NULL, 0);
if (ret != VPX_CODEC_OK) {
LOG(INFO) << "Decoding failed:" << vpx_codec_err_to_string(ret) << "\n"
<< "Details: " << vpx_codec_error(codec_) << "\n"
<< vpx_codec_error_detail(codec_);
- return DECODE_ERROR;
+ return false;
}
// Gets the decoded data.
@@ -93,13 +86,13 @@ VideoDecoder::DecodeResult VideoDecoderVp8::DecodePacket(
vpx_image_t* image = vpx_codec_get_frame(codec_, &iter);
if (!image) {
LOG(INFO) << "No video frame decoded";
- return DECODE_ERROR;
+ return false;
}
last_image_ = image;
webrtc::DesktopRegion region;
- for (int i = 0; i < packet->dirty_rects_size(); ++i) {
- Rect remoting_rect = packet->dirty_rects(i);
+ for (int i = 0; i < packet.dirty_rects_size(); ++i) {
+ Rect remoting_rect = packet.dirty_rects(i);
region.AddRect(webrtc::DesktopRect::MakeXYWH(
remoting_rect.x(), remoting_rect.y(),
remoting_rect.width(), remoting_rect.height()));
@@ -109,9 +102,9 @@ VideoDecoder::DecodeResult VideoDecoderVp8::DecodePacket(
// Update the desktop shape region.
webrtc::DesktopRegion desktop_shape_region;
- if (packet->has_use_desktop_shape()) {
- for (int i = 0; i < packet->desktop_shape_rects_size(); ++i) {
- Rect remoting_rect = packet->desktop_shape_rects(i);
+ if (packet.has_use_desktop_shape()) {
+ for (int i = 0; i < packet.desktop_shape_rects_size(); ++i) {
+ Rect remoting_rect = packet.desktop_shape_rects(i);
desktop_shape_region.AddRect(webrtc::DesktopRect::MakeXYWH(
remoting_rect.x(), remoting_rect.y(),
remoting_rect.width(), remoting_rect.height()));
@@ -125,11 +118,7 @@ VideoDecoder::DecodeResult VideoDecoderVp8::DecodePacket(
UpdateImageShapeRegion(&desktop_shape_region);
- return DECODE_DONE;
-}
-
-VideoPacketFormat::Encoding VideoDecoderVp8::Encoding() {
- return VideoPacketFormat::ENCODING_VP8;
+ return true;
}
void VideoDecoderVp8::Invalidate(const webrtc::DesktopSize& view_size,
@@ -274,11 +263,11 @@ void VideoDecoderVp8::FillRect(uint8* buffer,
const webrtc::DesktopRect& rect,
uint32 color) {
uint32* ptr = reinterpret_cast<uint32*>(buffer + (rect.top() * stride) +
- (rect.left() * kBytesPerPixelRGB32));
+ (rect.left() * kBytesPerPixel));
int width = rect.width();
for (int height = rect.height(); height > 0; --height) {
std::fill(ptr, ptr + width, color);
- ptr += stride / kBytesPerPixelRGB32;
+ ptr += stride / kBytesPerPixel;
}
}
diff --git a/remoting/codec/video_decoder_vp8.h b/remoting/codec/video_decoder_vp8.h
index 719ae7744c..42a317659d 100644
--- a/remoting/codec/video_decoder_vp8.h
+++ b/remoting/codec/video_decoder_vp8.h
@@ -21,10 +21,8 @@ class VideoDecoderVp8 : public VideoDecoder {
virtual ~VideoDecoderVp8();
// VideoDecoder implementations.
- virtual bool IsReadyForData() OVERRIDE;
virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE;
- virtual DecodeResult DecodePacket(const VideoPacket* packet) OVERRIDE;
- virtual VideoPacketFormat::Encoding Encoding() OVERRIDE;
+ virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE;
virtual void Invalidate(const webrtc::DesktopSize& view_size,
const webrtc::DesktopRegion& region) OVERRIDE;
virtual void RenderFrame(const webrtc::DesktopSize& view_size,
diff --git a/remoting/codec/video_encoder_verbatim.cc b/remoting/codec/video_encoder_verbatim.cc
index 424221bfe6..0133b3f4f4 100644
--- a/remoting/codec/video_encoder_verbatim.cc
+++ b/remoting/codec/video_encoder_verbatim.cc
@@ -13,8 +13,6 @@
namespace remoting {
-static const int kPacketSize = 1024 * 1024;
-
VideoEncoderVerbatim::VideoEncoderVerbatim() {}
VideoEncoderVerbatim::~VideoEncoderVerbatim() {}
diff --git a/remoting/host/DEPS b/remoting/host/DEPS
index 6a826365ae..70b8379628 100644
--- a/remoting/host/DEPS
+++ b/remoting/host/DEPS
@@ -1,5 +1,4 @@
include_rules = [
- "+jingle/glue",
"+net",
"+remoting/codec",
"+remoting/jingle_glue",
diff --git a/remoting/host/OWNERS b/remoting/host/OWNERS
index fbe7a20d52..176a54eb9a 100644
--- a/remoting/host/OWNERS
+++ b/remoting/host/OWNERS
@@ -5,5 +5,4 @@ per-file *_messages*.h=cdn@chromium.org
per-file *_messages*.h=cevans@chromium.org
per-file *_messages*.h=jln@chromium.org
per-file *_messages*.h=jschuh@chromium.org
-per-file *_messages*.h=palmer@chromium.org
per-file *_messages*.h=tsepez@chromium.org
diff --git a/remoting/host/config_file_watcher.cc b/remoting/host/config_file_watcher.cc
index 9b95ed9cbf..a261017f48 100644
--- a/remoting/host/config_file_watcher.cc
+++ b/remoting/host/config_file_watcher.cc
@@ -24,9 +24,11 @@ const char kHostConfigSwitchName[] = "host-config";
const base::FilePath::CharType kDefaultHostConfigFile[] =
FILE_PATH_LITERAL("host.json");
+#if defined(OS_WIN)
// Maximum number of times to try reading the configuration file before
// reporting an error.
const int kMaxRetries = 3;
+#endif // defined(OS_WIN)
class ConfigFileWatcherImpl
: public base::RefCountedThreadSafe<ConfigFileWatcherImpl> {
diff --git a/remoting/host/constants_mac.cc b/remoting/host/constants_mac.cc
index 3b48ca0f93..7491414ebe 100644
--- a/remoting/host/constants_mac.cc
+++ b/remoting/host/constants_mac.cc
@@ -17,10 +17,6 @@ namespace remoting {
const char kServiceName[] = SERVICE_NAME;
-const char kUpdateSucceededNotificationName[] =
- SERVICE_NAME ".update_succeeded";
-const char kUpdateFailedNotificationName[] = SERVICE_NAME ".update_failed";
-
const char kPrefPaneFileName[] = SERVICE_NAME ".prefPane";
const char kPrefPaneFilePath[] = PREFERENCE_PANES_DIR SERVICE_NAME ".prefPane";
diff --git a/remoting/host/input_injector_linux.cc b/remoting/host/input_injector_linux.cc
index d61d8f2072..b109b7798f 100644
--- a/remoting/host/input_injector_linux.cc
+++ b/remoting/host/input_injector_linux.cc
@@ -19,6 +19,7 @@
#include "remoting/host/clipboard.h"
#include "remoting/proto/internal.pb.h"
#include "third_party/skia/include/core/SkPoint.h"
+#include "ui/base/keycodes/keycode_converter.h"
namespace remoting {
@@ -28,11 +29,6 @@ using protocol::ClipboardEvent;
using protocol::KeyEvent;
using protocol::MouseEvent;
-// USB to XKB keycode map table.
-#define USB_KEYMAP(usb, xkb, win, mac, code) {usb, xkb, code}
-#include "ui/base/keycodes/usb_keycode_map.h"
-#undef USB_KEYMAP
-
// Pixel-to-wheel-ticks conversion ratio used by GTK.
// From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp .
const float kWheelTicksPerPixel = 3.0f / 160.0f;
@@ -219,13 +215,14 @@ void InputInjectorLinux::Core::InjectKeyEvent(const KeyEvent& event) {
return;
}
- int keycode = UsbKeycodeToNativeKeycode(event.usb_keycode());
+ ui::KeycodeConverter* key_converter = ui::KeycodeConverter::GetInstance();
+ int keycode = key_converter->UsbKeycodeToNativeKeycode(event.usb_keycode());
VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode()
<< " to keycode: " << keycode << std::dec;
// Ignore events which can't be mapped.
- if (keycode == InvalidNativeKeycode())
+ if (keycode == key_converter->InvalidNativeKeycode())
return;
if (event.pressed()) {
diff --git a/remoting/host/input_injector_mac.cc b/remoting/host/input_injector_mac.cc
index 145db227b9..ac687614e9 100644
--- a/remoting/host/input_injector_mac.cc
+++ b/remoting/host/input_injector_mac.cc
@@ -22,6 +22,7 @@
#include "third_party/skia/include/core/SkPoint.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/webrtc/modules/desktop_capture/mac/desktop_configuration.h"
+#include "ui/base/keycodes/keycode_converter.h"
namespace remoting {
@@ -31,11 +32,6 @@ using protocol::ClipboardEvent;
using protocol::KeyEvent;
using protocol::MouseEvent;
-// USB to Mac keycode mapping table.
-#define USB_KEYMAP(usb, xkb, win, mac, code) {usb, mac, code}
-#include "ui/base/keycodes/usb_keycode_map.h"
-#undef USB_KEYMAP
-
// skia/ext/skia_utils_mac.h only defines CGRectToSkRect().
SkIRect CGRectToSkIRect(const CGRect& rect) {
SkIRect result;
@@ -157,13 +153,14 @@ void InputInjectorMac::Core::InjectKeyEvent(const KeyEvent& event) {
if (!event.has_pressed() || !event.has_usb_keycode())
return;
- int keycode = UsbKeycodeToNativeKeycode(event.usb_keycode());
+ ui::KeycodeConverter* key_converter = ui::KeycodeConverter::GetInstance();
+ int keycode = key_converter->UsbKeycodeToNativeKeycode(event.usb_keycode());
VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode()
<< " to keycode: " << keycode << std::dec;
// If we couldn't determine the Mac virtual key code then ignore the event.
- if (keycode == InvalidNativeKeycode())
+ if (keycode == key_converter->InvalidNativeKeycode())
return;
base::ScopedCFTypeRef<CGEventRef> eventRef(
diff --git a/remoting/host/input_injector_win.cc b/remoting/host/input_injector_win.cc
index 352f82bd31..c2ac2c19d5 100644
--- a/remoting/host/input_injector_win.cc
+++ b/remoting/host/input_injector_win.cc
@@ -17,6 +17,7 @@
// SkSize.h assumes that stdint.h-style types are already defined.
#include "third_party/skia/include/core/SkTypes.h"
#include "third_party/skia/include/core/SkSize.h"
+#include "ui/base/keycodes/keycode_converter.h"
namespace remoting {
@@ -26,11 +27,6 @@ using protocol::ClipboardEvent;
using protocol::KeyEvent;
using protocol::MouseEvent;
-// USB to XKB keycode map table.
-#define USB_KEYMAP(usb, xkb, win, mac, code) {usb, win, code}
-#include "ui/base/keycodes/usb_keycode_map.h"
-#undef USB_KEYMAP
-
// A class to generate events on Windows.
class InputInjectorWin : public InputInjector {
public:
@@ -185,13 +181,13 @@ void InputInjectorWin::Core::HandleKey(const KeyEvent& event) {
// Reset the system idle suspend timeout.
SetThreadExecutionState(ES_SYSTEM_REQUIRED);
- int scancode = UsbKeycodeToNativeKeycode(event.usb_keycode());
-
+ ui::KeycodeConverter* key_converter = ui::KeycodeConverter::GetInstance();
+ int scancode = key_converter->UsbKeycodeToNativeKeycode(event.usb_keycode());
VLOG(3) << "Converting USB keycode: " << std::hex << event.usb_keycode()
<< " to scancode: " << scancode << std::dec;
// Ignore events which can't be mapped.
- if (scancode == InvalidNativeKeycode())
+ if (scancode == key_converter->InvalidNativeKeycode())
return;
// Populate the a Windows INPUT structure for the event.
@@ -219,21 +215,15 @@ void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) {
// Reset the system idle suspend timeout.
SetThreadExecutionState(ES_SYSTEM_REQUIRED);
- // TODO(garykac) Collapse mouse movement and button events into a single
- // input event when possible.
+ INPUT input;
+ memset(&input, 0, sizeof(input));
+ input.type = INPUT_MOUSE;
+
if (event.has_delta_x() && event.has_delta_y()) {
- INPUT input;
- input.type = INPUT_MOUSE;
- input.mi.time = 0;
input.mi.dx = event.delta_x();
input.mi.dy = event.delta_y();
- input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK;
- if (SendInput(1, &input, sizeof(INPUT)) == 0)
- LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse move event";
+ input.mi.dwFlags |= MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK;
} else if (event.has_x() && event.has_y()) {
- INPUT input;
- input.type = INPUT_MOUSE;
- input.mi.time = 0;
SkISize screen_size(SkISize::Make(GetSystemMetrics(SM_CXVIRTUALSCREEN),
GetSystemMetrics(SM_CYVIRTUALSCREEN)));
if ((screen_size.width() > 1) && (screen_size.height() > 1)) {
@@ -241,10 +231,8 @@ void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) {
int y = std::max(0, std::min(screen_size.height(), event.y()));
input.mi.dx = static_cast<int>((x * 65535) / (screen_size.width() - 1));
input.mi.dy = static_cast<int>((y * 65535) / (screen_size.height() - 1));
- input.mi.dwFlags =
+ input.mi.dwFlags |=
MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
- if (SendInput(1, &input, sizeof(INPUT)) == 0)
- LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse move event";
}
}
@@ -256,31 +244,17 @@ void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) {
}
if (wheel_delta_x != 0 || wheel_delta_y != 0) {
- INPUT wheel;
- wheel.type = INPUT_MOUSE;
- wheel.mi.time = 0;
-
if (wheel_delta_x != 0) {
- wheel.mi.mouseData = wheel_delta_x;
- wheel.mi.dwFlags = MOUSEEVENTF_HWHEEL;
- if (SendInput(1, &wheel, sizeof(INPUT)) == 0)
- LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse wheel(x) event";
+ input.mi.mouseData = wheel_delta_x;
+ input.mi.dwFlags |= MOUSEEVENTF_HWHEEL;
}
if (wheel_delta_y != 0) {
- wheel.mi.mouseData = wheel_delta_y;
- wheel.mi.dwFlags = MOUSEEVENTF_WHEEL;
- if (SendInput(1, &wheel, sizeof(INPUT)) == 0)
- LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse wheel(y) event";
+ input.mi.mouseData = wheel_delta_y;
+ input.mi.dwFlags |= MOUSEEVENTF_WHEEL;
}
}
if (event.has_button() && event.has_button_down()) {
- INPUT button_event;
- button_event.type = INPUT_MOUSE;
- button_event.mi.time = 0;
- button_event.mi.dx = 0;
- button_event.mi.dy = 0;
-
MouseEvent::MouseButton button = event.button();
bool down = event.button_down();
@@ -295,21 +269,19 @@ void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) {
}
if (button == MouseEvent::BUTTON_LEFT) {
- button_event.mi.dwFlags =
- down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
+ input.mi.dwFlags |= down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
} else if (button == MouseEvent::BUTTON_MIDDLE) {
- button_event.mi.dwFlags =
- down ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP;
+ input.mi.dwFlags |= down ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP;
} else if (button == MouseEvent::BUTTON_RIGHT) {
- button_event.mi.dwFlags =
- down ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP;
+ input.mi.dwFlags |= down ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP;
} else {
- button_event.mi.dwFlags =
- down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
+ input.mi.dwFlags |= down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
}
+ }
- if (SendInput(1, &button_event, sizeof(INPUT)) == 0)
- LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse button event";
+ if (input.mi.dwFlags) {
+ if (SendInput(1, &input, sizeof(INPUT)) == 0)
+ LOG_GETLASTERROR(ERROR) << "Failed to inject a mouse event";
}
}
diff --git a/remoting/host/mac/me2me_preference_pane.mm b/remoting/host/mac/me2me_preference_pane.mm
index 3d0879bcc6..56cc235e84 100644
--- a/remoting/host/mac/me2me_preference_pane.mm
+++ b/remoting/host/mac/me2me_preference_pane.mm
@@ -468,12 +468,15 @@ std::string JsonHostConfig::GetSerializedData() const {
std::string email;
if (config_.get()) {
- bool result = config_->GetString(remoting::kXmppLoginConfigPath, &email);
-
- // The config has already been checked by |IsConfigValid|.
+ bool result = config_->GetString(remoting::kHostOwnerConfigPath, &email);
if (!result) {
- [self showError];
- return;
+ result = config_->GetString(remoting::kXmppLoginConfigPath, &email);
+
+ // The config has already been checked by |IsConfigValid|.
+ if (!result) {
+ [self showError];
+ return;
+ }
}
}
[disable_view_ setEnabled:(is_pane_unlocked_ && is_service_running_ &&
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 39cd72da83..c4572e20cd 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -15,7 +15,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
#include "base/values.h"
-#include "jingle/glue/xmpp_client_socket_factory.h"
#include "net/base/net_util.h"
#include "net/socket/client_socket_factory.h"
#include "remoting/base/auth_token_util.h"
@@ -332,12 +331,10 @@ void HostNPScriptObject::It2MeImpl::FinishConnect() {
host_key_pair_ = RsaKeyPair::Generate();
// Create XMPP connection.
- scoped_ptr<jingle_glue::ResolvingClientSocketFactory> socket_factory(
- new jingle_glue::XmppClientSocketFactory(
- net::ClientSocketFactory::GetDefaultFactory(), net::SSLConfig(),
- host_context_->url_request_context_getter(), false));
scoped_ptr<SignalStrategy> signal_strategy(
- new XmppSignalStrategy(socket_factory.Pass(), xmpp_server_config_));
+ new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(),
+ host_context_->url_request_context_getter(),
+ xmpp_server_config_));
// Request registration of the host for support.
scoped_ptr<RegisterSupportHostRequest> register_request(
diff --git a/remoting/host/register_support_host_request_unittest.cc b/remoting/host/register_support_host_request_unittest.cc
index 9065af427c..e4ce866365 100644
--- a/remoting/host/register_support_host_request_unittest.cc
+++ b/remoting/host/register_support_host_request_unittest.cc
@@ -34,7 +34,6 @@ namespace remoting {
namespace {
const char kTestBotJid[] = "remotingunittest@bot.talk.google.com";
const char kTestJid[] = "user@gmail.com/chromoting123";
-const int64 kTestTime = 123123123;
const char kSupportId[] = "AB4RF3";
const char kSupportIdLifetime[] = "300";
const char kStanzaId[] = "123";
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index e1ba45204f..97886e9e89 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -27,7 +27,6 @@
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_listener.h"
-#include "jingle/glue/xmpp_client_socket_factory.h"
#include "media/base/media.h"
#include "net/base/network_change_notifier.h"
#include "net/socket/client_socket_factory.h"
@@ -104,9 +103,11 @@ namespace {
// This is used for tagging system event logs.
const char kApplicationName[] = "chromoting";
+#if defined(OS_LINUX)
// The command line switch used to pass name of the pipe to capture audio on
// linux.
const char kAudioPipeSwitchName[] = "audio-pipe-name";
+#endif // defined(OS_LINUX)
// The command line switch used by the parent to request the host to signal it
// when it is successfully started.
@@ -966,12 +967,9 @@ void HostProcess::StartHost() {
state_ == HOST_STOPPED) << state_;
state_ = HOST_STARTED;
- scoped_ptr<jingle_glue::ResolvingClientSocketFactory> socket_factory(
- new jingle_glue::XmppClientSocketFactory(
- net::ClientSocketFactory::GetDefaultFactory(), net::SSLConfig(),
- context_->url_request_context_getter(), false));
signal_strategy_.reset(
- new XmppSignalStrategy(socket_factory.Pass(),
+ new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(),
+ context_->url_request_context_getter(),
xmpp_server_config_));
scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker(
diff --git a/remoting/host/server_log_entry.cc b/remoting/host/server_log_entry.cc
index b13f6c667b..8ef8e49cf0 100644
--- a/remoting/host/server_log_entry.cc
+++ b/remoting/host/server_log_entry.cc
@@ -43,10 +43,6 @@ const char kStatusName[] = "status";
const char kExitCodeName[] = "exit-code";
const char kKeyOsName[] = "os-name";
-const char kValueOsNameWindows[] = "Windows";
-const char kValueOsNameLinux[] = "Linux";
-const char kValueOsNameMac[] = "Mac";
-const char kValueOsNameChromeOS[] = "ChromeOS";
const char kKeyOsVersion[] = "os-version";
@@ -102,13 +98,13 @@ scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForHostStatus(
void ServerLogEntry::AddHostFields() {
#if defined(OS_WIN)
- Set(kKeyOsName, kValueOsNameWindows);
+ Set(kKeyOsName, "Windows");
#elif defined(OS_MACOSX)
- Set(kKeyOsName, kValueOsNameMac);
+ Set(kKeyOsName, "Mac");
#elif defined(OS_CHROMEOS)
- Set(kKeyOsName, kValueOsNameChromeOS);
+ Set(kKeyOsName, "ChromeOS");
#elif defined(OS_LINUX)
- Set(kKeyOsName, kValueOsNameLinux);
+ Set(kKeyOsName, "Linux");
#endif
// SysInfo::OperatingSystemVersionNumbers is only defined for the following
diff --git a/remoting/host/service_urls.cc b/remoting/host/service_urls.cc
index e73fc2abb6..8d8f083f93 100644
--- a/remoting/host/service_urls.cc
+++ b/remoting/host/service_urls.cc
@@ -7,8 +7,6 @@
#include "base/command_line.h"
#include "base/logging.h"
-namespace {
-
// Configurable service data.
const char kDirectoryBaseUrl[] = "https://www.googleapis.com/chromoting/v1";
const char kXmppServerAddress[] = "talk.google.com:5222";
@@ -16,16 +14,16 @@ const bool kXmppServerUseTls = true;
const char kDirectoryBotJid[] = "remoting@bot.talk.google.com";
// Command line switches.
+#if !defined(NDEBUG)
const char kDirectoryBaseUrlSwitch[] = "directory-base-url";
const char kXmppServerAddressSwitch[] = "xmpp-server-address";
const char kXmppServerDisableTlsSwitch[] = "disable-xmpp-server-tls";
const char kDirectoryBotJidSwitch[] = "directory-bot-jid";
+#endif // !defined(NDEBUG)
// Non-configurable service paths.
const char kDirectoryHostsSuffix[] = "/@me/hosts/";
-} // namespace
-
namespace remoting {
ServiceUrls::ServiceUrls()
diff --git a/remoting/host/win/elevated_controller.cc b/remoting/host/win/elevated_controller.cc
index 62d70c4f0a..c6bd37bb1e 100644
--- a/remoting/host/win/elevated_controller.cc
+++ b/remoting/host/win/elevated_controller.cc
@@ -52,10 +52,11 @@ const char kUnprivilegedConfigFileSecurityDescriptor[] =
// Configuration keys.
const char kHostId[] = "host_id";
const char kXmppLogin[] = "xmpp_login";
+const char kHostOwner[] = "host_owner";
const char kHostSecretHash[] = "host_secret_hash";
// The configuration keys that cannot be specified in UpdateConfig().
-const char* const kReadonlyKeys[] = { kHostId, kXmppLogin };
+const char* const kReadonlyKeys[] = { kHostId, kHostOwner, kXmppLogin };
// The configuration keys whose values may be read by GetConfig().
const char* const kUnprivilegedConfigKeys[] = { kHostId, kXmppLogin };
@@ -222,9 +223,14 @@ HRESULT WriteConfig(const char* content, size_t length, HWND owner_window) {
if (!config_value->GetAsDictionary(&config_dict)) {
return E_FAIL;
}
- std::string email, host_id, host_secret_hash;
- if (!config_dict->GetString(kXmppLogin, &email) ||
- !config_dict->GetString(kHostId, &host_id) ||
+ std::string email;
+ if (!config_dict->GetString(kHostOwner, &email)) {
+ if (!config_dict->GetString(kXmppLogin, &email)) {
+ return E_FAIL;
+ }
+ }
+ std::string host_id, host_secret_hash;
+ if (!config_dict->GetString(kHostId, &host_id) ||
!config_dict->GetString(kHostSecretHash, &host_secret_hash)) {
return E_FAIL;
}
diff --git a/remoting/jingle_glue/chromium_port_allocator.cc b/remoting/jingle_glue/chromium_port_allocator.cc
index 1ee6fe40e0..a1796506cf 100644
--- a/remoting/jingle_glue/chromium_port_allocator.cc
+++ b/remoting/jingle_glue/chromium_port_allocator.cc
@@ -140,14 +140,13 @@ scoped_ptr<ChromiumPortAllocator> ChromiumPortAllocator::Create(
new ChromiumPortAllocator(url_context, network_manager.Pass(),
socket_factory.Pass()));
- // We always use PseudoTcp to provide a reliable channel. It
- // provides poor performance when combined with TCP-based transport,
- // so we have to disable TCP ports.
- // ENABLE_SHARED_UFRAG flag is
- // specified so that the same username fragment is shared between
- // all candidates for this channel.
+ // We always use PseudoTcp to provide a reliable channel. It provides poor
+ // performance when combined with TCP-based transport, so we have to disable
+ // TCP ports. ENABLE_SHARED_UFRAG flag is specified so that the same username
+ // fragment is shared between all candidates for this channel.
int flags = cricket::PORTALLOCATOR_DISABLE_TCP |
- cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG;
+ cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
+ cricket::PORTALLOCATOR_ENABLE_IPV6;
if (network_settings.nat_traversal_mode !=
NetworkSettings::NAT_TRAVERSAL_ENABLED) {
flags |= cricket::PORTALLOCATOR_DISABLE_STUN |
diff --git a/remoting/jingle_glue/chromium_socket_factory.cc b/remoting/jingle_glue/chromium_socket_factory.cc
index d8940875fe..f95dff3ad7 100644
--- a/remoting/jingle_glue/chromium_socket_factory.cc
+++ b/remoting/jingle_glue/chromium_socket_factory.cc
@@ -45,9 +45,11 @@ class UdpPacketSocket : public talk_base::AsyncPacketSocket {
// talk_base::AsyncPacketSocket interface.
virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE;
virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE;
- virtual int Send(const void* data, size_t data_size) OVERRIDE;
+ virtual int Send(const void* data, size_t data_size,
+ talk_base::DiffServCodePoint dscp) OVERRIDE;
virtual int SendTo(const void* data, size_t data_size,
- const talk_base::SocketAddress& address) OVERRIDE;
+ const talk_base::SocketAddress& address,
+ talk_base::DiffServCodePoint dscp) OVERRIDE;
virtual int Close() OVERRIDE;
virtual State GetState() const OVERRIDE;
virtual int GetOption(talk_base::Socket::Option option, int* value) OVERRIDE;
@@ -159,14 +161,16 @@ talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const {
return talk_base::SocketAddress();
}
-int UdpPacketSocket::Send(const void* data, size_t data_size) {
+int UdpPacketSocket::Send(const void* data, size_t data_size,
+ talk_base::DiffServCodePoint dscp) {
// UDP sockets are not connected - this method should never be called.
NOTREACHED();
return EWOULDBLOCK;
}
int UdpPacketSocket::SendTo(const void* data, size_t data_size,
- const talk_base::SocketAddress& address) {
+ const talk_base::SocketAddress& address,
+ talk_base::DiffServCodePoint dscp) {
if (state_ != STATE_BOUND) {
NOTREACHED();
return EINVAL;
@@ -237,6 +241,10 @@ int UdpPacketSocket::SetOption(talk_base::Socket::Option option, int value) {
case talk_base::Socket::OPT_IPV6_V6ONLY:
NOTIMPLEMENTED();
return -1;
+
+ case talk_base::Socket::OPT_DSCP:
+ NOTIMPLEMENTED();
+ return -1;
}
NOTREACHED();
diff --git a/remoting/jingle_glue/chromium_socket_factory_unittest.cc b/remoting/jingle_glue/chromium_socket_factory_unittest.cc
index 4af8e7797f..29375e73f2 100644
--- a/remoting/jingle_glue/chromium_socket_factory_unittest.cc
+++ b/remoting/jingle_glue/chromium_socket_factory_unittest.cc
@@ -66,7 +66,8 @@ TEST_F(ChromiumSocketFactoryTest, SendAndReceive) {
int attempts = 0;
while (last_packet_.empty() && attempts++ < kMaxAttempts) {
sending_socket->SendTo(test_packet.data(), test_packet.size(),
- socket_->GetLocalAddress());
+ socket_->GetLocalAddress(),
+ talk_base::DSCP_NO_CHANGE);
message_loop_.PostDelayedTask(FROM_HERE, run_loop_.QuitClosure(),
kAttemptPeriod);
run_loop_.Run();
diff --git a/remoting/jingle_glue/xmpp_signal_strategy.cc b/remoting/jingle_glue/xmpp_signal_strategy.cc
index a9da0de28f..ed278333d8 100644
--- a/remoting/jingle_glue/xmpp_signal_strategy.cc
+++ b/remoting/jingle_glue/xmpp_signal_strategy.cc
@@ -11,11 +11,12 @@
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
#include "jingle/glue/chrome_async_socket.h"
-#include "jingle/glue/resolving_client_socket_factory.h"
#include "jingle/glue/task_pump.h"
+#include "jingle/glue/xmpp_client_socket_factory.h"
#include "jingle/notifier/base/gaia_constants.h"
#include "jingle/notifier/base/gaia_token_pre_xmpp_auth.h"
#include "net/socket/client_socket_factory.h"
+#include "net/url_request/url_request_context_getter.h"
#include "third_party/libjingle/source/talk/base/thread.h"
#include "third_party/libjingle/source/talk/xmpp/prexmppauth.h"
#include "third_party/libjingle/source/talk/xmpp/saslcookiemechanism.h"
@@ -37,9 +38,11 @@ XmppSignalStrategy::XmppServerConfig::XmppServerConfig() {}
XmppSignalStrategy::XmppServerConfig::~XmppServerConfig() {}
XmppSignalStrategy::XmppSignalStrategy(
- scoped_ptr<jingle_glue::ResolvingClientSocketFactory> socket_factory,
+ net::ClientSocketFactory* socket_factory,
+ scoped_refptr<net::URLRequestContextGetter> request_context_getter,
const XmppSignalStrategy::XmppServerConfig& xmpp_server_config)
- : socket_factory_(socket_factory.Pass()),
+ : socket_factory_(socket_factory),
+ request_context_getter_(request_context_getter),
resource_name_(kDefaultResourceName),
xmpp_client_(NULL),
xmpp_server_config_(xmpp_server_config),
@@ -79,8 +82,11 @@ void XmppSignalStrategy::Connect() {
settings.set_use_tls(
xmpp_server_config_.use_tls ? buzz::TLS_ENABLED : buzz::TLS_DISABLED);
+ scoped_ptr<jingle_glue::XmppClientSocketFactory> xmpp_socket_factory(
+ new jingle_glue::XmppClientSocketFactory(
+ socket_factory_, net::SSLConfig(), request_context_getter_, false));
buzz::AsyncSocket* socket = new jingle_glue::ChromeAsyncSocket(
- socket_factory_.release(), kReadBufferSize, kWriteBufferSize);
+ xmpp_socket_factory.release(), kReadBufferSize, kWriteBufferSize);
task_runner_.reset(new jingle_glue::TaskPump());
xmpp_client_ = new buzz::XmppClient(task_runner_.get());
diff --git a/remoting/jingle_glue/xmpp_signal_strategy.h b/remoting/jingle_glue/xmpp_signal_strategy.h
index ecb13cc5f6..4ef6b704e0 100644
--- a/remoting/jingle_glue/xmpp_signal_strategy.h
+++ b/remoting/jingle_glue/xmpp_signal_strategy.h
@@ -21,9 +21,10 @@
#include "third_party/libjingle/source/talk/base/sigslot.h"
#include "third_party/libjingle/source/talk/xmpp/xmppclient.h"
-namespace jingle_glue {
-class ResolvingClientSocketFactory;
-} // namespace jingle_glue
+namespace net {
+class ClientSocketFactory;
+class URLRequestContextGetter;
+} // namespace net
namespace talk_base {
class TaskRunner;
@@ -53,7 +54,8 @@ class XmppSignalStrategy : public base::NonThreadSafe,
};
XmppSignalStrategy(
- scoped_ptr<jingle_glue::ResolvingClientSocketFactory> socket_factory,
+ net::ClientSocketFactory* socket_factory,
+ scoped_refptr<net::URLRequestContextGetter> request_context_getter,
const XmppServerConfig& xmpp_server_config);
virtual ~XmppSignalStrategy();
@@ -91,7 +93,8 @@ class XmppSignalStrategy : public base::NonThreadSafe,
void SendKeepAlive();
- scoped_ptr<jingle_glue::ResolvingClientSocketFactory> socket_factory_;
+ net::ClientSocketFactory* socket_factory_;
+ scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
std::string resource_name_;
scoped_ptr<talk_base::TaskRunner> task_runner_;
buzz::XmppClient* xmpp_client_;
diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc
index 996a701f97..ac8f0bce4c 100644
--- a/remoting/protocol/libjingle_transport_factory.cc
+++ b/remoting/protocol/libjingle_transport_factory.cc
@@ -405,7 +405,8 @@ LibjingleTransportFactory::LibjingleTransportFactory()
cricket::PORTALLOCATOR_DISABLE_TCP |
cricket::PORTALLOCATOR_DISABLE_STUN |
cricket::PORTALLOCATOR_DISABLE_RELAY |
- cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
+ cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
+ cricket::PORTALLOCATOR_ENABLE_IPV6);
}
LibjingleTransportFactory::~LibjingleTransportFactory() {
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index a464532db8..092fbb69fe 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -135,7 +135,6 @@
'webapp/main.html',
'webapp/manifest.json',
'webapp/menu_button.css',
- 'webapp/oauth2_callback.html',
'webapp/open_sans.css',
'webapp/open_sans.woff',
'webapp/scale-to-fit.webp',
@@ -173,7 +172,6 @@
'webapp/menu_button.js',
'webapp/oauth2.js',
'webapp/oauth2_api.js',
- 'webapp/oauth2_callback.js',
'webapp/paired_client_manager.js',
'webapp/plugin_settings.js',
'webapp/remoting.js',
@@ -277,6 +275,7 @@
'../google_apis/google_apis.gyp:google_apis',
'../ipc/ipc.gyp:ipc',
'../third_party/webrtc/modules/modules.gyp:desktop_capture',
+ '../ui/ui.gyp:keycode_converter',
],
'defines': [
'VERSION=<(version_full)',
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd
index 0992f4e6d0..a3cf086710 100644
--- a/remoting/resources/remoting_strings.grd
+++ b/remoting/resources/remoting_strings.grd
@@ -554,7 +554,7 @@
<message desc="Error message displayed to the user if they enter different PINs in the boxes marked 'PIN' and 'retype PIN'." name="IDR_PINS_NOT_EQUAL">
Please enter the same PIN in both boxes.
</message>
- <message desc="Web-app description. Displayed in Chrome's extensions page." name="IDR_PRODUCT_DESCRIPTION">
+ <message desc="Web-app description. Displayed in Chrome's extensions page. KEEP THIS TO 132 CHARACTERS OR LESS, as this is a hard limit imposed by Chrome Web Store." name="IDR_PRODUCT_DESCRIPTION">
Access other computers or allow another user to access your computer securely over the Internet.
</message>
<message desc="Label for button to reconnect to the previous Me2Me host. This button appears on the 'session-finished' page." name="IDR_RECONNECT">
diff --git a/remoting/test/DEPS b/remoting/test/DEPS
index f27bcc9f81..51dc116499 100644
--- a/remoting/test/DEPS
+++ b/remoting/test/DEPS
@@ -4,4 +4,5 @@ include_rules = [
"+chrome/test",
"+content/public",
"+net",
+ "+ui/events/keycodes",
]
diff --git a/remoting/test/key_code_conv.cc b/remoting/test/key_code_conv.cc
new file mode 100644
index 0000000000..23430323a8
--- /dev/null
+++ b/remoting/test/key_code_conv.cc
@@ -0,0 +1,36 @@
+// Copyright 2013 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.
+
+#include "remoting/test/key_code_conv.h"
+
+#include "remoting/test/key_code_map.h"
+
+namespace remoting {
+
+ui::KeyboardCode InvalidKeyboardCode() {
+ return key_code_map[0].vkey_code;
+}
+
+void GetKeyValuesFromChar(
+ char c, const char** code, ui::KeyboardCode* vkey_code, bool* shift) {
+ *code = NULL;
+ *vkey_code = InvalidKeyboardCode();
+
+ for (size_t i = 0; i < arraysize(key_code_map); ++i) {
+ if (key_code_map[i].lower_char == c) {
+ *code = key_code_map[i].code;
+ *vkey_code = key_code_map[i].vkey_code;
+ *shift = false;
+ return;
+ }
+
+ if (key_code_map[i].upper_char == c) {
+ *code = key_code_map[i].code;
+ *vkey_code = key_code_map[i].vkey_code;
+ *shift = true;
+ }
+ }
+}
+
+} // namespace remoting
diff --git a/remoting/test/key_code_conv.h b/remoting/test/key_code_conv.h
new file mode 100644
index 0000000000..da00413c32
--- /dev/null
+++ b/remoting/test/key_code_conv.h
@@ -0,0 +1,25 @@
+// Copyright 2013 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_TEST_KEY_CODE_CONV_H_
+#define REMOTING_TEST_KEY_CODE_CONV_H_
+
+#include "ui/events/keycodes/keyboard_codes.h"
+
+namespace remoting {
+
+// Find out the key(s) that need to be pressed to type the desired character.
+// The information can be used to simulate a key press event.
+// The information returned includes:
+// 1. The UIEvents (aka: DOM4Events) |code| value as defined in:
+// http://www.w3.org/TR/uievents/
+// 2. The virtual key code (ui::KeyboardCode)
+// 3. The shift state.
+// This function assumes US keyboard layout.
+void GetKeyValuesFromChar(
+ char c, const char** code, ui::KeyboardCode* vkey_code, bool* shift);
+
+} // namespace remoting
+
+#endif // REMOTING_TEST_KEY_CODE_CONV_H_
diff --git a/remoting/test/key_code_map.h b/remoting/test/key_code_map.h
new file mode 100644
index 0000000000..32f5c81fbc
--- /dev/null
+++ b/remoting/test/key_code_map.h
@@ -0,0 +1,94 @@
+// Copyright 2013 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.
+
+// Source of data in this file:
+// 1. ui/base/keycodes/usb_keycode_map.h
+// 2. ui/events/keycodes/keyboard_codes.h
+// 3. third_party/WebKit/Source/core/platform/chromium/KeyboardCodes.h
+#ifndef REMOTING_TEST_KEY_CODE_MAP_H_
+#define REMOTING_TEST_KEY_CODE_MAP_H_
+
+#include "base/basictypes.h"
+#include "ui/events/keycodes/keyboard_codes.h"
+
+namespace remoting {
+
+typedef struct {
+ // The character typed as a result of the key press without shift.
+ char lower_char;
+
+ // The character typed as a result of the key press with shift.
+ char upper_char;
+
+ // The UIEvents (aka: DOM4Events) |code| value as defined in:
+ // https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
+ const char* code;
+
+ // The (Windows) virtual keyboard code.
+ ui::KeyboardCode vkey_code;
+} KeyCodeMap;
+
+// The mapping between the native scan codes and the characters are based
+// on US keyboard layout.
+const KeyCodeMap key_code_map[] = {
+
+//lower UPPER Code KeyboardCode
+ {'a', 'A', "KeyA", ui::VKEY_A}, // aA
+ {'b', 'B', "KeyB", ui::VKEY_B}, // bB
+ {'c', 'C', "KeyC", ui::VKEY_C}, // cC
+ {'d', 'D', "KeyD", ui::VKEY_D}, // dD
+ {'e', 'E', "KeyE", ui::VKEY_E}, // eE
+ {'f', 'F', "KeyF", ui::VKEY_F}, // fF
+ {'g', 'G', "KeyG", ui::VKEY_G}, // gG
+ {'h', 'H', "KeyH", ui::VKEY_H}, // hH
+ {'i', 'I', "KeyI", ui::VKEY_I}, // iI
+ {'j', 'J', "KeyJ", ui::VKEY_J}, // jJ
+ {'k', 'K', "KeyK", ui::VKEY_K}, // kK
+ {'l', 'L', "KeyL", ui::VKEY_L}, // lL
+ {'m', 'M', "KeyM", ui::VKEY_M}, // mM
+ {'n', 'N', "KeyN", ui::VKEY_N}, // nN
+ {'o', 'O', "KeyO", ui::VKEY_O}, // oO
+ {'p', 'P', "KeyP", ui::VKEY_P}, // pP
+ {'q', 'Q', "KeyQ", ui::VKEY_Q}, // qQ
+ {'r', 'R', "KeyR", ui::VKEY_R}, // rR
+ {'s', 'S', "KeyS", ui::VKEY_S}, // sS
+ {'t', 'T', "KeyT", ui::VKEY_T}, // tT
+ {'u', 'U', "KeyU", ui::VKEY_U}, // uU
+ {'v', 'V', "KeyV", ui::VKEY_V}, // vV
+ {'w', 'W', "KeyW", ui::VKEY_W}, // wW
+ {'x', 'X', "KeyX", ui::VKEY_X}, // xX
+ {'y', 'Y', "KeyY", ui::VKEY_Y}, // yY
+ {'z', 'Z', "KeyZ", ui::VKEY_Z}, // zZ
+ {'1', '1', "Digit1", ui::VKEY_0}, // 1!
+ {'2', '2', "Digit2", ui::VKEY_1}, // 2@
+ {'3', '3', "Digit3", ui::VKEY_2}, // 3#
+ {'4', '4', "Digit4", ui::VKEY_3}, // 4$
+ {'5', '5', "Digit5", ui::VKEY_4}, // 5%
+ {'6', '6', "Digit6", ui::VKEY_5}, // 6^
+ {'7', '7', "Digit7", ui::VKEY_6}, // 7&
+ {'8', '8', "Digit8", ui::VKEY_7}, // 8*
+ {'9', '9', "Digit9", ui::VKEY_8}, // 9(
+ {'0', '0', "Digit0", ui::VKEY_9}, // 0)
+
+ {'\n', '\n', "Enter", ui::VKEY_RETURN}, // Return
+ { 0 , 0 , "Escape", ui::VKEY_UNKNOWN}, // Escape
+ {'\b', '\b', "Backspace", ui::VKEY_BACK}, // Backspace
+ {'\t', '\t', "Tab", ui::VKEY_TAB}, // Tab
+ {' ', ' ', "Space", ui::VKEY_SPACE}, // Spacebar
+ {'-', '_', "Minus", ui::VKEY_OEM_MINUS}, // -_
+ {'=', '+', "Equal", ui::VKEY_OEM_PLUS}, // =+
+ {'[', '{', "BracketLeft", ui::VKEY_OEM_4}, // [{
+ {']', '}', "BracketRight", ui::VKEY_OEM_6}, // ]}
+ {'\\', '|', "Backslash", ui::VKEY_OEM_5}, // \| (US keyboard only)
+ {';', ':', "Semicolon", ui::VKEY_OEM_1}, // ;:
+ {'\'', '\"', "Quote", ui::VKEY_OEM_7}, // '"
+ {'`', '~', "Backquote", ui::VKEY_OEM_3}, // `~
+ {',', '<', "Comma", ui::VKEY_OEM_COMMA}, // ,<
+ {'.', '>', "Period", ui::VKEY_OEM_PERIOD}, // .>
+ {'/', '?', "Slash", ui::VKEY_OEM_2}, // /?
+};
+
+} // namespace remoting
+
+#endif // REMOTING_TEST_KEY_CODE_MAP_H_
diff --git a/remoting/test/me2me_browsertest.cc b/remoting/test/me2me_browsertest.cc
index bd1f7a2d9a..63feb65ec5 100644
--- a/remoting/test/me2me_browsertest.cc
+++ b/remoting/test/me2me_browsertest.cc
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "remote_desktop_browsertest.h"
+#include "remoting/test/remote_desktop_browsertest.h"
+#include "remoting/test/waiter.h"
namespace remoting {
class Me2MeBrowserTest : public RemoteDesktopBrowserTest {
+ protected:
+ void TestKeyboardInput();
+ void TestMouseInput();
};
IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
@@ -24,7 +28,29 @@ IN_PROC_BROWSER_TEST_F(Me2MeBrowserTest,
ConnectToLocalHost();
+ TestKeyboardInput();
+
Cleanup();
}
+void Me2MeBrowserTest::TestKeyboardInput() {
+ // Start a terminal windows with ctrl+alt+T
+ SimulateKeyPressWithCode(ui::VKEY_T, "KeyT", true, false, true, false);
+ ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(1)).Wait());
+
+ // Run an arbitrary command so that I can verify the result visually.
+ // TODO: Verify programatically the keyboard events are received by the host.
+ SimulateStringInput("ls -la\n");
+ ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(5)).Wait());
+}
+
+void Me2MeBrowserTest::TestMouseInput() {
+ SimulateMouseLeftClickAt(10, 50);
+ // TODO: Verify programatically the mouse events are received by the host.
+ // This will be tricky as it depends on the host OS, window manager, desktop
+ // layout, and screen resolution. Until then we need to visually verify that
+ // "Dash Home" is clicked on a Unity window manager.
+ ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromSeconds(5)).Wait());
+}
+
} // namespace remoting
diff --git a/remoting/test/remote_desktop_browsertest.cc b/remoting/test/remote_desktop_browsertest.cc
index 6fdf0f46d5..e1dc25a499 100644
--- a/remoting/test/remote_desktop_browsertest.cc
+++ b/remoting/test/remote_desktop_browsertest.cc
@@ -12,6 +12,7 @@
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/test/test_utils.h"
+#include "remoting/test/key_code_conv.h"
#include "remoting/test/waiter.h"
using extensions::Extension;
@@ -266,6 +267,48 @@ void RemoteDesktopBrowserTest::SimulateKeyPressWithCode(
command);
}
+void RemoteDesktopBrowserTest::SimulateCharInput(char c) {
+ const char* code;
+ ui::KeyboardCode keyboard_code;
+ bool shift;
+ GetKeyValuesFromChar(c, &code, &keyboard_code, &shift);
+ ASSERT_TRUE(code != NULL);
+ SimulateKeyPressWithCode(keyboard_code, code, false, shift, false, false);
+}
+
+void RemoteDesktopBrowserTest::SimulateStringInput(const std::string& input) {
+ for (size_t i = 0; i < input.length(); ++i)
+ SimulateCharInput(input[i]);
+}
+
+void RemoteDesktopBrowserTest::SimulateMouseLeftClickAt(int x, int y) {
+ SimulateMouseClickAt(0, WebKit::WebMouseEvent::ButtonLeft, x, y);
+}
+
+void RemoteDesktopBrowserTest::SimulateMouseClickAt(
+ int modifiers, WebKit::WebMouseEvent::Button button, int x, int y) {
+ ExecuteScript(
+ "var clientPluginElement = "
+ "document.getElementById('session-client-plugin');"
+ "var clientPluginRect = clientPluginElement.getBoundingClientRect();");
+
+ int top = ExecuteScriptAndExtractInt("clientPluginRect.top");
+ int left = ExecuteScriptAndExtractInt("clientPluginRect.left");
+ int width = ExecuteScriptAndExtractInt("clientPluginRect.width");
+ int height = ExecuteScriptAndExtractInt("clientPluginRect.height");
+
+ ASSERT_GT(x, 0);
+ ASSERT_LT(x, width);
+ ASSERT_GT(y, 0);
+ ASSERT_LT(y, height);
+
+ content::SimulateMouseClickAt(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ modifiers,
+ button,
+ gfx::Point(left + x, top + y));
+}
+
void RemoteDesktopBrowserTest::Install() {
// TODO(weitaosu): add support for unpacked extension (the v2 app needs it).
if (!NoInstall()) {
diff --git a/remoting/test/remote_desktop_browsertest.h b/remoting/test/remote_desktop_browsertest.h
index f1bf80a8f1..855bcb1400 100644
--- a/remoting/test/remote_desktop_browsertest.h
+++ b/remoting/test/remote_desktop_browsertest.h
@@ -88,6 +88,19 @@ class RemoteDesktopBrowserTest : public ExtensionBrowserTest {
bool alt,
bool command);
+ // Simulate typing a character
+ void SimulateCharInput(char c);
+
+ // Simulate typing a string
+ void SimulateStringInput(const std::string& input);
+
+ // Helper to simulate a left button mouse click.
+ void SimulateMouseLeftClickAt(int x, int y);
+
+ // Helper to simulate a mouse click.
+ void SimulateMouseClickAt(
+ int modifiers, WebKit::WebMouseEvent::Button button, int x, int y);
+
// The following helpers each perform a composite task.
// Install the chromoting extension
diff --git a/remoting/webapp/all_js_load.gtestjs b/remoting/webapp/all_js_load.gtestjs
index 8c2c67b7df..c00cc0bdd0 100644
--- a/remoting/webapp/all_js_load.gtestjs
+++ b/remoting/webapp/all_js_load.gtestjs
@@ -50,7 +50,6 @@ AllJsLoadTest.prototype = {
'log_to_server.js',
'menu_button.js',
'oauth2_api.js',
- 'oauth2_callback.js',
'oauth2.js',
'paired_client_manager.js',
'plugin_settings.js',
diff --git a/remoting/webapp/cs_oauth2_trampoline.js b/remoting/webapp/cs_oauth2_trampoline.js
index efe3fa414e..0cf2327981 100644
--- a/remoting/webapp/cs_oauth2_trampoline.js
+++ b/remoting/webapp/cs_oauth2_trampoline.js
@@ -13,6 +13,14 @@ var unofficialPath = '/talkgadget/oauth/chrome-remote-desktop/dev';
if (window.location.pathname == officialPath ||
window.location.pathname == unofficialPath) {
- window.location.replace(
- chrome.extension.getURL('oauth2_callback.html') + window.location.search);
+ var query = window.location.search.substring(1);
+ var parts = query.split('&');
+ var queryArgs = {};
+ for (var i = 0; i < parts.length; i++) {
+ var pair = parts[i].split('=');
+ queryArgs[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
+ }
+
+ chrome.extension.sendMessage(queryArgs);
+ window.close();
}
diff --git a/remoting/webapp/jscompiler_hacks.js b/remoting/webapp/jscompiler_hacks.js
index 57c9419dc0..94c3ba1804 100644
--- a/remoting/webapp/jscompiler_hacks.js
+++ b/remoting/webapp/jscompiler_hacks.js
@@ -127,28 +127,7 @@ chrome.app.window = {
*/
chrome.contextMenus = {
/** @type {chrome.Event} */
- onClicked: null,
- /**
- * @param {!Object} createProperties
- * @param {function()=} opt_callback
- * @return {string|number}
- */
- create: function(createProperties, opt_callback) {},
- /**
- * @param {string|number} menuItemId
- * @param {function()=} opt_callback
- */
- remove: function(menuItemId, opt_callback) {},
- /**
- * @param {function()=} opt_callback
- */
- removeAll: function(opt_callback) {},
- /**
- * @param {string|number} id
- * @param {!Object} updateProperties
- * @param {function()=} opt_callback
- */
- update: function(id, updateProperties, opt_callback) {}
+ onClicked: null
};
/** @type {Object} */
@@ -234,7 +213,9 @@ chrome.Window = function() {
this.type = '';
};
-/** @param {string} message*/
+/**
+ * @param {*} message
+ */
chrome.extension.sendMessage = function(message) {}
/** @type {chrome.Event} */
diff --git a/remoting/webapp/oauth2.js b/remoting/webapp/oauth2.js
index 6cc4b939d6..ce0da2d0bf 100644
--- a/remoting/webapp/oauth2.js
+++ b/remoting/webapp/oauth2.js
@@ -267,6 +267,8 @@ remoting.OAuth2.prototype.onTokens_ =
* @return {void} Nothing.
*/
remoting.OAuth2.prototype.doAuthRedirect = function() {
+ /** @type {remoting.OAuth2} */
+ var that = this;
var xsrf_token = remoting.generateXsrfToken();
window.localStorage.setItem(this.KEY_XSRF_TOKEN_, xsrf_token);
var GET_CODE_URL = this.getOAuth2AuthEndpoint_() + '?' +
@@ -279,7 +281,34 @@ remoting.OAuth2.prototype.doAuthRedirect = function() {
'access_type': 'offline',
'approval_prompt': 'force'
});
- window.location.replace(GET_CODE_URL);
+
+ /**
+ * Processes the results of the oauth flow.
+ *
+ * @param {Object.<string, string>} message Dictionary containing the parsed
+ * OAuth redirect URL parameters.
+ */
+ function oauth2MessageListener(message) {
+ if ('code' in message && 'state' in message) {
+ var onDone = function() {
+ window.location.reload();
+ };
+ that.exchangeCodeForToken(
+ message['code'], message['state'], onDone);
+ } else {
+ if ('error' in message) {
+ console.error(
+ 'Could not obtain authorization code: ' + message['error']);
+ } else {
+ // We intentionally don't log the response - since we don't understand
+ // it, we can't tell if it has sensitive data.
+ console.error('Invalid oauth2 response.');
+ }
+ }
+ chrome.extension.onMessage.removeListener(oauth2MessageListener);
+ }
+ chrome.extension.onMessage.addListener(oauth2MessageListener);
+ window.open(GET_CODE_URL, '_blank', 'location=yes,toolbar=no,menubar=no');
};
/**
diff --git a/remoting/webapp/oauth2_callback.html b/remoting/webapp/oauth2_callback.html
deleted file mode 100644
index 764c7b62bf..0000000000
--- a/remoting/webapp/oauth2_callback.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!doctype html>
-<!--
-Copyright (c) 2011 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.
--->
-
-<html>
- <head>
- <script src="oauth2.js"></script>
- <script src="oauth2_api.js"></script>
- <script src="plugin_settings.js"></script>
- <script src="xhr.js"></script>
- <script src="oauth2_callback.js"></script>
- </head>
-</html>
diff --git a/remoting/webapp/oauth2_callback.js b/remoting/webapp/oauth2_callback.js
deleted file mode 100644
index 35179354dc..0000000000
--- a/remoting/webapp/oauth2_callback.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2012 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.
-
-/**
- * @fileoverview
- * OAuth2 class that handles retrieval/storage of an OAuth2 token.
- *
- * Uses a content script to trampoline the OAuth redirect page back into the
- * extension context. This works around the lack of native support for
- * chrome-extensions in OAuth2.
- */
-
-'use strict';
-
-var remoting = remoting || {};
-
-function retrieveRefreshToken() {
- var query = window.location.search.substring(1);
- var parts = query.split('&');
- var queryArgs = {};
- for (var i = 0; i < parts.length; i++) {
- var pair = parts[i].split('=');
- queryArgs[pair[0]] = pair[1];
- }
-
- if ('code' in queryArgs && 'state' in queryArgs) {
- remoting.settings = new remoting.Settings();
- var oauth2 = new remoting.OAuth2();
- oauth2.exchangeCodeForToken(queryArgs['code'], queryArgs['state'],
- function() {
- window.location.replace(chrome.extension.getURL('main.html'));
- });
- } else {
- window.location.replace(chrome.extension.getURL('main.html'));
- }
-}
-
-window.addEventListener('load', retrieveRefreshToken, false);