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/common/platform_util.h" | 5 #include "chrome/common/platform_util.h" |
6 | 6 |
7 #include <commdlg.h> | 7 #include <commdlg.h> |
8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 std::wstring update_branch; | 180 std::wstring update_branch; |
181 if (registry_hive != 0) { | 181 if (registry_hive != 0) { |
182 // Now that we know which hive to use, read the 'ap' key from it. | 182 // Now that we know which hive to use, read the 'ap' key from it. |
183 std::wstring key = google_update::kRegPathClientState + | 183 std::wstring key = google_update::kRegPathClientState + |
184 std::wstring(L"\\") + google_update::kChromeUpgradeCode; | 184 std::wstring(L"\\") + google_update::kChromeUpgradeCode; |
185 RegKey client_state(registry_hive, key.c_str(), KEY_READ); | 185 RegKey client_state(registry_hive, key.c_str(), KEY_READ); |
186 client_state.ReadValue(google_update::kRegApField, &update_branch); | 186 client_state.ReadValue(google_update::kRegApField, &update_branch); |
| 187 // If the parent folder exists (we have a valid install) but the |
| 188 // 'ap' key is empty, we necessarily are the stable channel. |
| 189 if (update_branch.empty() && client_state.Valid()) { |
| 190 update_branch = L"stable"; |
| 191 } |
187 } | 192 } |
188 | 193 |
189 // Map to something pithy for human consumption. There are no rules as to | 194 // Map to something pithy for human consumption. There are no rules as to |
190 // what the ap string can contain, but generally it will contain a number | 195 // what the ap string can contain, but generally it will contain a number |
191 // followed by a dash followed by the branch name (and then some random | 196 // followed by a dash followed by the branch name (and then some random |
192 // suffix). We fall back on empty string, in case we fail to parse (or the | 197 // suffix). We fall back on empty string in case we fail to parse. |
193 // branch is stable). | |
194 if (update_branch.find(L"-beta") != std::wstring::npos) | 198 if (update_branch.find(L"-beta") != std::wstring::npos) |
195 update_branch = L"beta"; | 199 update_branch = L"beta"; |
196 else if (update_branch.find(L"-dev") != std::wstring::npos) | 200 else if (update_branch.find(L"-dev") != std::wstring::npos) |
197 update_branch = L"dev"; | 201 update_branch = L"dev"; |
| 202 else if (update_branch.find(L"stable") != std::wstring::npos) |
| 203 update_branch = L"stable"; |
198 else | 204 else |
199 update_branch = L""; | 205 update_branch = L""; |
200 | 206 |
201 return update_branch; | 207 return update_branch; |
202 } | 208 } |
203 | 209 |
204 } // namespace | 210 } // namespace |
205 | 211 |
206 string16 GetVersionStringModifier() { | 212 string16 GetVersionStringModifier() { |
207 #if defined(GOOGLE_CHROME_BUILD) | 213 #if defined(GOOGLE_CHROME_BUILD) |
208 return CurrentChromeChannel(); | 214 return CurrentChromeChannel(); |
209 #else | 215 #else |
210 return string16(); | 216 return string16(); |
211 #endif | 217 #endif |
212 } | 218 } |
213 | 219 |
214 } // namespace platform_util | 220 } // namespace platform_util |
OLD | NEW |