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