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/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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
394 return false; | 394 return false; |
395 | 395 |
396 if (!profile->IsSyncAccessible()) | |
397 return false; | |
398 | |
399 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && | 396 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && |
400 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) | 397 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) |
401 return false; | 398 return false; |
402 | 399 |
403 if (!SigninManager::AreSigninCookiesAllowed(profile)) | 400 if (!SigninManager::AreSigninCookiesAllowed(profile)) |
404 return false; | 401 return false; |
405 | 402 |
406 if (!email.empty()) { | 403 if (!email.empty()) { |
407 SigninManager* manager = | 404 SigninManager* manager = |
408 SigninManagerFactory::GetForProfile(profile); | 405 SigninManagerFactory::GetForProfile(profile); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 return DONT_OFFER; | 492 return DONT_OFFER; |
496 | 493 |
497 if (!SyncPromoUI::UseWebBasedSigninFlow()) | 494 if (!SyncPromoUI::UseWebBasedSigninFlow()) |
498 return DONT_OFFER; | 495 return DONT_OFFER; |
499 | 496 |
500 // 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 |
501 // members may not be initalized. | 498 // members may not be initalized. |
502 if (io_data->is_incognito()) | 499 if (io_data->is_incognito()) |
503 return DONT_OFFER; | 500 return DONT_OFFER; |
504 | 501 |
505 if (!browser_sync::SyncPrefs::IsSyncAccessibleOnIOThread(io_data)) | |
506 return DONT_OFFER; | |
507 | |
508 if (!io_data->reverse_autologin_enabled()->GetValue()) | 502 if (!io_data->reverse_autologin_enabled()->GetValue()) |
509 return DONT_OFFER; | 503 return DONT_OFFER; |
510 | 504 |
511 if (!io_data->google_services_username()->GetValue().empty()) | 505 if (!io_data->google_services_username()->GetValue().empty()) |
512 return DONT_OFFER; | 506 return DONT_OFFER; |
513 | 507 |
514 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) | 508 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) |
515 return DONT_OFFER; | 509 return DONT_OFFER; |
516 | 510 |
517 // The checks below depend on chrome already knowing what account the user | 511 // The checks below depend on chrome already knowing what account the user |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 break; | 945 break; |
952 } | 946 } |
953 } | 947 } |
954 | 948 |
955 RedirectToNTP(); | 949 RedirectToNTP(); |
956 } | 950 } |
957 | 951 |
958 void OneClickSigninHelper::SigninSuccess() { | 952 void OneClickSigninHelper::SigninSuccess() { |
959 RedirectToNTP(); | 953 RedirectToNTP(); |
960 } | 954 } |
OLD | NEW |