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

Side by Side Diff: chrome/browser/signin/signin_promo.cc

Issue 134733019: Add perf histogram and tests for inline signin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/signin/signin_promo.h" 5 #include "chrome/browser/signin/signin_promo.h"
6 6
7 #include "base/command_line.h"
7 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
8 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/first_run/first_run.h" 14 #include "chrome/browser/first_run/first_run.h"
14 #include "chrome/browser/google/google_util.h" 15 #include "chrome/browser/google/google_util.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_info_cache.h" 17 #include "chrome/browser/profiles/profile_info_cache.h"
17 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/signin/signin_manager.h" 19 #include "chrome/browser/signin/signin_manager.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 20 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/sync/profile_sync_service.h" 21 #include "chrome/browser/sync/profile_sync_service.h"
21 #include "chrome/browser/sync/profile_sync_service_factory.h" 22 #include "chrome/browser/sync/profile_sync_service_factory.h"
22 #include "chrome/browser/ui/webui/options/core_options_handler.h" 23 #include "chrome/browser/ui/webui/options/core_options_handler.h"
23 #include "chrome/browser/ui/webui/theme_source.h" 24 #include "chrome/browser/ui/webui/theme_source.h"
25 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/net/url_util.h" 26 #include "chrome/common/net/url_util.h"
25 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
26 #include "chrome/common/profile_management_switches.h" 28 #include "chrome/common/profile_management_switches.h"
27 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
28 #include "components/user_prefs/pref_registry_syncable.h" 30 #include "components/user_prefs/pref_registry_syncable.h"
29 #include "content/public/browser/url_data_source.h" 31 #include "content/public/browser/url_data_source.h"
30 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
31 #include "content/public/browser/web_ui.h" 33 #include "content/public/browser/web_ui.h"
32 #include "content/public/browser/web_ui_data_source.h" 34 #include "content/public/browser/web_ui_data_source.h"
33 #include "google_apis/gaia/gaia_urls.h" 35 #include "google_apis/gaia/gaia_urls.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #endif 113 #endif
112 } 114 }
113 115
114 bool ShouldShowPromoAtStartup(Profile* profile, bool is_new_profile) { 116 bool ShouldShowPromoAtStartup(Profile* profile, bool is_new_profile) {
115 DCHECK(profile); 117 DCHECK(profile);
116 118
117 // Don't show if the profile is an incognito. 119 // Don't show if the profile is an incognito.
118 if (profile->IsOffTheRecord()) 120 if (profile->IsOffTheRecord())
119 return false; 121 return false;
120 122
123 const CommandLine* command_line = CommandLine::ForCurrentProcess();
124 if (command_line->HasSwitch(switches::kForceSigninPromo))
125 return true;
126
121 if (!ShouldShowPromo(profile)) 127 if (!ShouldShowPromo(profile))
122 return false; 128 return false;
123 129
124 if (!is_new_profile) { 130 if (!is_new_profile) {
125 if (!HasShownPromoAtStartup(profile)) 131 if (!HasShownPromoAtStartup(profile))
126 return false; 132 return false;
127 } 133 }
128 134
129 if (HasUserSkippedPromo(profile)) 135 if (HasUserSkippedPromo(profile))
130 return false; 136 return false;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 prefs::kSignInPromoShowOnFirstRunAllowed, 280 prefs::kSignInPromoShowOnFirstRunAllowed,
275 true, 281 true,
276 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 282 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
277 registry->RegisterBooleanPref( 283 registry->RegisterBooleanPref(
278 prefs::kSignInPromoShowNTPBubble, 284 prefs::kSignInPromoShowNTPBubble,
279 false, 285 false,
280 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 286 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
281 } 287 }
282 288
283 } // namespace signin 289 } // namespace signin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698