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

Side by Side Diff: remoting/host/it2me/it2me_native_messaging_host_main.cc

Issue 2961333002: Fix field trials not working in utility processes. (Closed)
Patch Set: review comment Created 3 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/host/it2me/it2me_native_messaging_host_main.h" 5 #include "remoting/host/it2me/it2me_native_messaging_host_main.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 22 matching lines...) Expand all
33 #endif // defined(OS_LINUX) 33 #endif // defined(OS_LINUX)
34 34
35 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
36 #include "base/mac/scoped_nsautorelease_pool.h" 36 #include "base/mac/scoped_nsautorelease_pool.h"
37 #endif // defined(OS_MACOSX) 37 #endif // defined(OS_MACOSX)
38 38
39 #if defined(OS_WIN) 39 #if defined(OS_WIN)
40 #include <commctrl.h> 40 #include <commctrl.h>
41 41
42 #include "remoting/host/switches.h" 42 #include "remoting/host/switches.h"
43 #include "remoting/host/win/elevation_helpers.h"
44 #endif // defined(OS_WIN) 43 #endif // defined(OS_WIN)
45 44
46 namespace remoting { 45 namespace remoting {
47 46
47 namespace {
48
49 #if defined(OS_WIN) && defined(OFFICIAL_BUILD)
50 bool CurrentProcessHasUiAccess() {
51 HANDLE process_token;
52 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &process_token);
53
54 DWORD size;
55 DWORD uiaccess_value = 0;
56 if (!GetTokenInformation(process_token, TokenUIAccess, &uiaccess_value,
57 sizeof(uiaccess_value), &size)) {
58 PLOG(ERROR) << "GetTokenInformation() failed";
59 }
60 CloseHandle(process_token);
61 return uiaccess_value != 0;
62 }
63 #endif // defined(OS_WIN) && defined(OFFICIAL_BUILD)
64
65 } // namespace
66
48 // Creates a It2MeNativeMessagingHost instance, attaches it to stdin/stdout and 67 // Creates a It2MeNativeMessagingHost instance, attaches it to stdin/stdout and
49 // runs the message loop until It2MeNativeMessagingHost signals shutdown. 68 // runs the message loop until It2MeNativeMessagingHost signals shutdown.
50 int It2MeNativeMessagingHostMain(int argc, char** argv) { 69 int It2MeNativeMessagingHostMain(int argc, char** argv) {
51 // This object instance is required by Chrome code (such as MessageLoop). 70 // This object instance is required by Chrome code (such as MessageLoop).
52 base::AtExitManager exit_manager; 71 base::AtExitManager exit_manager;
53 72
54 base::CommandLine::Init(argc, argv); 73 base::CommandLine::Init(argc, argv);
55 remoting::InitHostLogging(); 74 remoting::InitHostLogging();
56 75
57 #if defined(OS_MACOSX) 76 #if defined(OS_MACOSX)
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Run the loop until channel is alive. 219 // Run the loop until channel is alive.
201 run_loop.Run(); 220 run_loop.Run();
202 221
203 // Block until tasks blocking shutdown have completed their execution. 222 // Block until tasks blocking shutdown have completed their execution.
204 base::TaskScheduler::GetInstance()->Shutdown(); 223 base::TaskScheduler::GetInstance()->Shutdown();
205 224
206 return kSuccessExitCode; 225 return kSuccessExitCode;
207 } 226 }
208 227
209 } // namespace remoting 228 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698