| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 *error_message_id = 0; | 388 *error_message_id = 0; |
| 389 | 389 |
| 390 if (!web_contents) | 390 if (!web_contents) |
| 391 return false; | 391 return false; |
| 392 | 392 |
| 393 if (web_contents->GetBrowserContext()->IsOffTheRecord()) | 393 if (web_contents->GetBrowserContext()->IsOffTheRecord()) |
| 394 return false; | 394 return false; |
| 395 | 395 |
| 396 Profile* profile = | 396 Profile* profile = |
| 397 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 397 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 398 if (!profile) | 398 if (!profile || !profile->IsSigninAllowed()) |
| 399 return false; | 399 return false; |
| 400 | 400 |
| 401 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && | 401 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && |
| 402 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) | 402 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) |
| 403 return false; | 403 return false; |
| 404 | 404 |
| 405 if (!SigninManager::AreSigninCookiesAllowed(profile)) | 405 if (!SigninManager::AreSigninCookiesAllowed(profile)) |
| 406 return false; | 406 return false; |
| 407 | 407 |
| 408 if (!email.empty()) { | 408 if (!email.empty()) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 return DONT_OFFER; | 497 return DONT_OFFER; |
| 498 | 498 |
| 499 if (!SyncPromoUI::UseWebBasedSigninFlow()) | 499 if (!SyncPromoUI::UseWebBasedSigninFlow()) |
| 500 return DONT_OFFER; | 500 return DONT_OFFER; |
| 501 | 501 |
| 502 // Check for incognito before other parts of the io_data, since those | 502 // Check for incognito before other parts of the io_data, since those |
| 503 // members may not be initalized. | 503 // members may not be initalized. |
| 504 if (io_data->is_incognito()) | 504 if (io_data->is_incognito()) |
| 505 return DONT_OFFER; | 505 return DONT_OFFER; |
| 506 | 506 |
| 507 if (!SigninManager::IsSigninAllowedOnIOThread(io_data)) |
| 508 return DONT_OFFER; |
| 509 |
| 507 if (!io_data->reverse_autologin_enabled()->GetValue()) | 510 if (!io_data->reverse_autologin_enabled()->GetValue()) |
| 508 return DONT_OFFER; | 511 return DONT_OFFER; |
| 509 | 512 |
| 510 if (!io_data->google_services_username()->GetValue().empty()) | 513 if (!io_data->google_services_username()->GetValue().empty()) |
| 511 return DONT_OFFER; | 514 return DONT_OFFER; |
| 512 | 515 |
| 513 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) | 516 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) |
| 514 return DONT_OFFER; | 517 return DONT_OFFER; |
| 515 | 518 |
| 516 // The checks below depend on chrome already knowing what account the user | 519 // The checks below depend on chrome already knowing what account the user |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 break; | 960 break; |
| 958 } | 961 } |
| 959 } | 962 } |
| 960 | 963 |
| 961 RedirectToNTP(); | 964 RedirectToNTP(); |
| 962 } | 965 } |
| 963 | 966 |
| 964 void OneClickSigninHelper::SigninSuccess() { | 967 void OneClickSigninHelper::SigninSuccess() { |
| 965 RedirectToNTP(); | 968 RedirectToNTP(); |
| 966 } | 969 } |
| OLD | NEW |