Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: chrome/browser/chromeos/login/ui/webui_login_display.cc

Issue 693643004: Make UserActivityDetector a singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash45
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 7 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
10 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" 9 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h"
11 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 10 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
12 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 11 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
13 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 12 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
14 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/grit/chromium_strings.h" 15 #include "chrome/grit/chromium_strings.h"
17 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
(...skipping 10 matching lines...) Expand all
28 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 27 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
29 #endif 28 #endif
30 29
31 namespace chromeos { 30 namespace chromeos {
32 31
33 // WebUILoginDisplay, public: -------------------------------------------------- 32 // WebUILoginDisplay, public: --------------------------------------------------
34 33
35 WebUILoginDisplay::~WebUILoginDisplay() { 34 WebUILoginDisplay::~WebUILoginDisplay() {
36 if (webui_handler_) 35 if (webui_handler_)
37 webui_handler_->ResetSigninScreenHandlerDelegate(); 36 webui_handler_->ResetSigninScreenHandlerDelegate();
38 #if !defined(USE_ATHENA) 37 wm::UserActivityDetector* activity_detector = wm::UserActivityDetector::Get();
39 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()->
40 user_activity_detector();
41 if (activity_detector->HasObserver(this)) 38 if (activity_detector->HasObserver(this))
42 activity_detector->RemoveObserver(this); 39 activity_detector->RemoveObserver(this);
43 #endif
44 } 40 }
45 41
46 // LoginDisplay implementation: ------------------------------------------------ 42 // LoginDisplay implementation: ------------------------------------------------
47 43
48 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) 44 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate)
49 : LoginDisplay(delegate, gfx::Rect()), 45 : LoginDisplay(delegate, gfx::Rect()),
50 show_guest_(false), 46 show_guest_(false),
51 show_new_user_(false), 47 show_new_user_(false),
52 webui_handler_(NULL), 48 webui_handler_(NULL),
53 gaia_screen_(new GaiaScreen()), 49 gaia_screen_(new GaiaScreen()),
(...skipping 10 matching lines...) Expand all
64 bool show_users, 60 bool show_users,
65 bool show_new_user) { 61 bool show_new_user) {
66 // Testing that the delegate has been set. 62 // Testing that the delegate has been set.
67 DCHECK(delegate_); 63 DCHECK(delegate_);
68 64
69 user_selection_screen_->Init(users, show_guest); 65 user_selection_screen_->Init(users, show_guest);
70 show_guest_ = show_guest; 66 show_guest_ = show_guest;
71 show_users_ = show_users; 67 show_users_ = show_users;
72 show_new_user_ = show_new_user; 68 show_new_user_ = show_new_user;
73 69
74 #if !defined(USE_ATHENA) 70 wm::UserActivityDetector* activity_detector = wm::UserActivityDetector::Get();
75 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()->
76 user_activity_detector();
77 if (!activity_detector->HasObserver(this)) 71 if (!activity_detector->HasObserver(this))
78 activity_detector->AddObserver(this); 72 activity_detector->AddObserver(this);
79 #endif
80 } 73 }
81 74
82 // ---- Common methods 75 // ---- Common methods
83 76
84 // ---- User selection screen methods 77 // ---- User selection screen methods
85 78
86 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { 79 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) {
87 user_selection_screen_->OnBeforeUserRemoved(username); 80 user_selection_screen_->OnBeforeUserRemoved(username);
88 } 81 }
89 82
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 delegate_->Signout(); 351 delegate_->Signout();
359 } 352 }
360 353
361 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) { 354 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) {
362 if (delegate_) 355 if (delegate_)
363 delegate_->ResetPublicSessionAutoLoginTimer(); 356 delegate_->ResetPublicSessionAutoLoginTimer();
364 } 357 }
365 358
366 359
367 } // namespace chromeos 360 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698