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

Side by Side Diff: win8/delegate_execute/command_execute_impl.cc

Issue 819223002: 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 | « ui/wm/core/window_animations.cc ('k') | win8/delegate_execute/delegate_execute.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Implementation of the CommandExecuteImpl class which implements the 4 // Implementation of the CommandExecuteImpl class which implements the
5 // IExecuteCommand and related interfaces for handling ShellExecute based 5 // IExecuteCommand and related interfaces for handling ShellExecute based
6 // launches of the Chrome browser. 6 // launches of the Chrome browser.
7 7
8 #include "win8/delegate_execute/command_execute_impl.h" 8 #include "win8/delegate_execute/command_execute_impl.h"
9 9
10 #include <shlguid.h> 10 #include <shlguid.h>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 delegate_exe_path.DirName() 84 delegate_exe_path.DirName()
85 .Append(chrome::kBrowserProcessExecutableName); 85 .Append(chrome::kBrowserProcessExecutableName);
86 } 86 }
87 87
88 if (!base::PathExists(chrome_exe_path)) { 88 if (!base::PathExists(chrome_exe_path)) {
89 AtlTrace("Could not locate chrome.exe at: %ls\n", 89 AtlTrace("Could not locate chrome.exe at: %ls\n",
90 chrome_exe_path.value().c_str()); 90 chrome_exe_path.value().c_str());
91 return false; 91 return false;
92 } 92 }
93 93
94 CommandLine cl(chrome_exe_path); 94 base::CommandLine cl(chrome_exe_path);
95 95
96 // Prevent a Chrome window from showing up on the desktop. 96 // Prevent a Chrome window from showing up on the desktop.
97 cl.AppendSwitch(switches::kSilentLaunch); 97 cl.AppendSwitch(switches::kSilentLaunch);
98 98
99 // Tell Chrome to connect to the Metro viewer process. 99 // Tell Chrome to connect to the Metro viewer process.
100 cl.AppendSwitch(switches::kViewerConnect); 100 cl.AppendSwitch(switches::kViewerConnect);
101 101
102 base::LaunchOptions launch_options; 102 base::LaunchOptions launch_options;
103 launch_options.start_hidden = true; 103 launch_options.start_hidden = true;
104 104
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // E_APPLICATION_NOT_REGISTERED is always returned if Chrome is not the 160 // E_APPLICATION_NOT_REGISTERED is always returned if Chrome is not the
161 // default browser (this case will have already been checked for by 161 // default browser (this case will have already been checked for by
162 // GetLaunchMode() and AHE_DESKTOP returned), but we don't know if it can 162 // GetLaunchMode() and AHE_DESKTOP returned), but we don't know if it can
163 // be returned for other reasons. 163 // be returned for other reasons.
164 // 164 //
165 // Note that if a command line --force-xxx is present we write that launch mode 165 // Note that if a command line --force-xxx is present we write that launch mode
166 // in the registry so next time the logic reaches 5c-ii it will use the same 166 // in the registry so next time the logic reaches 5c-ii it will use the same
167 // mode again. 167 // mode again.
168 // 168 //
169 CommandExecuteImpl::CommandExecuteImpl() 169 CommandExecuteImpl::CommandExecuteImpl()
170 : parameters_(CommandLine::NO_PROGRAM), 170 : parameters_(base::CommandLine::NO_PROGRAM),
171 launch_scheme_(INTERNET_SCHEME_DEFAULT), 171 launch_scheme_(INTERNET_SCHEME_DEFAULT),
172 integrity_level_(base::INTEGRITY_UNKNOWN) { 172 integrity_level_(base::INTEGRITY_UNKNOWN) {
173 memset(&start_info_, 0, sizeof(start_info_)); 173 memset(&start_info_, 0, sizeof(start_info_));
174 start_info_.cb = sizeof(start_info_); 174 start_info_.cb = sizeof(start_info_);
175 175
176 // We need to query the user data dir of chrome so we need chrome's 176 // We need to query the user data dir of chrome so we need chrome's
177 // path provider. We can be created multiple times in a single instance 177 // path provider. We can be created multiple times in a single instance
178 // however so make sure we do this only once. 178 // however so make sure we do this only once.
179 if (!path_provider_initialized_) { 179 if (!path_provider_initialized_) {
180 chrome::RegisterPathProvider(); 180 chrome::RegisterPathProvider();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // chrome is the default we should treat it as a parameter to be passed 384 // chrome is the default we should treat it as a parameter to be passed
385 // to chrome. 385 // to chrome.
386 if (display_name.find(installer::kChromeExe) != base::string16::npos) 386 if (display_name.find(installer::kChromeExe) != base::string16::npos)
387 display_name.clear(); 387 display_name.clear();
388 break; 388 break;
389 389
390 default: 390 default:
391 break; 391 break;
392 } 392 }
393 393
394 CommandLine chrome( 394 base::CommandLine chrome(delegate_execute::MakeChromeCommandLine(
395 delegate_execute::MakeChromeCommandLine(chrome_exe_, parameters_, 395 chrome_exe_, parameters_, display_name));
396 display_name));
397 base::string16 command_line(chrome.GetCommandLineString()); 396 base::string16 command_line(chrome.GetCommandLineString());
398 397
399 AtlTrace("Formatted command line is %ls\n", command_line.c_str()); 398 AtlTrace("Formatted command line is %ls\n", command_line.c_str());
400 399
401 PROCESS_INFORMATION temp_process_info = {}; 400 PROCESS_INFORMATION temp_process_info = {};
402 BOOL ret = CreateProcess(chrome_exe_.value().c_str(), 401 BOOL ret = CreateProcess(chrome_exe_.value().c_str(),
403 &command_line[0], 402 &command_line[0],
404 NULL, NULL, FALSE, 0, NULL, NULL, &start_info_, 403 NULL, NULL, FALSE, 0, NULL, NULL, &start_info_,
405 &temp_process_info); 404 &temp_process_info);
406 if (ret) { 405 if (ret) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 launch_mode = ECHUIM_IMMERSIVE; 446 launch_mode = ECHUIM_IMMERSIVE;
448 launch_mode_determined = true; 447 launch_mode_determined = true;
449 return launch_mode; 448 return launch_mode;
450 } 449 }
451 450
452 // From here on, if we can, we will write the outcome 451 // From here on, if we can, we will write the outcome
453 // of this function to the registry. 452 // of this function to the registry.
454 if (parameters_.HasSwitch(switches::kForceImmersive)) { 453 if (parameters_.HasSwitch(switches::kForceImmersive)) {
455 launch_mode = ECHUIM_IMMERSIVE; 454 launch_mode = ECHUIM_IMMERSIVE;
456 launch_mode_determined = true; 455 launch_mode_determined = true;
457 parameters_ = CommandLine(CommandLine::NO_PROGRAM); 456 parameters_ = base::CommandLine(base::CommandLine::NO_PROGRAM);
458 } else if (parameters_.HasSwitch(switches::kForceDesktop)) { 457 } else if (parameters_.HasSwitch(switches::kForceDesktop)) {
459 launch_mode = ECHUIM_DESKTOP; 458 launch_mode = ECHUIM_DESKTOP;
460 launch_mode_determined = true; 459 launch_mode_determined = true;
461 parameters_ = CommandLine(CommandLine::NO_PROGRAM); 460 parameters_ = base::CommandLine(base::CommandLine::NO_PROGRAM);
462 } 461 }
463 462
464 base::win::RegKey reg_key; 463 base::win::RegKey reg_key;
465 LONG key_result = reg_key.Create(HKEY_CURRENT_USER, 464 LONG key_result = reg_key.Create(HKEY_CURRENT_USER,
466 chrome::kMetroRegistryPath, 465 chrome::kMetroRegistryPath,
467 KEY_ALL_ACCESS); 466 KEY_ALL_ACCESS);
468 if (key_result != ERROR_SUCCESS) { 467 if (key_result != ERROR_SUCCESS) {
469 AtlTrace("Failed to open HKCU %ls key, error 0x%x\n", 468 AtlTrace("Failed to open HKCU %ls key, error 0x%x\n",
470 chrome::kMetroRegistryPath, 469 chrome::kMetroRegistryPath,
471 key_result); 470 key_result);
(...skipping 23 matching lines...) Expand all
495 AtlTrace("Invalid registry launch mode value %u\n", reg_value); 494 AtlTrace("Invalid registry launch mode value %u\n", reg_value);
496 launch_mode = ECHUIM_DESKTOP; 495 launch_mode = ECHUIM_DESKTOP;
497 } else { 496 } else {
498 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); 497 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value);
499 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); 498 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]);
500 } 499 }
501 500
502 launch_mode_determined = true; 501 launch_mode_determined = true;
503 return launch_mode; 502 return launch_mode;
504 } 503 }
OLDNEW
« no previous file with comments | « ui/wm/core/window_animations.cc ('k') | win8/delegate_execute/delegate_execute.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698