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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 struct BuiltInHost { | 88 struct BuiltInHost { |
89 const char* const name; | 89 const char* const name; |
90 const char* const* const allowed_origins; | 90 const char* const* const allowed_origins; |
91 int allowed_origins_count; | 91 int allowed_origins_count; |
92 std::unique_ptr<NativeMessageHost> (*create_function)(); | 92 std::unique_ptr<NativeMessageHost> (*create_function)(); |
93 }; | 93 }; |
94 | 94 |
95 std::unique_ptr<NativeMessageHost> CreateIt2MeHost() { | 95 std::unique_ptr<NativeMessageHost> CreateIt2MeHost() { |
96 std::unique_ptr<remoting::It2MeHostFactory> host_factory( | 96 std::unique_ptr<remoting::It2MeHostFactory> host_factory( |
97 new remoting::It2MeHostFactory()); | 97 new remoting::It2MeHostFactory()); |
98 host_factory->set_policy_service(g_browser_process->policy_service()); | |
99 std::unique_ptr<remoting::ChromotingHostContext> context = | 98 std::unique_ptr<remoting::ChromotingHostContext> context = |
100 remoting::ChromotingHostContext::CreateForChromeOS( | 99 remoting::ChromotingHostContext::CreateForChromeOS( |
101 make_scoped_refptr(g_browser_process->system_request_context()), | 100 make_scoped_refptr(g_browser_process->system_request_context()), |
102 content::BrowserThread::GetTaskRunnerForThread( | 101 content::BrowserThread::GetTaskRunnerForThread( |
103 content::BrowserThread::IO), | 102 content::BrowserThread::IO), |
104 content::BrowserThread::GetTaskRunnerForThread( | 103 content::BrowserThread::GetTaskRunnerForThread( |
105 content::BrowserThread::UI), | 104 content::BrowserThread::UI), |
106 content::BrowserThread::GetTaskRunnerForThread( | 105 content::BrowserThread::GetTaskRunnerForThread( |
107 content::BrowserThread::FILE)); | 106 content::BrowserThread::FILE)); |
108 std::unique_ptr<NativeMessageHost> host( | 107 std::unique_ptr<NativeMessageHost> host( |
109 new remoting::It2MeNativeMessagingHost(std::move(context), | 108 new remoting::It2MeNativeMessagingHost( |
110 std::move(host_factory))); | 109 /*needs_elevation=*/false, g_browser_process->policy_service(), |
| 110 std::move(context), std::move(host_factory))); |
111 return host; | 111 return host; |
112 } | 112 } |
113 | 113 |
114 // 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 |
115 // remoting/host/it2me/com.google.chrome.remote_assistance.json.jinja2 | 115 // remoting/host/it2me/com.google.chrome.remote_assistance.json.jinja2 |
116 // to keep the two lists in sync. | 116 // to keep the two lists in sync. |
117 // 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 |
118 // 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 |
119 // crbug/424743). | 119 // crbug/424743). |
120 const char* const kRemotingIt2MeOrigins[] = { | 120 const char* const kRemotingIt2MeOrigins[] = { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 *error = kForbiddenError; | 173 *error = kForbiddenError; |
174 return nullptr; | 174 return nullptr; |
175 } | 175 } |
176 } | 176 } |
177 *error = kNotFoundError; | 177 *error = kNotFoundError; |
178 return nullptr; | 178 return nullptr; |
179 } | 179 } |
180 | 180 |
181 } // namespace extensions | 181 } // namespace extensions |
OLD | NEW |