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/browser/ui/webui/sync_promo/sync_promo_ui.h" | 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 return GetValueForKeyInQuery(url, kSyncPromoQueryKeySource, &value) ? | 288 return GetValueForKeyInQuery(url, kSyncPromoQueryKeySource, &value) ? |
289 value : std::string(); | 289 value : std::string(); |
290 } | 290 } |
291 | 291 |
292 // static | 292 // static |
293 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) { | 293 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) { |
294 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0; | 294 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0; |
295 } | 295 } |
296 | 296 |
297 // static | 297 // static |
298 int SyncPromoUI::GetSyncPromoVersion() { | 298 SyncPromoUI::Version SyncPromoUI::GetSyncPromoVersion() { |
299 int version = 0; | 299 int value = 0; |
300 if (base::StringToInt(CommandLine::ForCurrentProcess()-> | 300 if (base::StringToInt(CommandLine::ForCurrentProcess()-> |
301 GetSwitchValueASCII(switches::kSyncPromoVersion), &version)) { | 301 GetSwitchValueASCII(switches::kSyncPromoVersion), &value)) { |
302 return version; | 302 if (value >= VERSION_DEFAULT && value < VERSION_COUNT) |
Dan Beam
2012/01/30 18:10:05
convert to 1 if?
sail
2012/01/30 21:52:36
At 3 lines it's getting hard for me to follow
Dan Beam
2012/01/31 00:31:39
Fine.
| |
303 return static_cast<Version>(value); | |
303 } | 304 } |
305 | |
306 Version version; | |
304 if (sync_promo_trial::GetSyncPromoVersionForCurrentTrial(&version)) | 307 if (sync_promo_trial::GetSyncPromoVersionForCurrentTrial(&version)) |
305 return version; | 308 return version; |
306 // Default promo version is 0. | 309 |
307 return 0; | 310 return VERSION_DEFAULT; |
308 } | 311 } |
OLD | NEW |