| 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/util/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Tag the channel name if this is a multi-install. | 175 // Tag the channel name if this is a multi-install. |
| 176 if (add_multi_modifier && state.is_multi_install()) { | 176 if (add_multi_modifier && state.is_multi_install()) { |
| 177 if (!channel->empty()) | 177 if (!channel->empty()) |
| 178 channel->push_back(L'-'); | 178 channel->push_back(L'-'); |
| 179 channel->push_back(L'm'); | 179 channel->push_back(L'm'); |
| 180 } | 180 } |
| 181 | 181 |
| 182 return true; | 182 return true; |
| 183 } | 183 } |
| 184 | 184 |
| 185 #if defined(GOOGLE_CHROME_BUILD) |
| 185 // Populates |update_policy| with the UpdatePolicy enum value corresponding to a | 186 // Populates |update_policy| with the UpdatePolicy enum value corresponding to a |
| 186 // DWORD read from the registry and returns true if |value| is within range. | 187 // DWORD read from the registry and returns true if |value| is within range. |
| 187 // If |value| is out of range, returns false without modifying |update_policy|. | 188 // If |value| is out of range, returns false without modifying |update_policy|. |
| 188 bool GetUpdatePolicyFromDword( | 189 bool GetUpdatePolicyFromDword( |
| 189 const DWORD value, | 190 const DWORD value, |
| 190 GoogleUpdateSettings::UpdatePolicy* update_policy) { | 191 GoogleUpdateSettings::UpdatePolicy* update_policy) { |
| 191 switch (value) { | 192 switch (value) { |
| 192 case GoogleUpdateSettings::UPDATES_DISABLED: | 193 case GoogleUpdateSettings::UPDATES_DISABLED: |
| 193 case GoogleUpdateSettings::AUTOMATIC_UPDATES: | 194 case GoogleUpdateSettings::AUTOMATIC_UPDATES: |
| 194 case GoogleUpdateSettings::MANUAL_UPDATES_ONLY: | 195 case GoogleUpdateSettings::MANUAL_UPDATES_ONLY: |
| 195 case GoogleUpdateSettings::AUTO_UPDATES_ONLY: | 196 case GoogleUpdateSettings::AUTO_UPDATES_ONLY: |
| 196 *update_policy = static_cast<GoogleUpdateSettings::UpdatePolicy>(value); | 197 *update_policy = static_cast<GoogleUpdateSettings::UpdatePolicy>(value); |
| 197 return true; | 198 return true; |
| 198 default: | 199 default: |
| 199 LOG(WARNING) << "Unexpected update policy override value: " << value; | 200 LOG(WARNING) << "Unexpected update policy override value: " << value; |
| 200 } | 201 } |
| 201 return false; | 202 return false; |
| 202 } | 203 } |
| 204 #endif // defined(GOOGLE_CHROME_BUILD) |
| 203 | 205 |
| 204 // Convenience routine: GoogleUpdateSettings::UpdateDidRunStateForApp() | 206 // Convenience routine: GoogleUpdateSettings::UpdateDidRunStateForApp() |
| 205 // specialized for Chrome Binaries. | 207 // specialized for Chrome Binaries. |
| 206 bool UpdateDidRunStateForBinaries(bool did_run) { | 208 bool UpdateDidRunStateForBinaries(bool did_run) { |
| 207 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( | 209 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( |
| 208 BrowserDistribution::CHROME_BINARIES); | 210 BrowserDistribution::CHROME_BINARIES); |
| 209 return GoogleUpdateSettings::UpdateDidRunStateForApp( | 211 return GoogleUpdateSettings::UpdateDidRunStateForApp( |
| 210 dist->GetAppRegistrationData(), did_run); | 212 dist->GetAppRegistrationData(), did_run); |
| 211 } | 213 } |
| 212 | 214 |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 } | 970 } |
| 969 | 971 |
| 970 // If the key or value was not present, return the empty string. | 972 // If the key or value was not present, return the empty string. |
| 971 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { | 973 if (result == ERROR_FILE_NOT_FOUND || result == ERROR_PATH_NOT_FOUND) { |
| 972 experiment_labels->clear(); | 974 experiment_labels->clear(); |
| 973 return true; | 975 return true; |
| 974 } | 976 } |
| 975 | 977 |
| 976 return result == ERROR_SUCCESS; | 978 return result == ERROR_SUCCESS; |
| 977 } | 979 } |
| OLD | NEW |