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/ui/webui_login_display.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
10 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" | 10 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
26 #include "ui/wm/core/user_activity_detector.h" | 26 #include "ui/wm/core/user_activity_detector.h" |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 | 29 |
30 // WebUILoginDisplay, public: -------------------------------------------------- | 30 // WebUILoginDisplay, public: -------------------------------------------------- |
31 | 31 |
32 WebUILoginDisplay::~WebUILoginDisplay() { | 32 WebUILoginDisplay::~WebUILoginDisplay() { |
33 if (webui_handler_) | 33 if (webui_handler_) |
34 webui_handler_->ResetSigninScreenHandlerDelegate(); | 34 webui_handler_->ResetSigninScreenHandlerDelegate(); |
35 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> | 35 if (ash::Shell::HasInstance()) { |
| 36 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> |
36 user_activity_detector(); | 37 user_activity_detector(); |
37 if (activity_detector->HasObserver(this)) | 38 if (activity_detector->HasObserver(this)) |
38 activity_detector->RemoveObserver(this); | 39 activity_detector->RemoveObserver(this); |
| 40 } |
39 } | 41 } |
40 | 42 |
41 // LoginDisplay implementation: ------------------------------------------------ | 43 // LoginDisplay implementation: ------------------------------------------------ |
42 | 44 |
43 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) | 45 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) |
44 : LoginDisplay(delegate, gfx::Rect()), | 46 : LoginDisplay(delegate, gfx::Rect()), |
45 show_guest_(false), | 47 show_guest_(false), |
46 show_new_user_(false), | 48 show_new_user_(false), |
47 webui_handler_(NULL), | 49 webui_handler_(NULL), |
48 gaia_screen_(new GaiaScreen()), | 50 gaia_screen_(new GaiaScreen()), |
(...skipping 10 matching lines...) Expand all Loading... |
59 bool show_users, | 61 bool show_users, |
60 bool show_new_user) { | 62 bool show_new_user) { |
61 // Testing that the delegate has been set. | 63 // Testing that the delegate has been set. |
62 DCHECK(delegate_); | 64 DCHECK(delegate_); |
63 | 65 |
64 user_selection_screen_->Init(users, show_guest); | 66 user_selection_screen_->Init(users, show_guest); |
65 show_guest_ = show_guest; | 67 show_guest_ = show_guest; |
66 show_users_ = show_users; | 68 show_users_ = show_users; |
67 show_new_user_ = show_new_user; | 69 show_new_user_ = show_new_user; |
68 | 70 |
69 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> | 71 if (ash::Shell::HasInstance()) { |
70 user_activity_detector(); | 72 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> |
71 if (!activity_detector->HasObserver(this)) | 73 user_activity_detector(); |
72 activity_detector->AddObserver(this); | 74 if (!activity_detector->HasObserver(this)) |
| 75 activity_detector->AddObserver(this); |
| 76 } |
73 } | 77 } |
74 | 78 |
75 // ---- Common methods | 79 // ---- Common methods |
76 | 80 |
77 // ---- User selection screen methods | 81 // ---- User selection screen methods |
78 | 82 |
79 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { | 83 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { |
80 user_selection_screen_->OnBeforeUserRemoved(username); | 84 user_selection_screen_->OnBeforeUserRemoved(username); |
81 } | 85 } |
82 | 86 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 delegate_->Signout(); | 351 delegate_->Signout(); |
348 } | 352 } |
349 | 353 |
350 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) { | 354 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) { |
351 if (delegate_) | 355 if (delegate_) |
352 delegate_->ResetPublicSessionAutoLoginTimer(); | 356 delegate_->ResetPublicSessionAutoLoginTimer(); |
353 } | 357 } |
354 | 358 |
355 | 359 |
356 } // namespace chromeos | 360 } // namespace chromeos |
OLD | NEW |