Home | History | Annotate | Download | only in signin
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/signin/chrome_signin_manager_delegate.h"
      6 
      7 #include "chrome/browser/content_settings/cookie_settings.h"
      8 #include "url/gurl.h"
      9 
     10 namespace {
     11 
     12 const char kGoogleAccountsUrl[] = "https://accounts.google.com";
     13 
     14 }  // namespace
     15 
     16 ChromeSigninManagerDelegate::ChromeSigninManagerDelegate(Profile* profile)
     17     : profile_(profile) {
     18 }
     19 
     20 ChromeSigninManagerDelegate::~ChromeSigninManagerDelegate() {
     21 }
     22 
     23 // static
     24 bool ChromeSigninManagerDelegate::ProfileAllowsSigninCookies(Profile* profile) {
     25   CookieSettings* cookie_settings =
     26       CookieSettings::Factory::GetForProfile(profile).get();
     27   return SettingsAllowSigninCookies(cookie_settings);
     28 }
     29 
     30 // static
     31 bool ChromeSigninManagerDelegate::SettingsAllowSigninCookies(
     32     CookieSettings* cookie_settings) {
     33   return cookie_settings &&
     34       cookie_settings->IsSettingCookieAllowed(GURL(kGoogleAccountsUrl),
     35                                               GURL(kGoogleAccountsUrl));
     36 }
     37 
     38 
     39 bool ChromeSigninManagerDelegate::AreSigninCookiesAllowed() {
     40   return ProfileAllowsSigninCookies(profile_);
     41 }
     42