| Index: chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
|
| 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 512598615acf1a73010407a118121db72bf596b7..8377317f263e211524edad83c0c253f843273da3 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,14 @@
|
| #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"
|
| +#include "remoting/host/it2me/it2me_native_messaging_host.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -27,9 +32,7 @@ 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.
|
| +// used for testing by ExtensionApiTest::NativeMessagingBasic.
|
|
|
| const char* const kEchoHostOrigins[] = {
|
| // ScopedTestNativeMessagingHost::kExtensionId
|
| @@ -90,25 +93,39 @@ struct BuiltInHost {
|
| scoped_ptr<NativeMessageHost>(*create_function)();
|
| };
|
|
|
| +scoped_ptr<NativeMessageHost> CreateIt2MeHost() {
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableRemoteAssistance)) {
|
| + return remoting::It2MeNativeMessagingHost::CreateForChromeOS(
|
| + g_browser_process->system_request_context(),
|
| + g_browser_process->policy_service());
|
| + }
|
| + 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[] = {
|
| +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/"};
|
|
|
| static const BuiltInHost kBuiltInHost[] = {
|
| {"com.google.chrome.test.echo", // ScopedTestNativeMessagingHost::kHostName
|
| kEchoHostOrigins,
|
| arraysize(kEchoHostOrigins),
|
| &EchoHost::Create},
|
| + {"com.google.chrome.remote_assistance",
|
| + kRemotingIt2MeOrigins,
|
| + arraysize(kRemotingIt2MeOrigins),
|
| + &CreateIt2MeHost},
|
| };
|
|
|
| bool MatchesSecurityOrigin(const BuiltInHost& host,
|
|
|