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

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

Issue 10914160: Manually merging remaining Win8 changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return S_OK; 213 return S_OK;
214 } 214 }
215 215
216 string16 app_id = delegate_execute::GetAppId(chrome_exe_); 216 string16 app_id = delegate_execute::GetAppId(chrome_exe_);
217 217
218 DWORD pid = 0; 218 DWORD pid = 0;
219 if (launch_scheme_ == INTERNET_SCHEME_FILE) { 219 if (launch_scheme_ == INTERNET_SCHEME_FILE) {
220 AtlTrace("Activating for file\n"); 220 AtlTrace("Activating for file\n");
221 hr = activation_manager->ActivateApplication(app_id.c_str(), 221 hr = activation_manager->ActivateApplication(app_id.c_str(),
222 verb_.c_str(), 222 verb_.c_str(),
223 AO_NOERRORUI, 223 AO_NONE,
224 &pid); 224 &pid);
225 } else { 225 } else {
226 AtlTrace("Activating for protocol\n"); 226 AtlTrace("Activating for protocol\n");
227 hr = activation_manager->ActivateForProtocol(app_id.c_str(), 227 hr = activation_manager->ActivateForProtocol(app_id.c_str(),
228 item_array_, 228 item_array_,
229 &pid); 229 &pid);
230 } 230 }
231 if (hr == E_APPLICATION_NOT_REGISTERED) { 231 if (hr == E_APPLICATION_NOT_REGISTERED) {
232 AtlTrace("Metro chrome is not registered, launching in desktop\n"); 232 AtlTrace("Metro chrome is not registered, launching in desktop\n");
233 return LaunchDesktopChrome(); 233 return LaunchDesktopChrome();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 382
383 AtlTrace("Formatted command line is %ls\n", command_line.c_str()); 383 AtlTrace("Formatted command line is %ls\n", command_line.c_str());
384 384
385 PROCESS_INFORMATION proc_info = {0}; 385 PROCESS_INFORMATION proc_info = {0};
386 BOOL ret = CreateProcess(NULL, const_cast<LPWSTR>(command_line.c_str()), 386 BOOL ret = CreateProcess(NULL, const_cast<LPWSTR>(command_line.c_str()),
387 NULL, NULL, FALSE, 0, NULL, NULL, &start_info_, 387 NULL, NULL, FALSE, 0, NULL, NULL, &start_info_,
388 &proc_info); 388 &proc_info);
389 if (ret) { 389 if (ret) {
390 AtlTrace("Process id is %d\n", proc_info.dwProcessId); 390 AtlTrace("Process id is %d\n", proc_info.dwProcessId);
391 AllowSetForegroundWindow(proc_info.dwProcessId);
391 CloseHandle(proc_info.hProcess); 392 CloseHandle(proc_info.hProcess);
392 CloseHandle(proc_info.hThread); 393 CloseHandle(proc_info.hThread);
393 } else { 394 } else {
394 AtlTrace("Process launch failed, error %d\n", ::GetLastError()); 395 AtlTrace("Process launch failed, error %d\n", ::GetLastError());
395 } 396 }
396 397
397 return S_OK; 398 return S_OK;
398 } 399 }
399 400
400 EC_HOST_UI_MODE CommandExecuteImpl::GetLaunchMode() { 401 EC_HOST_UI_MODE CommandExecuteImpl::GetLaunchMode() {
401 // We are to return chrome's mode if chrome exists else we query our embedder 402 // We are to return chrome's mode if chrome exists else we query our embedder
402 // IServiceProvider and learn the mode from them. 403 // IServiceProvider and learn the mode from them.
403 static bool launch_mode_determined = false; 404 static bool launch_mode_determined = false;
404 static EC_HOST_UI_MODE launch_mode = ECHUIM_DESKTOP; 405 static EC_HOST_UI_MODE launch_mode = ECHUIM_DESKTOP;
405 406
406 const char* modes[] = { "Desktop", "Inmmersive", "SysLauncher", "??" }; 407 const char* modes[] = { "Desktop", "Inmmersive", "SysLauncher", "??" };
407 408
408 if (launch_mode_determined) 409 if (launch_mode_determined)
409 return launch_mode; 410 return launch_mode;
410 411
411 if (chrome_mode_ != ECHUIM_SYSTEM_LAUNCHER) { 412 if (chrome_mode_ != ECHUIM_SYSTEM_LAUNCHER) {
412 launch_mode = chrome_mode_; 413 launch_mode = chrome_mode_;
413 AtlTrace("Launch mode is that of chrome, %s\n", modes[launch_mode]); 414 AtlTrace("Launch mode is that of chrome, %s\n", modes[launch_mode]);
414 launch_mode_determined = true; 415 launch_mode_determined = true;
415 return launch_mode; 416 return launch_mode;
416 } 417 }
417 418
418 if (parameters_ == ASCIIToWide(switches::kForceImmersive)) { 419 if (parameters_ == ASCIIToWide(switches::kForceImmersive)) {
419 launch_mode = ECHUIM_IMMERSIVE; 420 launch_mode = ECHUIM_IMMERSIVE;
421 launch_mode_determined = true;
422 } else if (parameters_ == ASCIIToWide(switches::kForceDesktop)) {
423 launch_mode = ECHUIM_DESKTOP;
424 launch_mode_determined = true;
425 }
426
427 if (launch_mode_determined) {
428 parameters_.clear();
420 AtlTrace("Launch mode forced to %s\n", modes[launch_mode]); 429 AtlTrace("Launch mode forced to %s\n", modes[launch_mode]);
421 launch_mode_determined = true;
422 return launch_mode; 430 return launch_mode;
423 } 431 }
424 432
425 CComPtr<IExecuteCommandHost> host; 433 CComPtr<IExecuteCommandHost> host;
426 CComQIPtr<IServiceProvider> service_provider = m_spUnkSite; 434 CComQIPtr<IServiceProvider> service_provider = m_spUnkSite;
427 if (service_provider) { 435 if (service_provider) {
428 service_provider->QueryService(IID_IExecuteCommandHost, &host); 436 service_provider->QueryService(IID_IExecuteCommandHost, &host);
429 if (host) { 437 if (host) {
430 host->GetUIMode(&launch_mode); 438 host->GetUIMode(&launch_mode);
431 } else { 439 } else {
432 AtlTrace("Failed to get IID_IExecuteCommandHost. Assuming desktop\n"); 440 AtlTrace("Failed to get IID_IExecuteCommandHost. Assuming desktop\n");
433 } 441 }
434 } else { 442 } else {
435 AtlTrace("Failed to get IServiceProvider. Assuming desktop mode\n"); 443 AtlTrace("Failed to get IServiceProvider. Assuming desktop mode\n");
436 } 444 }
437 AtlTrace("Launch mode is %s\n", modes[launch_mode]); 445 AtlTrace("Launch mode is %s\n", modes[launch_mode]);
438 launch_mode_determined = true; 446 launch_mode_determined = true;
439 return launch_mode; 447 return launch_mode;
440 } 448 }
OLDNEW
« no previous file with comments | « no previous file | win8/delegate_execute/delegate_execute.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698