| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signin/chrome_signin_client.h" | 5 #include "chrome/browser/signin/chrome_signin_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/content_settings/cookie_settings.h" | 12 #include "chrome/browser/content_settings/cookie_settings.h" |
| 13 #include "chrome/browser/first_run/first_run.h" |
| 12 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 14 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 13 #include "chrome/browser/signin/local_auth.h" | 15 #include "chrome/browser/signin/local_auth.h" |
| 14 #include "chrome/browser/webdata/web_data_service_factory.h" | 16 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 15 #include "chrome/common/chrome_version_info.h" | 17 #include "chrome/common/chrome_version_info.h" |
| 18 #include "components/metrics/metrics_service.h" |
| 16 #include "components/signin/core/common/profile_management_switches.h" | 19 #include "components/signin/core/common/profile_management_switches.h" |
| 17 #include "components/signin/core/common/signin_pref_names.h" | 20 #include "components/signin/core/common/signin_pref_names.h" |
| 18 #include "components/signin/core/common/signin_switches.h" | 21 #include "components/signin/core/common/signin_switches.h" |
| 19 #include "content/public/browser/notification_details.h" | 22 #include "content/public/browser/notification_details.h" |
| 20 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 22 #include "content/public/common/child_process_host.h" | 25 #include "content/public/common/child_process_host.h" |
| 23 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 24 | 27 |
| 25 #if defined(ENABLE_MANAGED_USERS) | 28 #if defined(ENABLE_MANAGED_USERS) |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 !switches::IsEnableAccountConsistency(); | 172 !switches::IsEnableAccountConsistency(); |
| 170 } | 173 } |
| 171 | 174 |
| 172 std::string ChromeSigninClient::GetProductVersion() { | 175 std::string ChromeSigninClient::GetProductVersion() { |
| 173 chrome::VersionInfo chrome_version; | 176 chrome::VersionInfo chrome_version; |
| 174 if (!chrome_version.is_valid()) | 177 if (!chrome_version.is_valid()) |
| 175 return "invalid"; | 178 return "invalid"; |
| 176 return chrome_version.CreateVersionString(); | 179 return chrome_version.CreateVersionString(); |
| 177 } | 180 } |
| 178 | 181 |
| 182 bool ChromeSigninClient::IsFirstRun() const { |
| 183 return first_run::IsChromeFirstRun(); |
| 184 } |
| 185 |
| 186 base::Time ChromeSigninClient::GetInstallDate() { |
| 187 return base::Time::FromTimeT( |
| 188 g_browser_process->metrics_service()->GetInstallDate()); |
| 189 } |
| 190 |
| 179 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> | 191 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> |
| 180 ChromeSigninClient::AddCookieChangedCallback( | 192 ChromeSigninClient::AddCookieChangedCallback( |
| 181 const CookieChangedCallback& callback) { | 193 const CookieChangedCallback& callback) { |
| 182 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> | 194 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> |
| 183 subscription = callbacks_.Add(callback); | 195 subscription = callbacks_.Add(callback); |
| 184 RegisterForCookieChangedNotification(); | 196 RegisterForCookieChangedNotification(); |
| 185 return subscription.Pass(); | 197 return subscription.Pass(); |
| 186 } | 198 } |
| 187 | 199 |
| 188 void ChromeSigninClient::GoogleSigninSucceeded(const std::string& username, | 200 void ChromeSigninClient::GoogleSigninSucceeded(const std::string& username, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (!callbacks_.empty()) | 236 if (!callbacks_.empty()) |
| 225 return; | 237 return; |
| 226 // Note that it's allowed to call this method multiple times without an | 238 // Note that it's allowed to call this method multiple times without an |
| 227 // intervening call to |RegisterForCookieChangedNotification()|. | 239 // intervening call to |RegisterForCookieChangedNotification()|. |
| 228 content::Source<Profile> source(profile_); | 240 content::Source<Profile> source(profile_); |
| 229 if (!registrar_.IsRegistered( | 241 if (!registrar_.IsRegistered( |
| 230 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) | 242 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) |
| 231 return; | 243 return; |
| 232 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); | 244 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); |
| 233 } | 245 } |
| OLD | NEW |