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

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

Issue 14367029: Introduce SigninManagerDelegate and use to eliminate CookieSettings dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR Created 7 years, 7 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
« no previous file with comments | « chrome/browser/signin/signin_manager_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/defaults.h" 25 #include "chrome/browser/defaults.h"
26 #include "chrome/browser/google/google_util.h" 26 #include "chrome/browser/google/google_util.h"
27 #include "chrome/browser/infobars/infobar_service.h" 27 #include "chrome/browser/infobars/infobar_service.h"
28 #include "chrome/browser/prefs/scoped_user_pref_update.h" 28 #include "chrome/browser/prefs/scoped_user_pref_update.h"
29 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/profiles/profile_info_cache.h" 30 #include "chrome/browser/profiles/profile_info_cache.h"
31 #include "chrome/browser/profiles/profile_io_data.h" 31 #include "chrome/browser/profiles/profile_io_data.h"
32 #include "chrome/browser/profiles/profile_manager.h" 32 #include "chrome/browser/profiles/profile_manager.h"
33 #include "chrome/browser/search/search.h" 33 #include "chrome/browser/search/search.h"
34 #include "chrome/browser/signin/chrome_signin_manager_delegate.h"
34 #include "chrome/browser/signin/signin_manager.h" 35 #include "chrome/browser/signin/signin_manager.h"
36 #include "chrome/browser/signin/signin_manager_delegate.h"
35 #include "chrome/browser/signin/signin_manager_factory.h" 37 #include "chrome/browser/signin/signin_manager_factory.h"
36 #include "chrome/browser/signin/signin_names_io_thread.h" 38 #include "chrome/browser/signin/signin_names_io_thread.h"
37 #include "chrome/browser/sync/profile_sync_service.h" 39 #include "chrome/browser/sync/profile_sync_service.h"
38 #include "chrome/browser/sync/profile_sync_service_factory.h" 40 #include "chrome/browser/sync/profile_sync_service_factory.h"
39 #include "chrome/browser/sync/sync_prefs.h" 41 #include "chrome/browser/sync/sync_prefs.h"
40 #include "chrome/browser/tab_contents/tab_util.h" 42 #include "chrome/browser/tab_contents/tab_util.h"
41 #include "chrome/browser/ui/browser_finder.h" 43 #include "chrome/browser/ui/browser_finder.h"
42 #include "chrome/browser/ui/browser_window.h" 44 #include "chrome/browser/ui/browser_window.h"
43 #include "chrome/browser/ui/chrome_pages.h" 45 #include "chrome/browser/ui/chrome_pages.h"
44 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" 46 #include "chrome/browser/ui/sync/one_click_signin_histogram.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 479
478 SigninManager* manager = 480 SigninManager* manager =
479 SigninManagerFactory::GetForProfile(profile); 481 SigninManagerFactory::GetForProfile(profile);
480 if (manager && !manager->IsSigninAllowed()) 482 if (manager && !manager->IsSigninAllowed())
481 return false; 483 return false;
482 484
483 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && 485 if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY &&
484 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) 486 !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled))
485 return false; 487 return false;
486 488
487 if (!SigninManager::AreSigninCookiesAllowed(profile)) 489 if (!ChromeSigninManagerDelegate::ProfileAllowsSigninCookies(profile))
488 return false; 490 return false;
489 491
490 if (!email.empty()) { 492 if (!email.empty()) {
491 if (!manager) 493 if (!manager)
492 return false; 494 return false;
493 495
494 // If the signin manager already has an authenticated name, then this is a 496 // If the signin manager already has an authenticated name, then this is a
495 // re-auth scenario. Make sure the email just signed in corresponds to the 497 // re-auth scenario. Make sure the email just signed in corresponds to the
496 // the one sign in manager expects. 498 // the one sign in manager expects.
497 std::string current_email = manager->GetAuthenticatedUsername(); 499 std::string current_email = manager->GetAuthenticatedUsername();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 603
602 if (!SigninManager::IsSigninAllowedOnIOThread(io_data)) 604 if (!SigninManager::IsSigninAllowedOnIOThread(io_data))
603 return DONT_OFFER; 605 return DONT_OFFER;
604 606
605 if (!io_data->reverse_autologin_enabled()->GetValue()) 607 if (!io_data->reverse_autologin_enabled()->GetValue())
606 return DONT_OFFER; 608 return DONT_OFFER;
607 609
608 if (!io_data->google_services_username()->GetValue().empty()) 610 if (!io_data->google_services_username()->GetValue().empty())
609 return DONT_OFFER; 611 return DONT_OFFER;
610 612
611 if (!SigninManager::AreSigninCookiesAllowed(io_data->GetCookieSettings())) 613 if (!ChromeSigninManagerDelegate::SettingsAllowSigninCookies(
614 io_data->GetCookieSettings()))
612 return DONT_OFFER; 615 return DONT_OFFER;
613 616
614 // The checks below depend on chrome already knowing what account the user 617 // The checks below depend on chrome already knowing what account the user
615 // signed in with. This happens only after receiving the response containing 618 // signed in with. This happens only after receiving the response containing
616 // the Google-Accounts-SignIn header. Until then, if there is even a chance 619 // the Google-Accounts-SignIn header. Until then, if there is even a chance
617 // that we want to connect the profile, chrome needs to tell Gaia that 620 // that we want to connect the profile, chrome needs to tell Gaia that
618 // it should offer the interstitial. Therefore missing one click data on 621 // it should offer the interstitial. Therefore missing one click data on
619 // the request means can offer is true. 622 // the request means can offer is true.
620 const std::string& pending_email = io_data->reverse_autologin_pending_email(); 623 const std::string& pending_email = io_data->reverse_autologin_pending_email();
621 if (!pending_email.empty()) { 624 if (!pending_email.empty()) {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 } 1257 }
1255 } 1258 }
1256 ShowSyncConfirmationBubble(display_bubble); 1259 ShowSyncConfirmationBubble(display_bubble);
1257 signin_tracker_.reset(); 1260 signin_tracker_.reset();
1258 } 1261 }
1259 1262
1260 void OneClickSigninHelper::SigninSuccess() { 1263 void OneClickSigninHelper::SigninSuccess() {
1261 ShowSyncConfirmationBubble(true); 1264 ShowSyncConfirmationBubble(true);
1262 signin_tracker_.reset(); 1265 signin_tracker_.reset();
1263 } 1266 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_manager_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698