| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/signin_screen_controller.h" | 5 #include "chrome/browser/chromeos/login/signin_screen_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 9 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 9 #include "chrome/browser/chromeos/login/lock/webui_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" |
| 11 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 11 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
| 12 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 12 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 SignInScreenController* SignInScreenController::instance_ = nullptr; | 17 SignInScreenController* SignInScreenController::instance_ = nullptr; |
| 18 | 18 |
| 19 SignInScreenController::SignInScreenController( | 19 SignInScreenController::SignInScreenController( |
| 20 OobeUI* oobe_ui, | 20 OobeUI* oobe_ui, |
| 21 LoginDisplay::Delegate* login_display_delegate) | 21 LoginDisplay::Delegate* login_display_delegate) |
| 22 : oobe_ui_(oobe_ui), gaia_screen_(new GaiaScreen()) { | 22 : oobe_ui_(oobe_ui), gaia_screen_(new GaiaScreen()) { |
| 23 DCHECK(!instance_); | 23 DCHECK(!instance_); |
| 24 instance_ = this; | 24 instance_ = this; |
| 25 | 25 |
| 26 gaia_screen_->SetScreenHandler(oobe_ui_->GetGaiaScreenView()); | 26 gaia_screen_->set_view(oobe_ui_->GetGaiaScreenView()); |
| 27 std::string display_type = oobe_ui->display_type(); | 27 std::string display_type = oobe_ui->display_type(); |
| 28 user_selection_screen_.reset(new ChromeUserSelectionScreen(display_type)); | 28 user_selection_screen_.reset(new ChromeUserSelectionScreen(display_type)); |
| 29 user_selection_screen_->SetLoginDisplayDelegate(login_display_delegate); | 29 user_selection_screen_->SetLoginDisplayDelegate(login_display_delegate); |
| 30 | 30 |
| 31 user_board_view_ = oobe_ui_->GetUserBoardView()->GetWeakPtr(); | 31 user_board_view_ = oobe_ui_->GetUserBoardView()->GetWeakPtr(); |
| 32 user_selection_screen_->SetView(user_board_view_.get()); | 32 user_selection_screen_->SetView(user_board_view_.get()); |
| 33 // TODO(jdufault): Bind and Unbind should be controlled by either the | 33 // TODO(jdufault): Bind and Unbind should be controlled by either the |
| 34 // Model/View which are then each responsible for automatically unbinding the | 34 // Model/View which are then each responsible for automatically unbinding the |
| 35 // other associated View/Model instance. Then we can eliminate this exposed | 35 // other associated View/Model instance. Then we can eliminate this exposed |
| 36 // WeakPtr logic. See crbug.com/685287. | 36 // WeakPtr logic. See crbug.com/685287. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 user_selection_screen_->HandleGetUsers(); | 84 user_selection_screen_->HandleGetUsers(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SignInScreenController::CheckUserStatus(const AccountId& account_id) { | 87 void SignInScreenController::CheckUserStatus(const AccountId& account_id) { |
| 88 user_selection_screen_->CheckUserStatus(account_id); | 88 user_selection_screen_->CheckUserStatus(account_id); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SignInScreenController::SetWebUIHandler( | 91 void SignInScreenController::SetWebUIHandler( |
| 92 LoginDisplayWebUIHandler* webui_handler) { | 92 LoginDisplayWebUIHandler* webui_handler) { |
| 93 webui_handler_ = webui_handler; | 93 webui_handler_ = webui_handler; |
| 94 gaia_screen_->SetLegacyHandler(webui_handler_); | |
| 95 user_selection_screen_->SetHandler(webui_handler_); | 94 user_selection_screen_->SetHandler(webui_handler_); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void SignInScreenController::Observe( | 97 void SignInScreenController::Observe( |
| 99 int type, | 98 int type, |
| 100 const content::NotificationSource& source, | 99 const content::NotificationSource& source, |
| 101 const content::NotificationDetails& details) { | 100 const content::NotificationDetails& details) { |
| 102 DCHECK_EQ(chrome::NOTIFICATION_SESSION_STARTED, type); | 101 DCHECK_EQ(chrome::NOTIFICATION_SESSION_STARTED, type); |
| 103 | 102 |
| 104 // Stop listening to any notification once session has started. | 103 // Stop listening to any notification once session has started. |
| 105 // Sign in screen objects are marked for deletion with DeleteSoon so | 104 // Sign in screen objects are marked for deletion with DeleteSoon so |
| 106 // make sure no object would be used after session has started. | 105 // make sure no object would be used after session has started. |
| 107 // http://crbug.com/125276 | 106 // http://crbug.com/125276 |
| 108 registrar_.RemoveAll(); | 107 registrar_.RemoveAll(); |
| 109 user_manager::UserManager::Get()->RemoveObserver(this); | 108 user_manager::UserManager::Get()->RemoveObserver(this); |
| 110 } | 109 } |
| 111 | 110 |
| 112 } // namespace chromeos | 111 } // namespace chromeos |
| OLD | NEW |