| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ui.h" | 5 #include "chrome/browser/ui/webui/sync_promo_ui.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 // This pref can be set in the master preferences file to allow or disallow | 182 // This pref can be set in the master preferences file to allow or disallow |
| 183 // showing the sync promo at startup. | 183 // showing the sync promo at startup. |
| 184 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed)) | 184 if (prefs->HasPrefPath(prefs::kSyncPromoShowOnFirstRunAllowed)) |
| 185 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed); | 185 return prefs->GetBoolean(prefs::kSyncPromoShowOnFirstRunAllowed); |
| 186 | 186 |
| 187 // For now don't show the promo for some brands. | 187 // For now don't show the promo for some brands. |
| 188 if (!AllowPromoAtStartupForCurrentBrand()) | 188 if (!AllowPromoAtStartupForCurrentBrand()) |
| 189 return false; | 189 return false; |
| 190 | 190 |
| 191 // Default to show the promo. | 191 return false; |
| 192 return true; | |
| 193 } | 192 } |
| 194 | 193 |
| 195 void SyncPromoUI::DidShowSyncPromoAtStartup(Profile* profile) { | 194 void SyncPromoUI::DidShowSyncPromoAtStartup(Profile* profile) { |
| 196 int show_count = profile->GetPrefs()->GetInteger( | 195 int show_count = profile->GetPrefs()->GetInteger( |
| 197 prefs::kSyncPromoStartupCount); | 196 prefs::kSyncPromoStartupCount); |
| 198 show_count++; | 197 show_count++; |
| 199 profile->GetPrefs()->SetInteger(prefs::kSyncPromoStartupCount, show_count); | 198 profile->GetPrefs()->SetInteger(prefs::kSyncPromoStartupCount, show_count); |
| 200 } | 199 } |
| 201 | 200 |
| 202 bool SyncPromoUI::HasUserSkippedSyncPromo(Profile* profile) { | 201 bool SyncPromoUI::HasUserSkippedSyncPromo(Profile* profile) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 UTF16ToUTF8(output.data(), output.length(), &url); | 241 UTF16ToUTF8(output.data(), output.length(), &url); |
| 243 return GURL(url); | 242 return GURL(url); |
| 244 } | 243 } |
| 245 return GURL(); | 244 return GURL(); |
| 246 } | 245 } |
| 247 | 246 |
| 248 // static | 247 // static |
| 249 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) { | 248 bool SyncPromoUI::UserHasSeenSyncPromoAtStartup(Profile* profile) { |
| 250 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0; | 249 return profile->GetPrefs()->GetInteger(prefs::kSyncPromoStartupCount) > 0; |
| 251 } | 250 } |
| OLD | NEW |