OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/browser/api/messaging/native_message_host.h" | 5 #include "extensions/browser/api/messaging/native_message_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
12 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
13 #include "base/location.h" | 14 #include "base/location.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 scoped_ptr<remoting::ChromotingHostContext> context = | 100 scoped_ptr<remoting::ChromotingHostContext> context = |
100 remoting::ChromotingHostContext::CreateForChromeOS( | 101 remoting::ChromotingHostContext::CreateForChromeOS( |
101 make_scoped_refptr(g_browser_process->system_request_context()), | 102 make_scoped_refptr(g_browser_process->system_request_context()), |
102 content::BrowserThread::GetMessageLoopProxyForThread( | 103 content::BrowserThread::GetMessageLoopProxyForThread( |
103 content::BrowserThread::IO), | 104 content::BrowserThread::IO), |
104 content::BrowserThread::GetMessageLoopProxyForThread( | 105 content::BrowserThread::GetMessageLoopProxyForThread( |
105 content::BrowserThread::UI), | 106 content::BrowserThread::UI), |
106 content::BrowserThread::GetMessageLoopProxyForThread( | 107 content::BrowserThread::GetMessageLoopProxyForThread( |
107 content::BrowserThread::FILE)); | 108 content::BrowserThread::FILE)); |
108 scoped_ptr<NativeMessageHost> host(new remoting::It2MeNativeMessagingHost( | 109 scoped_ptr<NativeMessageHost> host(new remoting::It2MeNativeMessagingHost( |
109 context.Pass(), host_factory.Pass())); | 110 std::move(context), std::move(host_factory))); |
110 return host.Pass(); | 111 return host; |
111 } | 112 } |
112 | 113 |
113 // If you modify the list of allowed_origins, don't forget to update | 114 // If you modify the list of allowed_origins, don't forget to update |
114 // remoting/host/it2me/com.google.chrome.remote_assistance.json.jinja2 | 115 // remoting/host/it2me/com.google.chrome.remote_assistance.json.jinja2 |
115 // to keep the two lists in sync. | 116 // to keep the two lists in sync. |
116 // TODO(kelvinp): Load the native messaging manifest as a resource file into | 117 // TODO(kelvinp): Load the native messaging manifest as a resource file into |
117 // chrome and fetch the list of allowed_origins from the manifest (see | 118 // chrome and fetch the list of allowed_origins from the manifest (see |
118 // crbug/424743). | 119 // crbug/424743). |
119 const char* const kRemotingIt2MeOrigins[] = { | 120 const char* const kRemotingIt2MeOrigins[] = { |
120 "chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/", | 121 "chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/", |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 166 } |
166 *error = kForbiddenError; | 167 *error = kForbiddenError; |
167 return nullptr; | 168 return nullptr; |
168 } | 169 } |
169 } | 170 } |
170 *error = kNotFoundError; | 171 *error = kNotFoundError; |
171 return nullptr; | 172 return nullptr; |
172 } | 173 } |
173 | 174 |
174 } // namespace extensions | 175 } // namespace extensions |
OLD | NEW |