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

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

Issue 2505403003: TouchView Mojom (Closed)
Patch Set: Rename and docs Created 4 years 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ui/webui/chromeos/login/signin_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #include "components/prefs/scoped_user_pref_update.h" 85 #include "components/prefs/scoped_user_pref_update.h"
86 #include "components/proximity_auth/screenlock_bridge.h" 86 #include "components/proximity_auth/screenlock_bridge.h"
87 #include "components/strings/grit/components_strings.h" 87 #include "components/strings/grit/components_strings.h"
88 #include "components/user_manager/known_user.h" 88 #include "components/user_manager/known_user.h"
89 #include "components/user_manager/user.h" 89 #include "components/user_manager/user.h"
90 #include "components/user_manager/user_manager.h" 90 #include "components/user_manager/user_manager.h"
91 #include "components/user_manager/user_type.h" 91 #include "components/user_manager/user_type.h"
92 #include "components/version_info/version_info.h" 92 #include "components/version_info/version_info.h"
93 #include "content/public/browser/render_frame_host.h" 93 #include "content/public/browser/render_frame_host.h"
94 #include "content/public/browser/web_contents.h" 94 #include "content/public/browser/web_contents.h"
95 #include "content/public/common/service_manager_connection.h"
95 #include "google_apis/gaia/gaia_auth_util.h" 96 #include "google_apis/gaia/gaia_auth_util.h"
97 #include "services/service_manager/public/cpp/connector.h"
96 #include "third_party/cros_system_api/dbus/service_constants.h" 98 #include "third_party/cros_system_api/dbus/service_constants.h"
97 #include "ui/base/ime/chromeos/ime_keyboard.h" 99 #include "ui/base/ime/chromeos/ime_keyboard.h"
98 #include "ui/base/ime/chromeos/input_method_descriptor.h" 100 #include "ui/base/ime/chromeos/input_method_descriptor.h"
99 #include "ui/base/ime/chromeos/input_method_manager.h" 101 #include "ui/base/ime/chromeos/input_method_manager.h"
100 #include "ui/base/webui/web_ui_util.h" 102 #include "ui/base/webui/web_ui_util.h"
101 103
102 namespace { 104 namespace {
103 105
104 // Max number of users to show. 106 // Max number of users to show.
105 const size_t kMaxUsers = 18; 107 const size_t kMaxUsers = 18;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 CoreOobeActor* core_oobe_actor, 260 CoreOobeActor* core_oobe_actor,
259 GaiaScreenHandler* gaia_screen_handler) 261 GaiaScreenHandler* gaia_screen_handler)
260 : network_state_informer_(network_state_informer), 262 : network_state_informer_(network_state_informer),
261 network_error_model_(network_error_model), 263 network_error_model_(network_error_model),
262 core_oobe_actor_(core_oobe_actor), 264 core_oobe_actor_(core_oobe_actor),
263 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() 265 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get()
264 ->GetImeKeyboard() 266 ->GetImeKeyboard()
265 ->CapsLockIsEnabled()), 267 ->CapsLockIsEnabled()),
266 proxy_auth_dialog_reload_times_(kMaxGaiaReloadForProxyAuthDialog), 268 proxy_auth_dialog_reload_times_(kMaxGaiaReloadForProxyAuthDialog),
267 gaia_screen_handler_(gaia_screen_handler), 269 gaia_screen_handler_(gaia_screen_handler),
270 touch_view_binding_(this),
271 touch_view_enabled_(false),
xiyuan 2016/12/01 21:28:39 nit: move initializer to header ?
jonross 2016/12/01 22:01:16 Done.
268 histogram_helper_(new ErrorScreensHistogramHelper("Signin")), 272 histogram_helper_(new ErrorScreensHistogramHelper("Signin")),
269 weak_factory_(this) { 273 weak_factory_(this) {
270 DCHECK(network_state_informer_.get()); 274 DCHECK(network_state_informer_.get());
271 DCHECK(network_error_model_); 275 DCHECK(network_error_model_);
272 DCHECK(core_oobe_actor_); 276 DCHECK(core_oobe_actor_);
273 gaia_screen_handler_->set_signin_screen_handler(this); 277 gaia_screen_handler_->set_signin_screen_handler(this);
274 network_state_informer_->AddObserver(this); 278 network_state_informer_->AddObserver(this);
275 279
276 registrar_.Add(this, 280 registrar_.Add(this,
277 chrome::NOTIFICATION_AUTH_NEEDED, 281 chrome::NOTIFICATION_AUTH_NEEDED,
278 content::NotificationService::AllSources()); 282 content::NotificationService::AllSources());
279 registrar_.Add(this, 283 registrar_.Add(this,
280 chrome::NOTIFICATION_AUTH_SUPPLIED, 284 chrome::NOTIFICATION_AUTH_SUPPLIED,
281 content::NotificationService::AllSources()); 285 content::NotificationService::AllSources());
282 registrar_.Add(this, 286 registrar_.Add(this,
283 chrome::NOTIFICATION_AUTH_CANCELLED, 287 chrome::NOTIFICATION_AUTH_CANCELLED,
284 content::NotificationService::AllSources()); 288 content::NotificationService::AllSources());
285 289
286 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( 290 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(
287 this); 291 this);
288 292
289 chromeos::input_method::ImeKeyboard* keyboard = 293 chromeos::input_method::ImeKeyboard* keyboard =
290 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); 294 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard();
291 if (keyboard) 295 if (keyboard)
292 keyboard->AddObserver(this); 296 keyboard->AddObserver(this);
293 297
298 service_manager::Connector* connector =
299 content::ServiceManagerConnection::GetForProcess()->GetConnector();
294 if (!chrome::IsRunningInMash()) { 300 if (!chrome::IsRunningInMash()) {
295 max_mode_delegate_.reset(new TouchViewControllerDelegate()); 301 connector->ConnectToInterface("content_browser", &touch_view_manager_ptr_);
xiyuan 2016/12/01 21:28:39 nit: "content_browser" -> content::mojom::kBrowser
jonross 2016/12/01 22:01:17 Done.
296 max_mode_delegate_->AddObserver(this);
297 } else { 302 } else {
298 NOTIMPLEMENTED(); 303 connector->ConnectToInterface("ash", &touch_view_manager_ptr_);
299 } 304 }
305
306 touch_view_manager_ptr_->AddObserver(
307 touch_view_binding_.CreateInterfacePtrAndBind());
300 } 308 }
301 309
302 SigninScreenHandler::~SigninScreenHandler() { 310 SigninScreenHandler::~SigninScreenHandler() {
303 OobeUI* oobe_ui = GetOobeUI(); 311 OobeUI* oobe_ui = GetOobeUI();
304 if (oobe_ui && oobe_ui_observer_added_) 312 if (oobe_ui && oobe_ui_observer_added_)
305 oobe_ui->RemoveObserver(this); 313 oobe_ui->RemoveObserver(this);
306 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( 314 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(
307 this); 315 this);
308 chromeos::input_method::ImeKeyboard* keyboard = 316 chromeos::input_method::ImeKeyboard* keyboard =
309 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); 317 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard();
310 if (keyboard) 318 if (keyboard)
311 keyboard->RemoveObserver(this); 319 keyboard->RemoveObserver(this);
312 weak_factory_.InvalidateWeakPtrs(); 320 weak_factory_.InvalidateWeakPtrs();
313 if (delegate_) 321 if (delegate_)
314 delegate_->SetWebUIHandler(nullptr); 322 delegate_->SetWebUIHandler(nullptr);
315 network_state_informer_->RemoveObserver(this); 323 network_state_informer_->RemoveObserver(this);
316 if (max_mode_delegate_) {
317 max_mode_delegate_->RemoveObserver(this);
318 max_mode_delegate_.reset(nullptr);
319 }
320 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr); 324 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr);
321 proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(EmptyAccountId()); 325 proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(EmptyAccountId());
322 } 326 }
323 327
324 // static 328 // static
325 std::string SigninScreenHandler::GetUserLRUInputMethod( 329 std::string SigninScreenHandler::GetUserLRUInputMethod(
326 const std::string& username) { 330 const std::string& username) {
327 PrefService* const local_state = g_browser_process->local_state(); 331 PrefService* const local_state = g_browser_process->local_state();
328 const base::DictionaryValue* users_lru_input_methods = 332 const base::DictionaryValue* users_lru_input_methods =
329 local_state->GetDictionary(prefs::kUsersLRUInputMethod); 333 local_state->GetDictionary(prefs::kUsersLRUInputMethod);
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 } 1063 }
1060 } 1064 }
1061 1065
1062 void SigninScreenHandler::SuspendDone(const base::TimeDelta& sleep_duration) { 1066 void SigninScreenHandler::SuspendDone(const base::TimeDelta& sleep_duration) {
1063 for (user_manager::User* user : 1067 for (user_manager::User* user :
1064 user_manager::UserManager::Get()->GetUnlockUsers()) { 1068 user_manager::UserManager::Get()->GetUnlockUsers()) {
1065 HidePinKeyboardIfNeeded(user->GetAccountId()); 1069 HidePinKeyboardIfNeeded(user->GetAccountId());
1066 } 1070 }
1067 } 1071 }
1068 1072
1069 void SigninScreenHandler::OnMaximizeModeStarted() { 1073 void SigninScreenHandler::OnTouchViewToggled(bool enabled) {
1070 CallJS("login.AccountPickerScreen.setTouchViewState", true); 1074 touch_view_enabled_ = enabled;
1071 } 1075 CallJS("login.AccountPickerScreen.setTouchViewState", enabled);
1072
1073 void SigninScreenHandler::OnMaximizeModeEnded() {
1074 CallJS("login.AccountPickerScreen.setTouchViewState", false);
1075 } 1076 }
1076 1077
1077 bool SigninScreenHandler::ShouldLoadGaia() const { 1078 bool SigninScreenHandler::ShouldLoadGaia() const {
1078 // Fetching of the extension is not started before account picker page is 1079 // Fetching of the extension is not started before account picker page is
1079 // loaded because it can affect the loading speed. 1080 // loaded because it can affect the loading speed.
1080 // Do not load the extension for the screen locker, see crosbug.com/25018. 1081 // Do not load the extension for the screen locker, see crosbug.com/25018.
1081 return !ScreenLocker::default_screen_locker() && 1082 return !ScreenLocker::default_screen_locker() &&
1082 is_account_picker_showing_first_time_; 1083 is_account_picker_showing_first_time_;
1083 } 1084 }
1084 1085
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 } 1417 }
1417 1418
1418 void SigninScreenHandler::HandleLaunchArcKioskApp( 1419 void SigninScreenHandler::HandleLaunchArcKioskApp(
1419 const AccountId& app_account_id) { 1420 const AccountId& app_account_id) {
1420 UserContext context(user_manager::USER_TYPE_ARC_KIOSK_APP, app_account_id); 1421 UserContext context(user_manager::USER_TYPE_ARC_KIOSK_APP, app_account_id);
1421 if (delegate_) 1422 if (delegate_)
1422 delegate_->Login(context, SigninSpecifics()); 1423 delegate_->Login(context, SigninSpecifics());
1423 } 1424 }
1424 1425
1425 void SigninScreenHandler::HandleGetTouchViewState() { 1426 void SigninScreenHandler::HandleGetTouchViewState() {
1426 if (max_mode_delegate_) { 1427 CallJS("login.AccountPickerScreen.setTouchViewState", touch_view_enabled_);
1427 CallJS("login.AccountPickerScreen.setTouchViewState",
1428 max_mode_delegate_->IsMaximizeModeEnabled());
1429 }
1430 } 1428 }
1431 1429
1432 void SigninScreenHandler::HandleLogRemoveUserWarningShown() { 1430 void SigninScreenHandler::HandleLogRemoveUserWarningShown() {
1433 ProfileMetrics::LogProfileDeleteUser( 1431 ProfileMetrics::LogProfileDeleteUser(
1434 ProfileMetrics::DELETE_PROFILE_USER_MANAGER_SHOW_WARNING); 1432 ProfileMetrics::DELETE_PROFILE_USER_MANAGER_SHOW_WARNING);
1435 } 1433 }
1436 1434
1437 void SigninScreenHandler::HandleFirstIncorrectPasswordAttempt( 1435 void SigninScreenHandler::HandleFirstIncorrectPasswordAttempt(
1438 const AccountId& account_id) { 1436 const AccountId& account_id) {
1439 // TODO(ginkage): Fix this case once crbug.com/469987 is ready. 1437 // TODO(ginkage): Fix this case once crbug.com/469987 is ready.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 } 1531 }
1534 1532
1535 void SigninScreenHandler::OnFeedbackFinished() { 1533 void SigninScreenHandler::OnFeedbackFinished() {
1536 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); 1534 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI");
1537 1535
1538 // Recreate user's cryptohome after the feedback is attempted. 1536 // Recreate user's cryptohome after the feedback is attempted.
1539 HandleResyncUserData(); 1537 HandleResyncUserData();
1540 } 1538 }
1541 1539
1542 } // namespace chromeos 1540 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698