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

Side by Side Diff: chrome/app_shim/win/app_shim_main.cc

Issue 819133004: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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/app_shim/chrome_main_app_mode_mac.mm ('k') | chrome/browser/about_flags.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 <windows.h> 5 #include <windows.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 29 matching lines...) Expand all
40 // 40 //
41 // The -- is required if switches are to be passed to Chrome; any switches 41 // The -- is required if switches are to be passed to Chrome; any switches
42 // before the -- will be interpreted by app_shim_win, and not passed to Chrome. 42 // before the -- will be interpreted by app_shim_win, and not passed to Chrome.
43 // 43 //
44 // If --chrome-sxs is specified, looks for the SxS (Canary) build of Chrome. 44 // If --chrome-sxs is specified, looks for the SxS (Canary) build of Chrome.
45 // This will always fail for Chromium. 45 // This will always fail for Chromium.
46 int WINAPI wWinMain(HINSTANCE instance, 46 int WINAPI wWinMain(HINSTANCE instance,
47 HINSTANCE prev_instance, 47 HINSTANCE prev_instance,
48 wchar_t* /*command_line*/, 48 wchar_t* /*command_line*/,
49 int show_command) { 49 int show_command) {
50 CommandLine::Init(0, nullptr); 50 base::CommandLine::Init(0, nullptr);
51 51
52 // Log to stderr. Otherwise it will log to a file by default. 52 // Log to stderr. Otherwise it will log to a file by default.
53 logging::LoggingSettings logging_settings; 53 logging::LoggingSettings logging_settings;
54 logging_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 54 logging_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
55 logging::InitLogging(logging_settings); 55 logging::InitLogging(logging_settings);
56 56
57 // Get the command-line for the Chrome binary. 57 // Get the command-line for the Chrome binary.
58 // --chrome-sxs on the command line means we should run the canary binary. 58 // --chrome-sxs on the command line means we should run the canary binary.
59 bool is_canary = 59 bool is_canary =
60 base::CommandLine::ForCurrentProcess()->HasSwitch(kChromeSxS); 60 base::CommandLine::ForCurrentProcess()->HasSwitch(kChromeSxS);
61 base::FilePath chrome_path = GetChromeExePath(is_canary); 61 base::FilePath chrome_path = GetChromeExePath(is_canary);
62 if (chrome_path.empty()) { 62 if (chrome_path.empty()) {
63 LOG(ERROR) << "Could not find chrome.exe path in the registry."; 63 LOG(ERROR) << "Could not find chrome.exe path in the registry.";
64 return kNoProgram; 64 return kNoProgram;
65 } 65 }
66 CommandLine command_line(chrome_path); 66 base::CommandLine command_line(chrome_path);
67 67
68 // Get the command-line arguments for the subprocess, consisting of the 68 // Get the command-line arguments for the subprocess, consisting of the
69 // arguments (but not switches) to this binary. This gets everything after the 69 // arguments (but not switches) to this binary. This gets everything after the
70 // "--". 70 // "--".
71 for (const auto& arg : CommandLine::ForCurrentProcess()->GetArgs()) 71 for (const auto& arg : base::CommandLine::ForCurrentProcess()->GetArgs())
72 command_line.AppendArgNative(arg); 72 command_line.AppendArgNative(arg);
73 73
74 if (!base::LaunchProcess(command_line, base::LaunchOptions()).IsValid()) { 74 if (!base::LaunchProcess(command_line, base::LaunchOptions()).IsValid()) {
75 LOG(ERROR) << "Could not run chrome.exe."; 75 LOG(ERROR) << "Could not run chrome.exe.";
76 return kLaunchFailure; 76 return kLaunchFailure;
77 } 77 }
78 78
79 return kOK; 79 return kOK;
80 } 80 }
OLDNEW
« no previous file with comments | « chrome/app_shim/chrome_main_app_mode_mac.mm ('k') | chrome/browser/about_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698