| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 return false; | 383 return false; |
| 384 | 384 |
| 385 if (web_contents->GetBrowserContext()->IsOffTheRecord()) | 385 if (web_contents->GetBrowserContext()->IsOffTheRecord()) |
| 386 return false; | 386 return false; |
| 387 | 387 |
| 388 Profile* profile = | 388 Profile* profile = |
| 389 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 389 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 390 if (!profile) | 390 if (!profile) |
| 391 return false; | 391 return false; |
| 392 | 392 |
| 393 if (!profile->IsSyncAccessible()) | |
| 394 return false; | |
| 395 | |
| 396 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && | 393 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && |
| 397 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) | 394 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) |
| 398 return false; | 395 return false; |
| 399 | 396 |
| 400 if (!SigninManager::AreSigninCookiesAllowed(profile)) | 397 if (!SigninManager::AreSigninCookiesAllowed(profile)) |
| 401 return false; | 398 return false; |
| 402 | 399 |
| 403 if (!email.empty()) { | 400 if (!email.empty()) { |
| 404 SigninManager* manager = | 401 SigninManager* manager = |
| 405 SigninManagerFactory::GetForProfile(profile); | 402 SigninManagerFactory::GetForProfile(profile); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 return DONT_OFFER; | 489 return DONT_OFFER; |
| 493 | 490 |
| 494 if (!SyncPromoUI::UseWebBasedSigninFlow()) | 491 if (!SyncPromoUI::UseWebBasedSigninFlow()) |
| 495 return DONT_OFFER; | 492 return DONT_OFFER; |
| 496 | 493 |
| 497 // Check for incognito before other parts of the io_data, since those | 494 // Check for incognito before other parts of the io_data, since those |
| 498 // members may not be initalized. | 495 // members may not be initalized. |
| 499 if (io_data->is_incognito()) | 496 if (io_data->is_incognito()) |
| 500 return DONT_OFFER; | 497 return DONT_OFFER; |
| 501 | 498 |
| 502 if (!browser_sync::SyncPrefs::IsSyncAccessibleOnIOThread(io_data)) | |
| 503 return DONT_OFFER; | |
| 504 | |
| 505 if (!io_data->reverse_autologin_enabled()->GetValue()) | 499 if (!io_data->reverse_autologin_enabled()->GetValue()) |
| 506 return DONT_OFFER; | 500 return DONT_OFFER; |
| 507 | 501 |
| 508 if (!io_data->google_services_username()->GetValue().empty()) | 502 if (!io_data->google_services_username()->GetValue().empty()) |
| 509 return DONT_OFFER; | 503 return DONT_OFFER; |
| 510 | 504 |
| 511 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) | 505 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) |
| 512 return DONT_OFFER; | 506 return DONT_OFFER; |
| 513 | 507 |
| 514 // The checks below depend on chrome already knowing what account the user | 508 // The checks below depend on chrome already knowing what account the user |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 break; | 927 break; |
| 934 } | 928 } |
| 935 } | 929 } |
| 936 | 930 |
| 937 RedirectToNTP(); | 931 RedirectToNTP(); |
| 938 } | 932 } |
| 939 | 933 |
| 940 void OneClickSigninHelper::SigninSuccess() { | 934 void OneClickSigninHelper::SigninSuccess() { |
| 941 RedirectToNTP(); | 935 RedirectToNTP(); |
| 942 } | 936 } |
| OLD | NEW |