| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_DOM_LOGIN_DISPLAY_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_DOM_LOGIN_DISPLAY_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/memory/singleton.h" | |
| 12 #include "base/scoped_ptr.h" | |
| 13 #include "chrome/browser/chromeos/login/login_display.h" | |
| 14 #include "chrome/browser/chromeos/login/user_manager.h" | |
| 15 #include "chrome/browser/chromeos/login/webui_login_view.h" | |
| 16 #include "chrome/browser/ui/webui/chromeos/login/login_ui.h" | |
| 17 | |
| 18 namespace gfx { | |
| 19 class Rect; | |
| 20 } // namespace gfx | |
| 21 | |
| 22 namespace chromeos { | |
| 23 | |
| 24 class DOMBrowser; | |
| 25 | |
| 26 // DOM-based login UI implementation. | |
| 27 // This class is a Singleton. It allows the LoginDisplayHost and LoginUIHandler | |
| 28 // to access it without having to be coupled with each other. It is created with | |
| 29 // NULL for the delegate and a 0-size rectangle for the background | |
| 30 // bounds. Before use these values should be set to a sane value. When done with | |
| 31 // the object, the ExistingUserController should call Destroy and not free the | |
| 32 // pointer, where as accessing classes should do nothing with the pointer. | |
| 33 // | |
| 34 // Expected order of commands to setup for LoginDisplayHost: | |
| 35 // DOMLoginDisplay::GetInstance(); | |
| 36 // set_delegate(delegate); | |
| 37 // set_background_bounds(background_bounds()); | |
| 38 // Init(); | |
| 39 // | |
| 40 // Expected order of commands to setup for LoginUIHandler: | |
| 41 // DOMLoginDisplay::GetInstance(); | |
| 42 // set_login_handler(this); | |
| 43 | |
| 44 class DOMLoginDisplay : public LoginDisplay, | |
| 45 public LoginUIHandlerDelegate { | |
| 46 public: | |
| 47 virtual ~DOMLoginDisplay(); | |
| 48 | |
| 49 // Singleton implementation: | |
| 50 static DOMLoginDisplay* GetInstance(); | |
| 51 | |
| 52 // Wrapper used to help in routing keyboard key presses into the login | |
| 53 // screen. This gets the Login Window widget from the Singleton, so that other | |
| 54 // classes don't need to know we are a Singleton | |
| 55 static views::Widget* GetLoginWindow(); | |
| 56 views::Widget* LoginWindow(); | |
| 57 | |
| 58 // LoginDisplay implementation: | |
| 59 virtual void Destroy() OVERRIDE; | |
| 60 virtual void Init(const std::vector<UserManager::User>& users, | |
| 61 bool show_guest, | |
| 62 bool show_new_user) OVERRIDE; | |
| 63 virtual void OnBeforeUserRemoved(const std::string& username) OVERRIDE; | |
| 64 virtual void OnUserImageChanged(UserManager::User* user) OVERRIDE; | |
| 65 virtual void OnUserRemoved(const std::string& username) OVERRIDE; | |
| 66 virtual void OnFadeOut() OVERRIDE; | |
| 67 virtual void SetUIEnabled(bool is_enabled) OVERRIDE; | |
| 68 virtual void ShowError(int error_msg_id, | |
| 69 int login_attempts, | |
| 70 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | |
| 71 | |
| 72 // LoginUIHandlerDelegate | |
| 73 virtual void Login(const std::string& username, | |
| 74 const std::string& password) OVERRIDE; | |
| 75 virtual void LoginAsGuest() OVERRIDE; | |
| 76 | |
| 77 private: | |
| 78 // Singleton implementation: | |
| 79 friend struct DefaultSingletonTraits<DOMLoginDisplay>; | |
| 80 DOMLoginDisplay(); | |
| 81 | |
| 82 // Set of Users in the systemvisible UserControllers. | |
| 83 std::vector<UserManager::User> users_; | |
| 84 | |
| 85 // Container of the screen we are displaying | |
| 86 WebUILoginView* webui_login_view_; // Owned by webui_login_window_ | |
| 87 views::Widget* webui_login_window_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(DOMLoginDisplay); | |
| 90 }; | |
| 91 | |
| 92 } // namespace chromeos | |
| 93 | |
| 94 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_DOM_LOGIN_DISPLAY_H_ | |
| OLD | NEW |