Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: chrome/installer/util/channel_info.cc

Issue 467303004: Make 64-bit Chrome stable report as CHANNEL_STABLE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. add tests. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/installer/util/channel_info_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/channel_info.h" 5 #include "chrome/installer/util/channel_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/win/registry.h" 8 #include "base/win/registry.h"
9 #include "chrome/installer/util/google_update_constants.h" 9 #include "chrome/installer/util/google_update_constants.h"
10 #include "chrome/installer/util/util_constants.h" 10 #include "chrome/installer/util/util_constants.h"
11 11
12 using base::win::RegKey; 12 using base::win::RegKey;
13 13
14 namespace { 14 namespace {
15 15
16 const wchar_t kModChrome[] = L"-chrome"; 16 const wchar_t kModChrome[] = L"-chrome";
17 const wchar_t kModChromeFrame[] = L"-chromeframe"; 17 const wchar_t kModChromeFrame[] = L"-chromeframe";
18 // TODO(huangs): Remove by M27. 18 // TODO(huangs): Remove by M27.
19 const wchar_t kModAppHostDeprecated[] = L"-apphost"; 19 const wchar_t kModAppHostDeprecated[] = L"-apphost";
20 const wchar_t kModAppLauncher[] = L"-applauncher"; 20 const wchar_t kModAppLauncher[] = L"-applauncher";
21 const wchar_t kModMultiInstall[] = L"-multi"; 21 const wchar_t kModMultiInstall[] = L"-multi";
22 const wchar_t kModReadyMode[] = L"-readymode"; 22 const wchar_t kModReadyMode[] = L"-readymode";
23 const wchar_t kModStage[] = L"-stage:"; 23 const wchar_t kModStage[] = L"-stage:";
24 const wchar_t kSfxFull[] = L"-full"; 24 const wchar_t kSfxFull[] = L"-full";
25 const wchar_t kSfxMigrating[] = L"-migrating"; 25 const wchar_t kSfxMigrating[] = L"-migrating";
26 const wchar_t kSfxMultiFail[] = L"-multifail"; 26 const wchar_t kSfxMultiFail[] = L"-multifail";
27 27
28 const wchar_t* const kChannels[] = { 28 const wchar_t* const kChannels[] = {
29 installer::kChromeChannelBeta, 29 installer::kChromeChannelBeta,
30 installer::kChromeChannelDev 30 installer::kChromeChannelDev,
31 installer::kChromeChannelStableExplicit
31 }; 32 };
32 33
33 const wchar_t* const kModifiers[] = { 34 const wchar_t* const kModifiers[] = {
34 kModStage, 35 kModStage,
35 kModMultiInstall, 36 kModMultiInstall,
36 kModChrome, 37 kModChrome,
37 kModChromeFrame, 38 kModChromeFrame,
38 kModAppHostDeprecated, // TODO(huangs): Remove by M27. 39 kModAppHostDeprecated, // TODO(huangs): Remove by M27.
39 kModAppLauncher, 40 kModAppLauncher,
40 kModReadyMode, 41 kModReadyMode,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool ChannelInfo::GetChannelName(std::wstring* channel_name) const { 162 bool ChannelInfo::GetChannelName(std::wstring* channel_name) const {
162 DCHECK(channel_name); 163 DCHECK(channel_name);
163 if (value_.empty()) { 164 if (value_.empty()) {
164 channel_name->erase(); 165 channel_name->erase();
165 return true; 166 return true;
166 } else { 167 } else {
167 for (const wchar_t* const* scan = &kChannels[0], 168 for (const wchar_t* const* scan = &kChannels[0],
168 *const* end = &kChannels[arraysize(kChannels)]; scan != end; 169 *const* end = &kChannels[arraysize(kChannels)]; scan != end;
169 ++scan) { 170 ++scan) {
170 if (value_.find(*scan) != std::wstring::npos) { 171 if (value_.find(*scan) != std::wstring::npos) {
171 channel_name->assign(*scan); 172 // Report channels with "stable" in them as stable (empty string).
173 if (*scan == installer::kChromeChannelStableExplicit)
174 channel_name->erase();
175 else
176 channel_name->assign(*scan);
172 return true; 177 return true;
173 } 178 }
174 } 179 }
175 // There may be modifiers present. Strip them off and see if we're left 180 // There may be modifiers present. Strip them off and see if we're left
176 // with the empty string (stable channel). 181 // with the empty string (stable channel).
177 std::wstring tmp_value = value_; 182 std::wstring tmp_value = value_;
178 for (int i = 0; i != NUM_MODIFIERS; ++i) { 183 for (int i = 0; i != NUM_MODIFIERS; ++i) {
179 SetModifier(static_cast<ModifierIndex>(i), false, &tmp_value); 184 SetModifier(static_cast<ModifierIndex>(i), false, &tmp_value);
180 } 185 }
181 if (tmp_value.empty()) { 186 if (tmp_value.empty()) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 302
298 for (int scan = 0; scan < NUM_MODIFIERS; ++scan) { 303 for (int scan = 0; scan < NUM_MODIFIERS; ++scan) {
299 ModifierIndex index = static_cast<ModifierIndex>(scan); 304 ModifierIndex index = static_cast<ModifierIndex>(scan);
300 modified = SetModifier(index, false, &value_) || modified; 305 modified = SetModifier(index, false, &value_) || modified;
301 } 306 }
302 307
303 return modified; 308 return modified;
304 } 309 }
305 310
306 } // namespace installer 311 } // namespace installer
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/util/channel_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698