summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorkelvinp <kelvinp@chromium.org>2014-10-30 14:46:16 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-30 21:46:48 +0000
commit561074cfd46c253dcdc456fdc63693aff4d1be32 (patch)
treea943021c67127b2abfbd5bcc73c4f93e143e9514 /chrome/browser
parentd5587416cd28f2449ec86fa2f23e0f1de04878cc (diff)
downloadchromium_src-561074cfd46c253dcdc456fdc63693aff4d1be32.zip
chromium_src-561074cfd46c253dcdc456fdc63693aff4d1be32.tar.gz
chromium_src-561074cfd46c253dcdc456fdc63693aff4d1be32.tar.bz2
Remote assistance on Chrome OS Part IV - It2MeHost
This CL links the it2me host to the Chrome binary on ChromeOS behind a flag. The following changes are made to the it2me host so that it can be run in the browser process. 1. Initializes SSL server sockets and specific CPU media features on ChromeOS startup. 2. Fixes a crash in it2me shutdown by making It2meHost owns the ChromotingHostContext. 3. Replace the blocking shutdown wait on PolicyWatcher with a callback. Implements policy_watcher on ChromeOS using policy services. 4. Re-use existing threads, url request context getters and policy service on ChromeOS. 5. Fixed a incorrect DCHECK regarding the color format of the frames captured on ChromeOS. BUG=334087 Committed: https://crrev.com/54dde6f02d121ff745e66b57205583087ff720ec Cr-Commit-Position: refs/heads/master@{#302034} Review URL: https://codereview.chromium.org/639233002 Cr-Commit-Position: refs/heads/master@{#302162}
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/chrome_browser_main_chromeos.cc5
-rw-r--r--chrome/browser/extensions/api/DEPS2
-rw-r--r--chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc48
3 files changed, 48 insertions, 7 deletions
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index 0139f77..655fd77 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -113,6 +113,7 @@
#include "content/public/common/main_function_params.h"
#include "media/audio/sounds/sounds_manager.h"
#include "net/base/network_change_notifier.h"
+#include "net/socket/ssl_server_socket.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/touch/touch_device.h"
@@ -311,6 +312,10 @@ void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() {
dbus_services_.reset(new internal::DBusServices(parameters()));
+ // Enable support for SSL server sockets, which must be done while still
+ // single-threaded. This is required for remote assistance host on Chrome OS.
+ net::EnableSSLServerSockets();
+
ChromeBrowserMainPartsLinux::PostMainMessageLoopStart();
}
diff --git a/chrome/browser/extensions/api/DEPS b/chrome/browser/extensions/api/DEPS
index 7b1dbb3..c043985 100644
--- a/chrome/browser/extensions/api/DEPS
+++ b/chrome/browser/extensions/api/DEPS
@@ -2,4 +2,6 @@ include_rules = [
"+apps",
"+chrome/browser/apps",
"+device/hid",
+ # Enable remote assistance on Chrome OS
+ "+remoting/host",
]
diff --git a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
index 799a5b6..fdb4318 100644
--- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -16,9 +16,17 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/messaging/native_messaging_test_util.h"
+#include "components/policy/core/common/policy_service.h"
#include "extensions/common/constants.h"
+#include "extensions/common/switches.h"
#include "extensions/common/url_pattern.h"
+#include "net/url_request/url_request_context_getter.h"
+#if defined(USE_X11)
+#include "remoting/host/chromoting_host_context.h"
+#include "remoting/host/it2me/it2me_native_messaging_host.h"
+# endif // defined(USE_X11)
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h"
@@ -26,10 +34,9 @@ namespace extensions {
namespace {
-// A simple NativeMesageHost that echoes the received message. It is currently
-// used for testing.
-// TODO(kelvinp): Replace this class once Remote Assistance in process host
-// is implemented.
+// A simple NativeMessageHost that mimics the implementation of
+// chrome/test/data/native_messaging/native_hosts/echo.py. It is currently
+// used for testing by ExtensionApiTest::NativeMessagingBasic.
const char* const kEchoHostOrigins[] = {
// ScopedTestNativeMessagingHost::kExtensionId
@@ -90,25 +97,52 @@ struct BuiltInHost {
scoped_ptr<NativeMessageHost>(*create_function)();
};
+// Remote assistance currently only supports X11.
+// TODO(kelvinp): Migrate to ozone once it is ready (crbug.com/426716).
+#if defined(USE_X11)
+scoped_ptr<NativeMessageHost> CreateIt2MeHost() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableRemoteAssistance)) {
+ scoped_ptr<remoting::It2MeHostFactory> host_factory(
+ new remoting::It2MeHostFactory());
+ host_factory->set_policy_service(g_browser_process->policy_service());
+ scoped_ptr<remoting::ChromotingHostContext> context =
+ remoting::ChromotingHostContext::CreateForChromeOS(
+ make_scoped_refptr(g_browser_process->system_request_context()));
+ scoped_ptr<NativeMessageHost> host(new remoting::It2MeNativeMessagingHost(
+ context.Pass(), host_factory.Pass()));
+ return host.Pass();
+ }
+ return nullptr;
+}
+
// If you modify the list of allowed_origins, don't forget to update
// remoting/host/it2me/com.google.chrome.remote_assistance.json.jinja2
// to keep the two lists in sync.
// TODO(kelvinp): Load the native messaging manifest as a resource file into
-// chrome and fetch the list of allowed_origins from the manifest.
-/*const char* const kRemotingIt2MeOrigins[] = {
+// chrome and fetch the list of allowed_origins from the manifest (see
+// crbug/424743).
+const char* const kRemotingIt2MeOrigins[] = {
"chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/",
"chrome-extension://gbchcmhmhahfdphkhkmpfmihenigjmpp/",
"chrome-extension://kgngmbheleoaphbjbaiobfdepmghbfah/",
"chrome-extension://odkaodonbgfohohmklejpjiejmcipmib/",
"chrome-extension://dokpleeekgeeiehdhmdkeimnkmoifgdd/",
"chrome-extension://ajoainacpilcemgiakehflpbkbfipojk/",
- "chrome-extension://hmboipgjngjoiaeicfdifdoeacilalgc/"};*/
+ "chrome-extension://hmboipgjngjoiaeicfdifdoeacilalgc/"};
+#endif // defined(USE_X11)
static const BuiltInHost kBuiltInHost[] = {
{"com.google.chrome.test.echo", // ScopedTestNativeMessagingHost::kHostName
kEchoHostOrigins,
arraysize(kEchoHostOrigins),
&EchoHost::Create},
+#if defined(USE_X11)
+ {"com.google.chrome.remote_assistance",
+ kRemotingIt2MeOrigins,
+ arraysize(kRemotingIt2MeOrigins),
+ &CreateIt2MeHost},
+#endif // defined(USE_X11)
};
bool MatchesSecurityOrigin(const BuiltInHost& host,