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

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

Issue 12088040: Add a SigninAllowed policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Some bugfixes. Created 7 years, 10 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 (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/sync/one_click_signin_helper.h" 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 *error_message_id = 0; 383 *error_message_id = 0;
384 384
385 if (!web_contents) 385 if (!web_contents)
386 return false; 386 return false;
387 387
388 if (web_contents->GetBrowserContext()->IsOffTheRecord()) 388 if (web_contents->GetBrowserContext()->IsOffTheRecord())
389 return false; 389 return false;
390 390
391 Profile* profile = 391 Profile* profile =
392 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 392 Profile::FromBrowserContext(web_contents->GetBrowserContext());
393 if (!profile) 393 if (!profile || !profile->IsSigninAllowed())
394 return false; 394 return false;
395 395
396 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && 396 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY &&
397 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) 397 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled))
398 return false; 398 return false;
399 399
400 if (!SigninManager::AreSigninCookiesAllowed(profile)) 400 if (!SigninManager::AreSigninCookiesAllowed(profile))
401 return false; 401 return false;
402 402
403 if (!email.empty()) { 403 if (!email.empty()) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 return DONT_OFFER; 492 return DONT_OFFER;
493 493
494 if (!SyncPromoUI::UseWebBasedSigninFlow()) 494 if (!SyncPromoUI::UseWebBasedSigninFlow())
495 return DONT_OFFER; 495 return DONT_OFFER;
496 496
497 // Check for incognito before other parts of the io_data, since those 497 // Check for incognito before other parts of the io_data, since those
498 // members may not be initalized. 498 // members may not be initalized.
499 if (io_data->is_incognito()) 499 if (io_data->is_incognito())
500 return DONT_OFFER; 500 return DONT_OFFER;
501 501
502 if (!SigninManager::IsSigninAllowedOnIOThread(io_data))
503 return DONT_OFFER;
504
502 if (!io_data->reverse_autologin_enabled()->GetValue()) 505 if (!io_data->reverse_autologin_enabled()->GetValue())
503 return DONT_OFFER; 506 return DONT_OFFER;
504 507
505 if (!io_data->google_services_username()->GetValue().empty()) 508 if (!io_data->google_services_username()->GetValue().empty())
506 return DONT_OFFER; 509 return DONT_OFFER;
507 510
508 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) 511 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings()))
509 return DONT_OFFER; 512 return DONT_OFFER;
510 513
511 // The checks below depend on chrome already knowing what account the user 514 // The checks below depend on chrome already knowing what account the user
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 break; 948 break;
946 } 949 }
947 } 950 }
948 951
949 RedirectToNTP(); 952 RedirectToNTP();
950 } 953 }
951 954
952 void OneClickSigninHelper::SigninSuccess() { 955 void OneClickSigninHelper::SigninSuccess() {
953 RedirectToNTP(); 956 RedirectToNTP();
954 } 957 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698