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/chromeos/login/lock/screen_locker.h" | 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/chromeos/login/auth/authenticator.h" | 28 #include "chrome/browser/chromeos/login/auth/authenticator.h" |
29 #include "chrome/browser/chromeos/login/auth/extended_authenticator.h" | 29 #include "chrome/browser/chromeos/login/auth/extended_authenticator.h" |
30 #include "chrome/browser/chromeos/login/auth/login_performer.h" | 30 #include "chrome/browser/chromeos/login/auth/login_performer.h" |
31 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 31 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
32 #include "chrome/browser/chromeos/login/login_utils.h" | 32 #include "chrome/browser/chromeos/login/login_utils.h" |
33 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" | 33 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" |
34 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 34 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
35 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 35 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
36 #include "chrome/browser/chromeos/login/users/user_manager.h" | 36 #include "chrome/browser/chromeos/login/users/user_manager.h" |
37 #include "chrome/browser/lifetime/application_lifetime.h" | 37 #include "chrome/browser/lifetime/application_lifetime.h" |
38 #include "chrome/browser/profiles/profile.h" | |
39 #include "chrome/browser/profiles/profile_manager.h" | |
40 #include "chrome/browser/signin/signin_manager_factory.h" | 38 #include "chrome/browser/signin/signin_manager_factory.h" |
41 #include "chrome/browser/sync/profile_sync_service.h" | |
42 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
43 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h" | 39 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h" |
44 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h" | 40 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h" |
45 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
46 #include "chromeos/audio/chromeos_sounds.h" | 42 #include "chromeos/audio/chromeos_sounds.h" |
47 #include "chromeos/dbus/dbus_thread_manager.h" | 43 #include "chromeos/dbus/dbus_thread_manager.h" |
48 #include "chromeos/dbus/session_manager_client.h" | 44 #include "chromeos/dbus/session_manager_client.h" |
49 #include "components/signin/core/browser/signin_manager.h" | 45 #include "components/signin/core/browser/signin_manager.h" |
50 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
51 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
52 #include "content/public/browser/url_data_source.h" | 48 #include "content/public/browser/url_data_source.h" |
53 #include "content/public/browser/user_metrics.h" | 49 #include "content/public/browser/user_metrics.h" |
| 50 #include "content/public/browser/web_contents.h" |
| 51 #include "content/public/browser/web_ui.h" |
54 #include "grit/browser_resources.h" | 52 #include "grit/browser_resources.h" |
55 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
56 #include "media/audio/sounds/sounds_manager.h" | 54 #include "media/audio/sounds/sounds_manager.h" |
57 #include "ui/base/l10n/l10n_util.h" | 55 #include "ui/base/l10n/l10n_util.h" |
58 #include "ui/base/resource/resource_bundle.h" | 56 #include "ui/base/resource/resource_bundle.h" |
59 #include "ui/gfx/image/image.h" | 57 #include "ui/gfx/image/image.h" |
60 #include "url/gurl.h" | 58 #include "url/gurl.h" |
61 | 59 |
62 using base::UserMetricsAction; | 60 using base::UserMetricsAction; |
63 using content::BrowserThread; | 61 using content::BrowserThread; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 156 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
159 extended_authenticator_ = new ExtendedAuthenticator(this); | 157 extended_authenticator_ = new ExtendedAuthenticator(this); |
160 delegate_.reset(new WebUIScreenLocker(this)); | 158 delegate_.reset(new WebUIScreenLocker(this)); |
161 delegate_->LockScreen(); | 159 delegate_->LockScreen(); |
162 | 160 |
163 // Ownership of |icon_image_source| is passed. | 161 // Ownership of |icon_image_source| is passed. |
164 screenlock_icon_provider_.reset(new ScreenlockIconProvider); | 162 screenlock_icon_provider_.reset(new ScreenlockIconProvider); |
165 ScreenlockIconSource* screenlock_icon_source = | 163 ScreenlockIconSource* screenlock_icon_source = |
166 new ScreenlockIconSource(screenlock_icon_provider_->AsWeakPtr()); | 164 new ScreenlockIconSource(screenlock_icon_provider_->AsWeakPtr()); |
167 content::URLDataSource::Add( | 165 content::URLDataSource::Add( |
168 Profile::FromWebUI(GetAssociatedWebUI()), | 166 GetAssociatedWebUI()->GetWebContents()->GetBrowserContext(), |
169 screenlock_icon_source); | 167 screenlock_icon_source); |
170 } | 168 } |
171 | 169 |
172 void ScreenLocker::OnLoginFailure(const LoginFailure& error) { | 170 void ScreenLocker::OnLoginFailure(const LoginFailure& error) { |
173 content::RecordAction(UserMetricsAction("ScreenLocker_OnLoginFailure")); | 171 content::RecordAction(UserMetricsAction("ScreenLocker_OnLoginFailure")); |
174 if (authentication_start_time_.is_null()) { | 172 if (authentication_start_time_.is_null()) { |
175 LOG(ERROR) << "Start time is not set at authentication failure"; | 173 LOG(ERROR) << "Start time is not set at authentication failure"; |
176 } else { | 174 } else { |
177 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; | 175 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; |
178 VLOG(1) << "Authentication failure: " << delta.InSecondsF() << " second(s)"; | 176 VLOG(1) << "Authentication failure: " << delta.InSecondsF() << " second(s)"; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 486 |
489 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { | 487 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { |
490 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) { | 488 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) { |
491 if ((*it)->email() == username) | 489 if ((*it)->email() == username) |
492 return true; | 490 return true; |
493 } | 491 } |
494 return false; | 492 return false; |
495 } | 493 } |
496 | 494 |
497 } // namespace chromeos | 495 } // namespace chromeos |
OLD | NEW |