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/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/content_settings/cookie_settings.h" | 11 #include "chrome/browser/content_settings/cookie_settings.h" |
12 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 12 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
13 #include "chrome/browser/signin/local_auth.h" | 13 #include "chrome/browser/signin/local_auth.h" |
14 #include "chrome/browser/webdata/web_data_service_factory.h" | 14 #include "chrome/browser/webdata/web_data_service_factory.h" |
15 #include "chrome/common/chrome_version_info.h" | 15 #include "chrome/common/chrome_version_info.h" |
16 #include "components/signin/core/common/profile_management_switches.h" | 16 #include "components/signin/core/common/profile_management_switches.h" |
17 #include "components/signin/core/common/signin_pref_names.h" | 17 #include "components/signin/core/common/signin_pref_names.h" |
18 #include "components/signin/core/common/signin_switches.h" | 18 #include "components/signin/core/common/signin_switches.h" |
19 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
21 #include "content/public/browser/render_process_host.h" | 21 #include "content/public/browser/render_process_host.h" |
22 #include "content/public/common/child_process_host.h" | 22 #include "content/public/common/child_process_host.h" |
23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
24 | 24 |
25 #if defined(ENABLE_MANAGED_USERS) | 25 #if defined(ENABLE_MANAGED_USERS) |
26 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 26 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
27 #endif | 27 #endif |
28 | 28 |
29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
30 #include "chrome/browser/chromeos/login/users/user_manager.h" | 30 #include "components/user_manager/user_manager.h" |
31 #endif | 31 #endif |
32 | 32 |
33 using content::ChildProcessHost; | 33 using content::ChildProcessHost; |
34 using content::RenderProcessHost; | 34 using content::RenderProcessHost; |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 const char kGoogleAccountsUrl[] = "https://accounts.google.com"; | 38 const char kGoogleAccountsUrl[] = "https://accounts.google.com"; |
39 | 39 |
40 } // namespace | 40 } // namespace |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 PrefService* ChromeSigninClient::GetPrefs() { return profile_->GetPrefs(); } | 109 PrefService* ChromeSigninClient::GetPrefs() { return profile_->GetPrefs(); } |
110 | 110 |
111 scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() { | 111 scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() { |
112 return WebDataServiceFactory::GetTokenWebDataForProfile( | 112 return WebDataServiceFactory::GetTokenWebDataForProfile( |
113 profile_, Profile::EXPLICIT_ACCESS); | 113 profile_, Profile::EXPLICIT_ACCESS); |
114 } | 114 } |
115 | 115 |
116 bool ChromeSigninClient::CanRevokeCredentials() { | 116 bool ChromeSigninClient::CanRevokeCredentials() { |
117 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
118 // UserManager may not exist in unit_tests. | 118 // UserManager may not exist in unit_tests. |
119 if (chromeos::UserManager::IsInitialized() && | 119 if (user_manager::UserManager::IsInitialized() && |
120 chromeos::UserManager::Get()->IsLoggedInAsSupervisedUser()) { | 120 user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
121 // Don't allow revoking credentials for Chrome OS supervised users. | 121 // Don't allow revoking credentials for Chrome OS supervised users. |
122 // See http://crbug.com/332032 | 122 // See http://crbug.com/332032 |
123 LOG(ERROR) << "Attempt to revoke supervised user refresh " | 123 LOG(ERROR) << "Attempt to revoke supervised user refresh " |
124 << "token detected, ignoring."; | 124 << "token detected, ignoring."; |
125 return false; | 125 return false; |
126 } | 126 } |
127 #else | 127 #else |
128 // Don't allow revoking credentials for supervised users. | 128 // Don't allow revoking credentials for supervised users. |
129 // See http://crbug.com/332032 | 129 // See http://crbug.com/332032 |
130 if (profile_->IsSupervised()) { | 130 if (profile_->IsSupervised()) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if (!callbacks_.empty()) | 224 if (!callbacks_.empty()) |
225 return; | 225 return; |
226 // Note that it's allowed to call this method multiple times without an | 226 // Note that it's allowed to call this method multiple times without an |
227 // intervening call to |RegisterForCookieChangedNotification()|. | 227 // intervening call to |RegisterForCookieChangedNotification()|. |
228 content::Source<Profile> source(profile_); | 228 content::Source<Profile> source(profile_); |
229 if (!registrar_.IsRegistered( | 229 if (!registrar_.IsRegistered( |
230 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) | 230 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) |
231 return; | 231 return; |
232 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); | 232 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); |
233 } | 233 } |
OLD | NEW |