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

Side by Side Diff: chrome/installer/gcapi/gcapi.cc

Issue 2894483002: Migrate from ScopedComPtr::CreateInstance() to CoCreateInstance in chrome/... (Closed)
Patch Set: Fix Header Include Location 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
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 4
5 // NOTE: This code is a legacy utility API for partners to check whether 5 // NOTE: This code is a legacy utility API for partners to check whether
6 // Chrome can be installed and launched. Recent updates are being made 6 // Chrome can be installed and launched. Recent updates are being made
7 // to add new functionality. These updates use code from Chromium, the old 7 // to add new functionality. These updates use code from Chromium, the old
8 // coded against the win32 api directly. If you have an itch to shave a 8 // coded against the win32 api directly. If you have an itch to shave a
9 // yak, feel free to re-write the old code too. 9 // yak, feel free to re-write the old code too.
10 10
11 #include "chrome/installer/gcapi/gcapi.h" 11 #include "chrome/installer/gcapi/gcapi.h"
12 12
13 #include <sddl.h> 13 #include <sddl.h>
14 #include <stddef.h> 14 #include <stddef.h>
15 #include <stdint.h> 15 #include <stdint.h>
16 #include <string.h> 16 #include <string.h>
17 #define STRSAFE_NO_DEPRECATE 17 #define STRSAFE_NO_DEPRECATE
18 #include <windows.h> 18 #include <windows.h>
19 #include <objbase.h>
19 #include <strsafe.h> 20 #include <strsafe.h>
20 #include <tlhelp32.h> 21 #include <tlhelp32.h>
21 22
22 #include <cstdlib> 23 #include <cstdlib>
23 #include <iterator> 24 #include <iterator>
24 #include <limits> 25 #include <limits>
25 #include <set> 26 #include <set>
26 #include <string> 27 #include <string>
27 28
28 #include "base/command_line.h" 29 #include "base/command_line.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 ::LocalFree(curr_proc_sid); 481 ::LocalFree(curr_proc_sid);
481 if (!impersonation_success) { 482 if (!impersonation_success) {
482 return false; 483 return false;
483 } 484 }
484 } 485 }
485 486
486 base::CommandLine chrome_command(chrome_exe_path); 487 base::CommandLine chrome_command(chrome_exe_path);
487 488
488 bool ret = false; 489 bool ret = false;
489 ScopedComPtr<IProcessLauncher> ipl; 490 ScopedComPtr<IProcessLauncher> ipl;
490 if (SUCCEEDED(ipl.CreateInstance(__uuidof(ProcessLauncherClass), 491 if (SUCCEEDED(::CoCreateInstance(__uuidof(ProcessLauncherClass), NULL,
491 NULL, 492 CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&ipl)))) {
492 CLSCTX_LOCAL_SERVER))) {
493 if (SUCCEEDED(ipl->LaunchCmdLine( 493 if (SUCCEEDED(ipl->LaunchCmdLine(
494 chrome_command.GetCommandLineString().c_str()))) 494 chrome_command.GetCommandLineString().c_str())))
495 ret = true; 495 ret = true;
496 ipl.Reset(); 496 ipl.Reset();
497 } else { 497 } else {
498 // Couldn't get Omaha's process launcher, Omaha may not be installed at 498 // Couldn't get Omaha's process launcher, Omaha may not be installed at
499 // system level. Try just running Chrome instead. 499 // system level. Try just running Chrome instead.
500 ret = base::LaunchProcess(chrome_command.GetCommandLineString(), 500 ret = base::LaunchProcess(chrome_command.GetCommandLineString(),
501 base::LaunchOptions()).IsValid(); 501 base::LaunchOptions()).IsValid();
502 } 502 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 key.WriteValue(kRelaunchAllowedAfterValue, FormatDateOffsetByMonths(6)) != 766 key.WriteValue(kRelaunchAllowedAfterValue, FormatDateOffsetByMonths(6)) !=
767 ERROR_SUCCESS || 767 ERROR_SUCCESS ||
768 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) { 768 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) {
769 if (error_code) 769 if (error_code)
770 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED; 770 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED;
771 return FALSE; 771 return FALSE;
772 } 772 }
773 773
774 return TRUE; 774 return TRUE;
775 } 775 }
OLDNEW
« no previous file with comments | « chrome/browser/win/settings_app_monitor.cc ('k') | chrome/installer/util/advanced_firewall_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698