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

Side by Side Diff: chrome/browser/ui/sync/sync_promo_ui.cc

Issue 18603006: Bookmark sync promo for Views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test for CrOS Created 7 years, 5 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
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/ui/sync/sync_promo_ui.h" 5 #include "chrome/browser/ui/sync/sync_promo_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #if defined(OS_CHROMEOS) 90 #if defined(OS_CHROMEOS)
91 // There's no need to show the sync promo on cros since cros users are logged 91 // There's no need to show the sync promo on cros since cros users are logged
92 // into sync already. 92 // into sync already.
93 return false; 93 return false;
94 #else 94 #else
95 95
96 // Don't bother if we don't have any kind of network connection. 96 // Don't bother if we don't have any kind of network connection.
97 if (net::NetworkChangeNotifier::IsOffline()) 97 if (net::NetworkChangeNotifier::IsOffline())
98 return false; 98 return false;
99 99
100 // Don't show if the profile is an incognito.
101 if (profile->IsOffTheRecord())
102 return false;
103
104 // Don't show for managed profiles. 100 // Don't show for managed profiles.
105 if (profile->GetPrefs()->GetBoolean(prefs::kProfileIsManaged)) 101 if (profile->GetPrefs()->GetBoolean(prefs::kProfileIsManaged))
106 return false; 102 return false;
107 103
108 // Display the signin promo if the user is not signed in. 104 // Display the signin promo if the user is not signed in.
109 SigninManager* signin = SigninManagerFactory::GetForProfile( 105 SigninManager* signin = SigninManagerFactory::GetForProfile(
110 profile->GetOriginalProfile()); 106 profile->GetOriginalProfile());
111 return !signin->AuthInProgress() && signin->IsSigninAllowed() && 107 return !signin->AuthInProgress() && signin->IsSigninAllowed() &&
112 signin->GetAuthenticatedUsername().empty(); 108 signin->GetAuthenticatedUsername().empty();
113 #endif 109 #endif
(...skipping 22 matching lines...) Expand all
136 prefs::kSyncPromoErrorMessage, 132 prefs::kSyncPromoErrorMessage,
137 std::string(), 133 std::string(),
138 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 134 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
139 } 135 }
140 136
141 // static 137 // static
142 bool SyncPromoUI::ShouldShowSyncPromoAtStartup(Profile* profile, 138 bool SyncPromoUI::ShouldShowSyncPromoAtStartup(Profile* profile,
143 bool is_new_profile) { 139 bool is_new_profile) {
144 DCHECK(profile); 140 DCHECK(profile);
145 141
142 // Don't show if the profile is an incognito.
143 if (profile->IsOffTheRecord())
144 return false;
145
146 if (!ShouldShowSyncPromo(profile)) 146 if (!ShouldShowSyncPromo(profile))
147 return false; 147 return false;
148 148
149 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 149 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
150 if (command_line.HasSwitch(switches::kNoFirstRun)) 150 if (command_line.HasSwitch(switches::kNoFirstRun))
151 is_new_profile = false; 151 is_new_profile = false;
152 152
153 if (!is_new_profile) { 153 if (!is_new_profile) {
154 if (!HasShownPromoAtStartup(profile)) 154 if (!HasShownPromoAtStartup(profile))
155 return false; 155 return false;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 replacements.ClearQuery(); 281 replacements.ClearQuery();
282 const std::string& locale = g_browser_process->GetApplicationLocale(); 282 const std::string& locale = g_browser_process->GetApplicationLocale();
283 return url.ReplaceComponents(replacements) == 283 return url.ReplaceComponents(replacements) ==
284 GURL(base::StringPrintf(kSyncLandingUrlPrefix, locale.c_str())); 284 GURL(base::StringPrintf(kSyncLandingUrlPrefix, locale.c_str()));
285 } 285 }
286 286
287 // static 287 // static
288 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { 288 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) {
289 g_force_web_based_signin_flow = force; 289 g_force_web_based_signin_flow = force;
290 } 290 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/sync_promo_ui.h ('k') | chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698