| 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 #include <Windowsx.h> | 5 #include <Windowsx.h> |
| 6 | 6 |
| 7 #include "base/registry.h" | 7 #include "base/registry.h" |
| 8 | 8 |
| 9 #include "Resource.h" | 9 #include "Resource.h" |
| 10 | 10 |
| 11 // This enum needs to be in sync with the strings below. | 11 // This enum needs to be in sync with the strings below. |
| 12 enum Branch { | 12 enum Branch { |
| 13 UNKNOWN_BRANCH = 0, | 13 UNKNOWN_BRANCH = 0, |
| 14 DEV_BRANCH, | 14 DEV_BRANCH, |
| 15 OLD_DEV_BRANCH, |
| 15 BETA_BRANCH, | 16 BETA_BRANCH, |
| 16 STABLE_BRANCH, | 17 STABLE_BRANCH, |
| 17 }; | 18 }; |
| 18 | 19 |
| 19 // This vector of strings needs to be in sync with the Branch enum above. | 20 // This vector of strings needs to be in sync with the Branch enum above. |
| 20 static const wchar_t* const kBranchStrings[] = { | 21 static const wchar_t* const kBranchStrings[] = { |
| 21 L"?", | 22 L"?", |
| 23 L"2.0-dev", |
| 22 L"1.1-dev", | 24 L"1.1-dev", |
| 23 L"1.1-beta", | 25 L"1.1-beta", |
| 24 L"", | 26 L"", |
| 25 }; | 27 }; |
| 26 | 28 |
| 27 // This vector of strings needs to be in sync with the Branch enum above. | 29 // This vector of strings needs to be in sync with the Branch enum above. |
| 28 static const wchar_t* const kBranchStringsReadable[] = { | 30 static const wchar_t* const kBranchStringsReadable[] = { |
| 29 L"?", | 31 L"?", |
| 30 L"Dev", | 32 L"Dev", |
| 33 L"Beta (was Dev)", |
| 31 L"Beta", | 34 L"Beta", |
| 32 L"Stable", | 35 L"Stable", |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 // The Registry Hive to write to. Points to the hive where we found the 'ap' key | 38 // The Registry Hive to write to. Points to the hive where we found the 'ap' key |
| 36 // unless there is an error, in which case it is 0. | 39 // unless there is an error, in which case it is 0. |
| 37 HKEY registry_hive = 0; | 40 HKEY registry_hive = 0; |
| 38 | 41 |
| 39 // The value of the 'ap' key under the registry hive specified in | 42 // The value of the 'ap' key under the registry hive specified in |
| 40 // |registry_hive|. | 43 // |registry_hive|. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // '-full' to the channel name, which we need to strip out to determine what | 102 // '-full' to the channel name, which we need to strip out to determine what |
| 100 // channel you are on. | 103 // channel you are on. |
| 101 std::wstring suffix = kChannelSuffix; | 104 std::wstring suffix = kChannelSuffix; |
| 102 if (update_branch.length() > suffix.length()) { | 105 if (update_branch.length() > suffix.length()) { |
| 103 size_t index = update_branch.rfind(suffix); | 106 size_t index = update_branch.rfind(suffix); |
| 104 if (index != std::wstring::npos && | 107 if (index != std::wstring::npos && |
| 105 index == update_branch.length() - suffix.length()) { | 108 index == update_branch.length() - suffix.length()) { |
| 106 update_branch = update_branch.substr(0, index); | 109 update_branch = update_branch.substr(0, index); |
| 107 } | 110 } |
| 108 } | 111 } |
| 112 // The 1.1-dev channel has been deprecated and all users have been |
| 113 // logically moved to the Beta channel. If we find that token, we |
| 114 // just declare the user on the Beta channel. |
| 115 if (update_branch == kBranchStrings[OLD_DEV_BRANCH]) |
| 116 update_branch = kBranchStrings[BETA_BRANCH]; |
| 109 } | 117 } |
| 110 } | 118 } |
| 111 | 119 |
| 112 void SetMainLabel(HWND dialog, Branch branch) { | 120 void SetMainLabel(HWND dialog, Branch branch) { |
| 113 std::wstring main_label = L"You are currently on "; | 121 std::wstring main_label = L"You are currently on "; |
| 114 if (branch == DEV_BRANCH || branch == BETA_BRANCH || branch == STABLE_BRANCH) | 122 if (branch == DEV_BRANCH || branch == BETA_BRANCH || branch == STABLE_BRANCH) |
| 115 main_label += std::wstring(L"the ") + kBranchStringsReadable[branch] + | 123 main_label += std::wstring(L"the ") + kBranchStringsReadable[branch] + |
| 116 std::wstring(L" channel"); | 124 std::wstring(L" channel"); |
| 117 else | 125 else |
| 118 main_label += L"NO UPDATE CHANNEL"; | 126 main_label += L"NO UPDATE CHANNEL"; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 393 |
| 386 dlg_icon = ::LoadIcon(instance, MAKEINTRESOURCE(IDI_BRANCH_SWITCHER)); | 394 dlg_icon = ::LoadIcon(instance, MAKEINTRESOURCE(IDI_BRANCH_SWITCHER)); |
| 387 | 395 |
| 388 ::DialogBox(instance, | 396 ::DialogBox(instance, |
| 389 MAKEINTRESOURCE(IDD_MAIN_DIALOG), | 397 MAKEINTRESOURCE(IDD_MAIN_DIALOG), |
| 390 ::GetDesktopWindow(), | 398 ::GetDesktopWindow(), |
| 391 DialogWndProc); | 399 DialogWndProc); |
| 392 | 400 |
| 393 return TRUE; | 401 return TRUE; |
| 394 } | 402 } |
| OLD | NEW |