| 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" |
| 12 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 13 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 13 #include "chrome/browser/signin/local_auth.h" | 14 #include "chrome/browser/signin/local_auth.h" |
| 14 #include "chrome/browser/webdata/web_data_service_factory.h" | 15 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 15 #include "chrome/common/chrome_version_info.h" | 16 #include "chrome/common/chrome_version_info.h" |
| 17 #include "components/metrics/metrics_service.h" |
| 16 #include "components/signin/core/common/profile_management_switches.h" | 18 #include "components/signin/core/common/profile_management_switches.h" |
| 17 #include "components/signin/core/common/signin_pref_names.h" | 19 #include "components/signin/core/common/signin_pref_names.h" |
| 18 #include "components/signin/core/common/signin_switches.h" | 20 #include "components/signin/core/common/signin_switches.h" |
| 19 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
| 20 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
| 22 #include "content/public/common/child_process_host.h" | 24 #include "content/public/common/child_process_host.h" |
| 23 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 24 | 26 |
| 25 #if defined(ENABLE_MANAGED_USERS) | 27 #if defined(ENABLE_MANAGED_USERS) |
| 26 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 28 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 27 #endif | 29 #endif |
| 28 | 30 |
| 29 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 30 #include "components/user_manager/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
| 31 #endif | 33 #endif |
| 32 | 34 |
| 35 #if !defined(OS_ANDROID) |
| 36 #include "chrome/browser/first_run/first_run.h" |
| 37 #endif |
| 38 |
| 33 using content::ChildProcessHost; | 39 using content::ChildProcessHost; |
| 34 using content::RenderProcessHost; | 40 using content::RenderProcessHost; |
| 35 | 41 |
| 36 namespace { | 42 namespace { |
| 37 | 43 |
| 38 const char kGoogleAccountsUrl[] = "https://accounts.google.com"; | 44 const char kGoogleAccountsUrl[] = "https://accounts.google.com"; |
| 39 | 45 |
| 40 } // namespace | 46 } // namespace |
| 41 | 47 |
| 42 ChromeSigninClient::ChromeSigninClient(Profile* profile) | 48 ChromeSigninClient::ChromeSigninClient(Profile* profile) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 !switches::IsEnableAccountConsistency(); | 175 !switches::IsEnableAccountConsistency(); |
| 170 } | 176 } |
| 171 | 177 |
| 172 std::string ChromeSigninClient::GetProductVersion() { | 178 std::string ChromeSigninClient::GetProductVersion() { |
| 173 chrome::VersionInfo chrome_version; | 179 chrome::VersionInfo chrome_version; |
| 174 if (!chrome_version.is_valid()) | 180 if (!chrome_version.is_valid()) |
| 175 return "invalid"; | 181 return "invalid"; |
| 176 return chrome_version.CreateVersionString(); | 182 return chrome_version.CreateVersionString(); |
| 177 } | 183 } |
| 178 | 184 |
| 185 bool ChromeSigninClient::IsFirstRun() const { |
| 186 #if defined(OS_ANDROID) |
| 187 return false; |
| 188 #else |
| 189 return first_run::IsChromeFirstRun(); |
| 190 #endif |
| 191 } |
| 192 |
| 193 base::Time ChromeSigninClient::GetInstallDate() { |
| 194 return base::Time::FromTimeT( |
| 195 g_browser_process->metrics_service()->GetInstallDate()); |
| 196 } |
| 197 |
| 179 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> | 198 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> |
| 180 ChromeSigninClient::AddCookieChangedCallback( | 199 ChromeSigninClient::AddCookieChangedCallback( |
| 181 const CookieChangedCallback& callback) { | 200 const CookieChangedCallback& callback) { |
| 182 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> | 201 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> |
| 183 subscription = callbacks_.Add(callback); | 202 subscription = callbacks_.Add(callback); |
| 184 RegisterForCookieChangedNotification(); | 203 RegisterForCookieChangedNotification(); |
| 185 return subscription.Pass(); | 204 return subscription.Pass(); |
| 186 } | 205 } |
| 187 | 206 |
| 188 void ChromeSigninClient::GoogleSigninSucceeded(const std::string& username, | 207 void ChromeSigninClient::GoogleSigninSucceeded(const std::string& username, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (!callbacks_.empty()) | 243 if (!callbacks_.empty()) |
| 225 return; | 244 return; |
| 226 // Note that it's allowed to call this method multiple times without an | 245 // Note that it's allowed to call this method multiple times without an |
| 227 // intervening call to |RegisterForCookieChangedNotification()|. | 246 // intervening call to |RegisterForCookieChangedNotification()|. |
| 228 content::Source<Profile> source(profile_); | 247 content::Source<Profile> source(profile_); |
| 229 if (!registrar_.IsRegistered( | 248 if (!registrar_.IsRegistered( |
| 230 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) | 249 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) |
| 231 return; | 250 return; |
| 232 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); | 251 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); |
| 233 } | 252 } |
| OLD | NEW |