| OLD | NEW |
| 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 #include "chrome/installer/mini_installer/configuration.h" | 5 #include "chrome/installer/mini_installer/configuration.h" |
| 6 | 6 |
| 7 #include <windows.h> |
| 7 #include <shellapi.h> // NOLINT | 8 #include <shellapi.h> // NOLINT |
| 8 #include <stddef.h> | 9 #include <stddef.h> |
| 9 | 10 |
| 10 #include "chrome/installer/mini_installer/appid.h" | 11 #include "chrome/installer/mini_installer/appid.h" |
| 11 #include "chrome/installer/mini_installer/mini_installer_constants.h" | 12 #include "chrome/installer/mini_installer/mini_installer_constants.h" |
| 12 #include "chrome/installer/mini_installer/mini_installer_resource.h" | 13 #include "chrome/installer/mini_installer/mini_installer_resource.h" |
| 13 #include "chrome/installer/mini_installer/regkey.h" | 14 #include "chrome/installer/mini_installer/regkey.h" |
| 14 | 15 |
| 15 namespace mini_installer { | 16 namespace mini_installer { |
| 16 | 17 |
| 18 namespace { |
| 19 |
| 20 // Returns true if GoogleUpdateIsMachine=1 is present in the environment. |
| 21 bool GetGoogleUpdateIsMachineEnvVar() { |
| 22 const DWORD kBufferSize = 2; |
| 23 StackString<kBufferSize> value; |
| 24 DWORD length = ::GetEnvironmentVariableW(L"GoogleUpdateIsMachine", |
| 25 value.get(), kBufferSize); |
| 26 return length == 1 && *value.get() == L'1'; |
| 27 } |
| 28 |
| 29 } // namespace |
| 30 |
| 17 Configuration::Configuration() : args_(NULL) { | 31 Configuration::Configuration() : args_(NULL) { |
| 18 Clear(); | 32 Clear(); |
| 19 } | 33 } |
| 20 | 34 |
| 21 Configuration::~Configuration() { | 35 Configuration::~Configuration() { |
| 22 Clear(); | 36 Clear(); |
| 23 } | 37 } |
| 24 | 38 |
| 25 // When multi_install is true, we are potentially: | 39 // When multi_install is true, we are potentially: |
| 26 // 1. Performing a multi-install of some product(s) on a clean machine. | 40 // 1. Performing a multi-install of some product(s) on a clean machine. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 else if (0 == ::lstrcmpi(args_[i], L"--chrome-frame")) | 130 else if (0 == ::lstrcmpi(args_[i], L"--chrome-frame")) |
| 117 has_chrome_frame_ = true; | 131 has_chrome_frame_ = true; |
| 118 else if (0 == ::lstrcmpi(args_[i], L"--multi-install")) | 132 else if (0 == ::lstrcmpi(args_[i], L"--multi-install")) |
| 119 is_multi_install_ = true; | 133 is_multi_install_ = true; |
| 120 else if (0 == ::lstrcmpi(args_[i], L"--system-level")) | 134 else if (0 == ::lstrcmpi(args_[i], L"--system-level")) |
| 121 is_system_level_ = true; | 135 is_system_level_ = true; |
| 122 else if (0 == ::lstrcmpi(args_[i], L"--cleanup")) | 136 else if (0 == ::lstrcmpi(args_[i], L"--cleanup")) |
| 123 operation_ = CLEANUP; | 137 operation_ = CLEANUP; |
| 124 } | 138 } |
| 125 | 139 |
| 140 if (!is_system_level_) |
| 141 is_system_level_ = GetGoogleUpdateIsMachineEnvVar(); |
| 126 SetChromeAppGuid(); | 142 SetChromeAppGuid(); |
| 127 if (!is_multi_install_) { | 143 if (!is_multi_install_) { |
| 128 has_chrome_ = !has_chrome_frame_; | 144 has_chrome_ = !has_chrome_frame_; |
| 129 } | 145 } |
| 130 } | 146 } |
| 131 | 147 |
| 132 return args_ != NULL; | 148 return args_ != NULL; |
| 133 } | 149 } |
| 134 | 150 |
| 135 void Configuration::ReadResources(HMODULE module) { | 151 void Configuration::ReadResources(HMODULE module) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 155 size_t version_len = version_size / sizeof(wchar_t); | 171 size_t version_len = version_size / sizeof(wchar_t); |
| 156 | 172 |
| 157 // The string must be terminated. | 173 // The string must be terminated. |
| 158 if (version_string[version_len - 1]) | 174 if (version_string[version_len - 1]) |
| 159 return; | 175 return; |
| 160 | 176 |
| 161 previous_version_ = version_string; | 177 previous_version_ = version_string; |
| 162 } | 178 } |
| 163 | 179 |
| 164 } // namespace mini_installer | 180 } // namespace mini_installer |
| OLD | NEW |