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

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

Issue 2073323002: Change the value separator for stats default param. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « chrome/installer/util/channel_info.h ('k') | 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/win/registry.h" 13 #include "base/win/registry.h"
14 #include "chrome/installer/util/google_update_constants.h" 14 #include "chrome/installer/util/google_update_constants.h"
15 #include "chrome/installer/util/util_constants.h" 15 #include "chrome/installer/util/util_constants.h"
16 16
17 using base::win::RegKey; 17 using base::win::RegKey;
18 18
19 namespace { 19 namespace {
20 20
21 const wchar_t kModChrome[] = L"-chrome"; 21 const wchar_t kModChrome[] = L"-chrome";
22 const wchar_t kModChromeFrame[] = L"-chromeframe"; 22 const wchar_t kModChromeFrame[] = L"-chromeframe";
23 const wchar_t kModAppHostDeprecated[] = L"-apphost"; 23 const wchar_t kModAppHostDeprecated[] = L"-apphost";
24 const wchar_t kModAppLauncherDeprecated[] = L"-applauncher"; 24 const wchar_t kModAppLauncherDeprecated[] = L"-applauncher";
25 const wchar_t kModMultiInstall[] = L"-multi"; 25 const wchar_t kModMultiInstall[] = L"-multi";
26 const wchar_t kModReadyMode[] = L"-readymode"; 26 const wchar_t kModReadyMode[] = L"-readymode";
27 const wchar_t kModStage[] = L"-stage:"; 27 const wchar_t kModStage[] = L"-stage:";
28 const wchar_t kModStatsDefault[] = L"-statsdef:"; 28 const wchar_t kModStatsDefault[] = L"-statsdef=";
29 const wchar_t kSfxFull[] = L"-full"; 29 const wchar_t kSfxFull[] = L"-full";
30 const wchar_t kSfxMigrating[] = L"-migrating"; 30 const wchar_t kSfxMigrating[] = L"-migrating";
31 const wchar_t kSfxMultiFail[] = L"-multifail"; 31 const wchar_t kSfxMultiFail[] = L"-multifail";
32 32
33 const wchar_t* const kModifiers[] = { 33 const wchar_t* const kModifiers[] = {
34 kModStatsDefault, 34 kModStatsDefault,
35 kModStage, 35 kModStage,
36 kModMultiInstall, 36 kModMultiInstall,
37 kModChrome, 37 kModChrome,
38 kModChromeFrame, 38 kModChromeFrame,
(...skipping 27 matching lines...) Expand all
66 // location at which the modifier was found. The number of characters in the 66 // location at which the modifier was found. The number of characters in the
67 // modifier is returned in |length|, if non-NULL. 67 // modifier is returned in |length|, if non-NULL.
68 bool FindModifier(ModifierIndex index, 68 bool FindModifier(ModifierIndex index,
69 const base::string16& ap_value, 69 const base::string16& ap_value,
70 base::string16::size_type* position, 70 base::string16::size_type* position,
71 base::string16::size_type* length) { 71 base::string16::size_type* length) {
72 DCHECK(position != NULL); 72 DCHECK(position != NULL);
73 base::string16::size_type mod_position = base::string16::npos; 73 base::string16::size_type mod_position = base::string16::npos;
74 base::string16::size_type mod_length = 74 base::string16::size_type mod_length =
75 base::string16::traits_type::length(kModifiers[index]); 75 base::string16::traits_type::length(kModifiers[index]);
76 const bool mod_takes_arg = (kModifiers[index][mod_length - 1] == L':'); 76 char last_char = kModifiers[index][mod_length - 1];
77 const bool mod_takes_arg = (last_char == L':' || last_char == L'=');
77 base::string16::size_type pos = 0; 78 base::string16::size_type pos = 0;
78 do { 79 do {
79 mod_position = ap_value.find(kModifiers[index], pos, mod_length); 80 mod_position = ap_value.find(kModifiers[index], pos, mod_length);
80 if (mod_position == base::string16::npos) 81 if (mod_position == base::string16::npos)
81 return false; // Modifier not found. 82 return false; // Modifier not found.
82 pos = mod_position + mod_length; 83 pos = mod_position + mod_length;
83 // Modifiers that take an argument gobble up to the next separator or to the 84 // Modifiers that take an argument gobble up to the next separator or to the
84 // end. 85 // end.
85 if (mod_takes_arg) { 86 if (mod_takes_arg) {
86 pos = ap_value.find(L'-', pos); 87 pos = ap_value.find(L'-', pos);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 359
359 for (int scan = 0; scan < NUM_MODIFIERS; ++scan) { 360 for (int scan = 0; scan < NUM_MODIFIERS; ++scan) {
360 ModifierIndex index = static_cast<ModifierIndex>(scan); 361 ModifierIndex index = static_cast<ModifierIndex>(scan);
361 modified = SetModifier(index, false, &value_) || modified; 362 modified = SetModifier(index, false, &value_) || modified;
362 } 363 }
363 364
364 return modified; 365 return modified;
365 } 366 }
366 367
367 } // namespace installer 368 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/channel_info.h ('k') | chrome/installer/util/channel_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698