| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // See the corresponding header file for description of the functions in this | 5 // See the corresponding header file for description of the functions in this |
| 6 // file. | 6 // file. |
| 7 | 7 |
| 8 #include "chrome/installer/util/install_util.h" | 8 #include "chrome/installer/util/install_util.h" |
| 9 | 9 |
| 10 #include <shellapi.h> | 10 #include <shellapi.h> |
| 11 #include <shlobj.h> | 11 #include <shlobj.h> |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "base/command_line.h" |
| 15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/registry.h" | 18 #include "base/registry.h" |
| 18 #include "base/scoped_ptr.h" | 19 #include "base/scoped_ptr.h" |
| 19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 20 #include "base/win_util.h" | 21 #include "base/win_util.h" |
| 21 | 22 |
| 22 #include "chrome/installer/util/browser_distribution.h" | 23 #include "chrome/installer/util/browser_distribution.h" |
| 23 #include "chrome/installer/util/google_update_constants.h" | 24 #include "chrome/installer/util/google_update_constants.h" |
| 24 #include "chrome/installer/util/l10n_string_util.h" | 25 #include "chrome/installer/util/l10n_string_util.h" |
| 26 #include "chrome/installer/util/util_constants.h" |
| 25 #include "chrome/installer/util/work_item_list.h" | 27 #include "chrome/installer/util/work_item_list.h" |
| 26 | 28 |
| 27 bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe, | 29 bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe, |
| 28 const std::wstring& params, | 30 const std::wstring& params, |
| 29 DWORD* exit_code) { | 31 DWORD* exit_code) { |
| 30 SHELLEXECUTEINFO info = {0}; | 32 SHELLEXECUTEINFO info = {0}; |
| 31 info.cbSize = sizeof(SHELLEXECUTEINFO); | 33 info.cbSize = sizeof(SHELLEXECUTEINFO); |
| 32 info.fMask = SEE_MASK_NOCLOSEPROCESS; | 34 info.fMask = SEE_MASK_NOCLOSEPROCESS; |
| 33 info.lpVerb = L"runas"; | 35 info.lpVerb = L"runas"; |
| 34 info.lpFile = exe.c_str(); | 36 info.lpFile = exe.c_str(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 wchar_t program_files_path[MAX_PATH] = {0}; | 122 wchar_t program_files_path[MAX_PATH] = {0}; |
| 121 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, | 123 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, |
| 122 SHGFP_TYPE_CURRENT, program_files_path))) { | 124 SHGFP_TYPE_CURRENT, program_files_path))) { |
| 123 return !StartsWith(exe_path, program_files_path, false); | 125 return !StartsWith(exe_path, program_files_path, false); |
| 124 } else { | 126 } else { |
| 125 NOTREACHED(); | 127 NOTREACHED(); |
| 126 } | 128 } |
| 127 return true; | 129 return true; |
| 128 } | 130 } |
| 129 | 131 |
| 132 bool InstallUtil::IsChromeFrameProcess() { |
| 133 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 134 DCHECK(command_line) |
| 135 << "IsChromeFrameProcess() called before ComamandLine::Init()"; |
| 136 return command_line->HasSwitch(installer_util::switches::kChromeFrame); |
| 137 } |
| 138 |
| 130 bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path, | 139 bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path, |
| 131 const wchar_t** const dll_names, | 140 const wchar_t** const dll_names, |
| 132 int dll_names_count, | 141 int dll_names_count, |
| 133 bool do_register, | 142 bool do_register, |
| 134 WorkItemList* registration_list) { | 143 WorkItemList* registration_list) { |
| 135 DCHECK(NULL != registration_list); | 144 DCHECK(NULL != registration_list); |
| 136 bool success = true; | 145 bool success = true; |
| 137 for (int i = 0; i < dll_names_count; i++) { | 146 for (int i = 0; i < dll_names_count; i++) { |
| 138 std::wstring dll_file_path(install_path); | 147 std::wstring dll_file_path(install_path); |
| 139 file_util::AppendToPath(&dll_file_path, dll_names[i]); | 148 file_util::AppendToPath(&dll_file_path, dll_names[i]); |
| 140 success = registration_list->AddSelfRegWorkItem(dll_file_path, | 149 success = registration_list->AddSelfRegWorkItem(dll_file_path, |
| 141 do_register) && success; | 150 do_register) && success; |
| 142 } | 151 } |
| 143 return (dll_names_count > 0) && success; | 152 return (dll_names_count > 0) && success; |
| 144 } | 153 } |
| OLD | NEW |