Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc

Issue 2847853003: Remove policy watching from It2MeHost. (Closed)
Patch Set: Add dep. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/api/DEPS ('k') | remoting/host/it2me/it2me_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chromeos/arc/extensions/arc_support_message_host.h" 20 #include "chrome/browser/chromeos/arc/extensions/arc_support_message_host.h"
21 #include "components/policy/core/common/policy_service.h"
22 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
23 #include "extensions/common/constants.h" 22 #include "extensions/common/constants.h"
24 #include "extensions/common/url_pattern.h" 23 #include "extensions/common/url_pattern.h"
25 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
25 #include "remoting/base/auto_thread_task_runner.h"
26 #include "remoting/host/chromoting_host_context.h" 26 #include "remoting/host/chromoting_host_context.h"
27 #include "remoting/host/it2me/it2me_native_messaging_host.h" 27 #include "remoting/host/it2me/it2me_native_messaging_host.h"
28 #include "remoting/host/policy_watcher.h"
28 #include "ui/gfx/native_widget_types.h" 29 #include "ui/gfx/native_widget_types.h"
29 #include "url/gurl.h" 30 #include "url/gurl.h"
30 31
31 namespace extensions { 32 namespace extensions {
32 33
33 namespace { 34 namespace {
34 35
35 // A simple NativeMessageHost that mimics the implementation of 36 // A simple NativeMessageHost that mimics the implementation of
36 // chrome/test/data/native_messaging/native_hosts/echo.py. It is currently 37 // chrome/test/data/native_messaging/native_hosts/echo.py. It is currently
37 // used for testing by ExtensionApiTest::NativeMessagingBasic. 38 // used for testing by ExtensionApiTest::NativeMessagingBasic.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 new remoting::It2MeHostFactory()); 98 new remoting::It2MeHostFactory());
98 std::unique_ptr<remoting::ChromotingHostContext> context = 99 std::unique_ptr<remoting::ChromotingHostContext> context =
99 remoting::ChromotingHostContext::CreateForChromeOS( 100 remoting::ChromotingHostContext::CreateForChromeOS(
100 make_scoped_refptr(g_browser_process->system_request_context()), 101 make_scoped_refptr(g_browser_process->system_request_context()),
101 content::BrowserThread::GetTaskRunnerForThread( 102 content::BrowserThread::GetTaskRunnerForThread(
102 content::BrowserThread::IO), 103 content::BrowserThread::IO),
103 content::BrowserThread::GetTaskRunnerForThread( 104 content::BrowserThread::GetTaskRunnerForThread(
104 content::BrowserThread::UI), 105 content::BrowserThread::UI),
105 content::BrowserThread::GetTaskRunnerForThread( 106 content::BrowserThread::GetTaskRunnerForThread(
106 content::BrowserThread::FILE)); 107 content::BrowserThread::FILE));
108 std::unique_ptr<remoting::PolicyWatcher> policy_watcher =
109 remoting::PolicyWatcher::Create(g_browser_process->policy_service(),
110 context->file_task_runner());
107 std::unique_ptr<NativeMessageHost> host( 111 std::unique_ptr<NativeMessageHost> host(
108 new remoting::It2MeNativeMessagingHost( 112 new remoting::It2MeNativeMessagingHost(
109 /*needs_elevation=*/false, g_browser_process->policy_service(), 113 /*needs_elevation=*/false, std::move(policy_watcher),
110 std::move(context), std::move(host_factory))); 114 std::move(context), std::move(host_factory)));
111 return host; 115 return host;
112 } 116 }
113 117
114 // If you modify the list of allowed_origins, don't forget to update 118 // If you modify the list of allowed_origins, don't forget to update
115 // remoting/host/it2me/com.google.chrome.remote_assistance.json.jinja2 119 // remoting/host/it2me/com.google.chrome.remote_assistance.json.jinja2
116 // to keep the two lists in sync. 120 // to keep the two lists in sync.
117 // TODO(kelvinp): Load the native messaging manifest as a resource file into 121 // 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 122 // chrome and fetch the list of allowed_origins from the manifest (see
119 // crbug/424743). 123 // crbug/424743).
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 171 }
168 *error = kForbiddenError; 172 *error = kForbiddenError;
169 return nullptr; 173 return nullptr;
170 } 174 }
171 } 175 }
172 *error = kNotFoundError; 176 *error = kNotFoundError;
173 return nullptr; 177 return nullptr;
174 } 178 }
175 179
176 } // namespace extensions 180 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/DEPS ('k') | remoting/host/it2me/it2me_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698