OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/util/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 bool GoogleUpdateSettings::GetChromeChannel(bool system_install, | 159 bool GoogleUpdateSettings::GetChromeChannel(bool system_install, |
160 std::wstring* channel) { | 160 std::wstring* channel) { |
161 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 161 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
162 if (dist->GetChromeChannel(channel)) | 162 if (dist->GetChromeChannel(channel)) |
163 return true; | 163 return true; |
164 | 164 |
165 HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 165 HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
166 std::wstring reg_path = dist->GetStateKey(); | 166 std::wstring reg_path = dist->GetStateKey(); |
167 RegKey key(root_key, reg_path.c_str(), KEY_READ); | 167 RegKey key(root_key, reg_path.c_str(), KEY_READ); |
168 installer::ChannelInfo channel_info; | 168 installer_util::ChannelInfo channel_info; |
169 if (!channel_info.Initialize(key)) { | 169 if (!channel_info.Initialize(key)) { |
170 *channel = L"unknown"; | 170 *channel = L"unknown"; |
171 return false; | 171 return false; |
172 } | 172 } |
173 | 173 |
174 if (!channel_info.GetChannelName(channel)) | 174 if (!channel_info.GetChannelName(channel)) |
175 *channel = L"unknown"; | 175 *channel = L"unknown"; |
176 | 176 |
177 // Tag the channel name if this is a multi-install product. | 177 // Tag the channel name if this is a multi-install product. |
178 if (channel_info.IsMultiInstall()) { | 178 if (channel_info.IsMultiInstall()) { |
179 if (!channel->empty()) | 179 if (!channel->empty()) |
180 channel->append(1, L'-'); | 180 channel->append(1, L'-'); |
181 channel->append(1, L'm'); | 181 channel->append(1, L'm'); |
182 } | 182 } |
183 | 183 |
184 return true; | 184 return true; |
185 } | 185 } |
186 | 186 |
187 void GoogleUpdateSettings::UpdateDiffInstallStatus(bool system_install, | 187 void GoogleUpdateSettings::UpdateDiffInstallStatus(bool system_install, |
188 bool incremental_install, int install_return_code, | 188 bool incremental_install, int install_return_code, |
189 const std::wstring& product_guid) { | 189 const std::wstring& product_guid) { |
190 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 190 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
191 | 191 |
192 RegKey key; | 192 RegKey key; |
193 installer::ChannelInfo channel_info; | 193 installer_util::ChannelInfo channel_info; |
194 std::wstring reg_key(google_update::kRegPathClientState); | 194 std::wstring reg_key(google_update::kRegPathClientState); |
195 reg_key.append(L"\\"); | 195 reg_key.append(L"\\"); |
196 reg_key.append(product_guid); | 196 reg_key.append(product_guid); |
197 if (!key.Open(reg_root, reg_key.c_str(), KEY_ALL_ACCESS) || | 197 if (!key.Open(reg_root, reg_key.c_str(), KEY_ALL_ACCESS) || |
198 !channel_info.Initialize(key)) { | 198 !channel_info.Initialize(key)) { |
199 VLOG(1) << "Application key not found."; | 199 VLOG(1) << "Application key not found."; |
200 if (!incremental_install || !install_return_code) { | 200 if (!incremental_install || !install_return_code) { |
201 VLOG(1) << "Returning without changing application key."; | 201 VLOG(1) << "Returning without changing application key."; |
202 key.Close(); | 202 key.Close(); |
203 return; | 203 return; |
(...skipping 12 matching lines...) Expand all Loading... |
216 &channel_info) && | 216 &channel_info) && |
217 !channel_info.Write(&key)) { | 217 !channel_info.Write(&key)) { |
218 LOG(ERROR) << "Failed to write value " << channel_info.value() | 218 LOG(ERROR) << "Failed to write value " << channel_info.value() |
219 << " to the registry field " << google_update::kRegApField; | 219 << " to the registry field " << google_update::kRegApField; |
220 } | 220 } |
221 key.Close(); | 221 key.Close(); |
222 } | 222 } |
223 | 223 |
224 bool GoogleUpdateSettings::UpdateGoogleUpdateApKey( | 224 bool GoogleUpdateSettings::UpdateGoogleUpdateApKey( |
225 bool diff_install, int install_return_code, | 225 bool diff_install, int install_return_code, |
226 installer::ChannelInfo* value) { | 226 installer_util::ChannelInfo* value) { |
227 if (!diff_install || !install_return_code) { | 227 if (!diff_install || !install_return_code) { |
228 if (value->SetFullInstall(false)) { | 228 if (value->SetFullInstall(false)) { |
229 VLOG(1) << "Removed incremental installer failure key; new value: " | 229 VLOG(1) << "Removed incremental installer failure key; new value: " |
230 << value->value(); | 230 << value->value(); |
231 return true; | 231 return true; |
232 } | 232 } |
233 } else if (diff_install && install_return_code) { | 233 } else if (diff_install && install_return_code) { |
234 if (value->SetFullInstall(true)) { | 234 if (value->SetFullInstall(true)) { |
235 VLOG(1) << "Incremental installer failed, setting failure key; " | 235 VLOG(1) << "Incremental installer failed, setting failure key; " |
236 "new value: " | 236 "new value: " |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 }; | 285 }; |
286 const wchar_t** end = &kBrands[arraysize(kBrands)]; | 286 const wchar_t** end = &kBrands[arraysize(kBrands)]; |
287 const wchar_t** found = std::find(&kBrands[0], end, brand); | 287 const wchar_t** found = std::find(&kBrands[0], end, brand); |
288 if (found != end) | 288 if (found != end) |
289 return true; | 289 return true; |
290 if (StartsWith(brand, L"EUB", true) || StartsWith(brand, L"EUC", true) || | 290 if (StartsWith(brand, L"EUB", true) || StartsWith(brand, L"EUC", true) || |
291 StartsWith(brand, L"GGR", true)) | 291 StartsWith(brand, L"GGR", true)) |
292 return true; | 292 return true; |
293 return false; | 293 return false; |
294 } | 294 } |
OLD | NEW |