Skip to content

Commit

Permalink
[remoting android] Add and build host code.
Browse files Browse the repository at this point in the history
BUG=602355

Review URL: https://codereview.chromium.org/1863933002

Cr-Commit-Position: refs/heads/master@{#387103}
  • Loading branch information
lambroslambrou authored and Commit bot committed Apr 13, 2016
1 parent bbf2503 commit 51e19b9
Show file tree
Hide file tree
Showing 22 changed files with 360 additions and 14 deletions.
7 changes: 5 additions & 2 deletions remoting/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ group("remoting_all") {
deps += [
"//remoting:remoting_perftests",
"//remoting/host",
"//remoting/host:remoting_native_messaging_manifests",
]

if (!is_chromeos) {
if (!is_android) {
deps += [ "//remoting/host:remoting_native_messaging_manifests" ]
}

if (!is_chromeos && !is_android) {
deps += [
"//remoting/host:remoting_start_host",
"//remoting/host/it2me:remote_assistance_host",
Expand Down
2 changes: 2 additions & 0 deletions remoting/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ shared_library("remoting_host_jni") {
":jni_headers",
"//google_apis",
"//remoting/base",
"//remoting/host",
"//remoting/protocol",
]
sources = [
Expand Down Expand Up @@ -187,6 +188,7 @@ android_apk("remoting_host_apk") {
":remoting_host_apk_resources",
":remoting_host_jni",
"//base:base_java",
"//net/android:net_java",
"//third_party/android_tools:android_support_v13_java",
"//third_party/android_tools:android_support_v7_appcompat_java",
]
Expand Down
9 changes: 8 additions & 1 deletion remoting/host/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host.
if (enable_webrtc) {
deps += [ "//third_party/webrtc/modules/desktop_capture" ]
}

if (is_android) {
sources -= [
"single_window_desktop_environment.cc",
"single_window_desktop_environment.h",
]
}
}

source_set("test_support") {
Expand Down Expand Up @@ -675,7 +682,7 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host.
# TODO(GYP) More Windows remoting targets from remoting_host_win.gypi
}

if (enable_remoting_host) {
if (enable_remoting_host && !is_android) {
executable("remoting_start_host") {
sources = [
"setup/host_starter.cc",
Expand Down
2 changes: 2 additions & 0 deletions remoting/host/android/remoting_host_jni_onload.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
#include "base/android/jni_registrar.h"
#include "base/bind.h"
#include "base/macros.h"
#include "net/android/net_jni_registrar.h"
#include "remoting/host/android/remoting_host_jni_registrar.h"

namespace {

base::android::RegistrationMethod kRemotingRegisteredMethods[] = {
{"base", base::android::RegisterJni},
{"net", net::android::RegisterJni},
{"remoting_host", remoting::RegisterJni},
};

Expand Down
19 changes: 19 additions & 0 deletions remoting/host/audio_capturer_android.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2016 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 "base/logging.h"
#include "remoting/host/audio_capturer.h"

namespace remoting {

bool AudioCapturer::IsSupported() {
return false;
}

std::unique_ptr<AudioCapturer> AudioCapturer::Create() {
NOTIMPLEMENTED();
return nullptr;
}

} // namespace remoting
38 changes: 38 additions & 0 deletions remoting/host/continue_window_android.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2016 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 "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "remoting/host/continue_window.h"

namespace remoting {

namespace {

class ContinueWindowAndroid : public ContinueWindow {
public:
ContinueWindowAndroid() {}

protected:
// ContinueWindow overrides.
void ShowUi() override {
NOTIMPLEMENTED();
}

void HideUi() override {
NOTIMPLEMENTED();
}

DISALLOW_COPY_AND_ASSIGN(ContinueWindowAndroid);
};

} // namespace

// static
std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
return base::WrapUnique(new ContinueWindowAndroid());
}

} // namespace remoting
38 changes: 38 additions & 0 deletions remoting/host/curtain_mode_android.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2016 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 "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "remoting/host/curtain_mode.h"

namespace remoting {

namespace {

class CurtainModeAndroid : public CurtainMode {
public:
CurtainModeAndroid() {}

// Overriden from CurtainMode.
bool Activate() override {
NOTIMPLEMENTED();
return false;
}

private:
DISALLOW_COPY_AND_ASSIGN(CurtainModeAndroid);
};

} // namespace

// static
std::unique_ptr<CurtainMode> CurtainMode::Create(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control) {
return base::WrapUnique(new CurtainModeAndroid());
}

} // namespace remoting
49 changes: 49 additions & 0 deletions remoting/host/desktop_resizer_android.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2016 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 "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "remoting/host/desktop_resizer.h"

namespace remoting {

namespace {

class DesktopResizerAndroid : public DesktopResizer {
public:
DesktopResizerAndroid() {}

// DesktopResizer:
ScreenResolution GetCurrentResolution() override {
NOTIMPLEMENTED();
return ScreenResolution();
}

std::list<ScreenResolution> GetSupportedResolutions(
const ScreenResolution& preferred) override {
NOTIMPLEMENTED();
return std::list<ScreenResolution>();
}

void SetResolution(const ScreenResolution& resolution) override {
NOTIMPLEMENTED();
}

void RestoreResolution(const ScreenResolution& original) override {
NOTIMPLEMENTED();
}

private:
DISALLOW_COPY_AND_ASSIGN(DesktopResizerAndroid);
};

} // namespace

// static
std::unique_ptr<DesktopResizer> DesktopResizer::Create() {
return base::WrapUnique(new DesktopResizerAndroid);
}

} // namespace remoting
35 changes: 35 additions & 0 deletions remoting/host/disconnect_window_android.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2016 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 "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "remoting/host/host_window.h"

namespace remoting {

namespace {

class DisconnectWindowAndroid : public HostWindow {
public:
DisconnectWindowAndroid() {}

// HostWindow interface.
void Start(const base::WeakPtr<ClientSessionControl>& client_session_control)
override {
NOTIMPLEMENTED();
}

private:
DISALLOW_COPY_AND_ASSIGN(DisconnectWindowAndroid);
};

} // namespace

// static
std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
return base::WrapUnique(new DisconnectWindowAndroid());
}

} // namespace remoting
10 changes: 7 additions & 3 deletions remoting/host/host_details.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ std::string GetHostOperatingSystemName() {
return "ChromeOS";
#elif defined(OS_LINUX)
return "Linux";
#elif defined(OS_ANDROID)
return "Android";
#else
#error "Unsupported host OS"
#endif
}

// Get the host Operating System Version, removing the need to check for OS
// definitions and keeps the format used consistant.
std::string GetHostOperatingSystemVersion() {
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
return base::SysInfo::OperatingSystemVersion();
#elif defined(OS_LINUX)
#if defined(OS_LINUX)
return base::GetLinuxDistro();
#else
return base::SysInfo::OperatingSystemVersion();
#endif
}

Expand Down
57 changes: 57 additions & 0 deletions remoting/host/input_injector_android.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2016 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 "base/memory/ptr_util.h"
#include "remoting/host/input_injector.h"

namespace remoting {

namespace {

class InputInjectorAndroid : public InputInjector {
public:
InputInjectorAndroid() {}

void InjectClipboardEvent(const protocol::ClipboardEvent& event) override {
NOTIMPLEMENTED();
}

void InjectKeyEvent(const protocol::KeyEvent& event) override {
NOTIMPLEMENTED();
}

void InjectTextEvent(const protocol::TextEvent& event) override {
NOTIMPLEMENTED();
}

void InjectMouseEvent(const protocol::MouseEvent& event) override {
NOTIMPLEMENTED();
}

void InjectTouchEvent(const protocol::TouchEvent& event) override {
NOTIMPLEMENTED();
}

void Start(
std::unique_ptr<protocol::ClipboardStub> client_clipboard) override {}

private:
DISALLOW_COPY_AND_ASSIGN(InputInjectorAndroid);
};

} // namespace

// static
std::unique_ptr<InputInjector> InputInjector::Create(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
return base::WrapUnique(new InputInjectorAndroid());
}

// static
bool InputInjector::SupportsTouchEvents() {
return false;
}

} // namespace remoting
2 changes: 1 addition & 1 deletion remoting/host/it2me/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ source_set("common") {
]
}

if (!is_chromeos && enable_remoting_host) {
if (!is_chromeos && !is_android && enable_remoting_host) {
if (is_win) {
# GYP version:
# //remoting/remoting_host_win.gypi:remoting_it2me_native_messaging_host
Expand Down
30 changes: 30 additions & 0 deletions remoting/host/local_input_monitor_android.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2016 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 "base/memory/ptr_util.h"
#include "remoting/host/local_input_monitor.h"

namespace remoting {

namespace {

class LocalInputMonitorAndroid : public LocalInputMonitor {
public:
LocalInputMonitorAndroid() {}

private:
DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorAndroid);
};

} // namespace

std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
base::WeakPtr<ClientSessionControl> client_session_control) {
return base::WrapUnique(new LocalInputMonitorAndroid());
}

} // namespace remoting
4 changes: 2 additions & 2 deletions remoting/host/me2me_desktop_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ bool Me2MeDesktopEnvironment::InitializeSecurity(
// running in the LoginWindow context, and refactor this into a separate
// function to be used here and in CurtainMode::ActivateCurtain().
bool want_user_interface = getuid() != 0;
#elif defined(OS_WIN)
#else
bool want_user_interface = true;
#endif // defined(OS_WIN)
#endif

// Create the disconnect window.
if (want_user_interface) {
Expand Down
Loading

0 comments on commit 51e19b9

Please sign in to comment.