| 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/screens/chrome_user_selection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace chromeos { | 34 namespace chromeos { |
| 35 | 35 |
| 36 ChromeUserSelectionScreen::ChromeUserSelectionScreen( | 36 ChromeUserSelectionScreen::ChromeUserSelectionScreen( |
| 37 const std::string& display_type) | 37 const std::string& display_type) |
| 38 : UserSelectionScreen(display_type), | 38 : UserSelectionScreen(display_type), |
| 39 handler_initialized_(false), | 39 handler_initialized_(false), |
| 40 weak_factory_(this) { | 40 weak_factory_(this) { |
| 41 device_local_account_policy_service_ = g_browser_process->platform_part()-> | 41 device_local_account_policy_service_ = g_browser_process->platform_part()-> |
| 42 browser_policy_connector_chromeos()->GetDeviceLocalAccountPolicyService(); | 42 browser_policy_connector_chromeos()->GetDeviceLocalAccountPolicyService(); |
| 43 device_local_account_policy_service_->AddObserver(this); | 43 if (device_local_account_policy_service_) { |
| 44 device_local_account_policy_service_->AddObserver(this); |
| 45 } |
| 44 } | 46 } |
| 45 | 47 |
| 46 ChromeUserSelectionScreen::~ChromeUserSelectionScreen() { | 48 ChromeUserSelectionScreen::~ChromeUserSelectionScreen() { |
| 47 device_local_account_policy_service_->RemoveObserver(this); | 49 if (device_local_account_policy_service_) { |
| 50 device_local_account_policy_service_->RemoveObserver(this); |
| 51 } |
| 48 } | 52 } |
| 49 | 53 |
| 50 void ChromeUserSelectionScreen::Init(const user_manager::UserList& users, | 54 void ChromeUserSelectionScreen::Init(const user_manager::UserList& users, |
| 51 bool show_guest) { | 55 bool show_guest) { |
| 52 UserSelectionScreen::Init(users, show_guest); | 56 UserSelectionScreen::Init(users, show_guest); |
| 53 | 57 |
| 54 // Retrieve the current policy for all users. | 58 // Retrieve the current policy for all users. |
| 55 for (user_manager::UserList::const_iterator it = users.begin(); | 59 for (user_manager::UserList::const_iterator it = users.begin(); |
| 56 it != users.end(); ++it) { | 60 it != users.end(); ++it) { |
| 57 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 61 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // advanced form (two or more recommended locales). | 188 // advanced form (two or more recommended locales). |
| 185 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; | 189 const bool two_or_more_recommended_locales = recommended_locales.size() >= 2; |
| 186 | 190 |
| 187 // Notify the UI. | 191 // Notify the UI. |
| 188 view_->SetPublicSessionLocales(account_id, std::move(available_locales), | 192 view_->SetPublicSessionLocales(account_id, std::move(available_locales), |
| 189 default_locale, | 193 default_locale, |
| 190 two_or_more_recommended_locales); | 194 two_or_more_recommended_locales); |
| 191 } | 195 } |
| 192 | 196 |
| 193 } // namespace chromeos | 197 } // namespace chromeos |
| OLD | NEW |