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

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

Issue 2505403003: TouchView Mojom (Closed)
Patch Set: Minor param rename 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"
96 #include "content/public/common/service_names.mojom.h"
95 #include "google_apis/gaia/gaia_auth_util.h" 97 #include "google_apis/gaia/gaia_auth_util.h"
98 #include "services/service_manager/public/cpp/connector.h"
96 #include "third_party/cros_system_api/dbus/service_constants.h" 99 #include "third_party/cros_system_api/dbus/service_constants.h"
97 #include "ui/base/ime/chromeos/ime_keyboard.h" 100 #include "ui/base/ime/chromeos/ime_keyboard.h"
98 #include "ui/base/ime/chromeos/input_method_descriptor.h" 101 #include "ui/base/ime/chromeos/input_method_descriptor.h"
99 #include "ui/base/ime/chromeos/input_method_manager.h" 102 #include "ui/base/ime/chromeos/input_method_manager.h"
100 #include "ui/base/webui/web_ui_util.h" 103 #include "ui/base/webui/web_ui_util.h"
101 104
102 namespace { 105 namespace {
103 106
104 // Max number of users to show. 107 // Max number of users to show.
105 const size_t kMaxUsers = 18; 108 const size_t kMaxUsers = 18;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 CoreOobeActor* core_oobe_actor, 261 CoreOobeActor* core_oobe_actor,
259 GaiaScreenHandler* gaia_screen_handler) 262 GaiaScreenHandler* gaia_screen_handler)
260 : network_state_informer_(network_state_informer), 263 : network_state_informer_(network_state_informer),
261 network_error_model_(network_error_model), 264 network_error_model_(network_error_model),
262 core_oobe_actor_(core_oobe_actor), 265 core_oobe_actor_(core_oobe_actor),
263 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get() 266 caps_lock_enabled_(chromeos::input_method::InputMethodManager::Get()
264 ->GetImeKeyboard() 267 ->GetImeKeyboard()
265 ->CapsLockIsEnabled()), 268 ->CapsLockIsEnabled()),
266 proxy_auth_dialog_reload_times_(kMaxGaiaReloadForProxyAuthDialog), 269 proxy_auth_dialog_reload_times_(kMaxGaiaReloadForProxyAuthDialog),
267 gaia_screen_handler_(gaia_screen_handler), 270 gaia_screen_handler_(gaia_screen_handler),
271 touch_view_binding_(this),
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::mojom::kBrowserServiceName,
296 max_mode_delegate_->AddObserver(this); 302 &touch_view_manager_ptr_);
297 } else { 303 } else {
298 NOTIMPLEMENTED(); 304 connector->ConnectToInterface("ash", &touch_view_manager_ptr_);
299 } 305 }
306
307 touch_view_manager_ptr_->AddObserver(
308 touch_view_binding_.CreateInterfacePtrAndBind());
300 } 309 }
301 310
302 SigninScreenHandler::~SigninScreenHandler() { 311 SigninScreenHandler::~SigninScreenHandler() {
303 OobeUI* oobe_ui = GetOobeUI(); 312 OobeUI* oobe_ui = GetOobeUI();
304 if (oobe_ui && oobe_ui_observer_added_) 313 if (oobe_ui && oobe_ui_observer_added_)
305 oobe_ui->RemoveObserver(this); 314 oobe_ui->RemoveObserver(this);
306 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( 315 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(
307 this); 316 this);
308 chromeos::input_method::ImeKeyboard* keyboard = 317 chromeos::input_method::ImeKeyboard* keyboard =
309 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); 318 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard();
310 if (keyboard) 319 if (keyboard)
311 keyboard->RemoveObserver(this); 320 keyboard->RemoveObserver(this);
312 weak_factory_.InvalidateWeakPtrs(); 321 weak_factory_.InvalidateWeakPtrs();
313 if (delegate_) 322 if (delegate_)
314 delegate_->SetWebUIHandler(nullptr); 323 delegate_->SetWebUIHandler(nullptr);
315 network_state_informer_->RemoveObserver(this); 324 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); 325 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr);
321 proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(EmptyAccountId()); 326 proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(EmptyAccountId());
322 } 327 }
323 328
324 // static 329 // static
325 std::string SigninScreenHandler::GetUserLRUInputMethod( 330 std::string SigninScreenHandler::GetUserLRUInputMethod(
326 const std::string& username) { 331 const std::string& username) {
327 PrefService* const local_state = g_browser_process->local_state(); 332 PrefService* const local_state = g_browser_process->local_state();
328 const base::DictionaryValue* users_lru_input_methods = 333 const base::DictionaryValue* users_lru_input_methods =
329 local_state->GetDictionary(prefs::kUsersLRUInputMethod); 334 local_state->GetDictionary(prefs::kUsersLRUInputMethod);
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 } 1064 }
1060 } 1065 }
1061 1066
1062 void SigninScreenHandler::SuspendDone(const base::TimeDelta& sleep_duration) { 1067 void SigninScreenHandler::SuspendDone(const base::TimeDelta& sleep_duration) {
1063 for (user_manager::User* user : 1068 for (user_manager::User* user :
1064 user_manager::UserManager::Get()->GetUnlockUsers()) { 1069 user_manager::UserManager::Get()->GetUnlockUsers()) {
1065 HidePinKeyboardIfNeeded(user->GetAccountId()); 1070 HidePinKeyboardIfNeeded(user->GetAccountId());
1066 } 1071 }
1067 } 1072 }
1068 1073
1069 void SigninScreenHandler::OnMaximizeModeStarted() { 1074 void SigninScreenHandler::OnTouchViewToggled(bool enabled) {
1070 CallJS("login.AccountPickerScreen.setTouchViewState", true); 1075 touch_view_enabled_ = enabled;
1071 } 1076 CallJS("login.AccountPickerScreen.setTouchViewState", enabled);
1072
1073 void SigninScreenHandler::OnMaximizeModeEnded() {
1074 CallJS("login.AccountPickerScreen.setTouchViewState", false);
1075 } 1077 }
1076 1078
1077 bool SigninScreenHandler::ShouldLoadGaia() const { 1079 bool SigninScreenHandler::ShouldLoadGaia() const {
1078 // Fetching of the extension is not started before account picker page is 1080 // Fetching of the extension is not started before account picker page is
1079 // loaded because it can affect the loading speed. 1081 // loaded because it can affect the loading speed.
1080 // Do not load the extension for the screen locker, see crosbug.com/25018. 1082 // Do not load the extension for the screen locker, see crosbug.com/25018.
1081 return !ScreenLocker::default_screen_locker() && 1083 return !ScreenLocker::default_screen_locker() &&
1082 is_account_picker_showing_first_time_; 1084 is_account_picker_showing_first_time_;
1083 } 1085 }
1084 1086
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 } 1418 }
1417 1419
1418 void SigninScreenHandler::HandleLaunchArcKioskApp( 1420 void SigninScreenHandler::HandleLaunchArcKioskApp(
1419 const AccountId& app_account_id) { 1421 const AccountId& app_account_id) {
1420 UserContext context(user_manager::USER_TYPE_ARC_KIOSK_APP, app_account_id); 1422 UserContext context(user_manager::USER_TYPE_ARC_KIOSK_APP, app_account_id);
1421 if (delegate_) 1423 if (delegate_)
1422 delegate_->Login(context, SigninSpecifics()); 1424 delegate_->Login(context, SigninSpecifics());
1423 } 1425 }
1424 1426
1425 void SigninScreenHandler::HandleGetTouchViewState() { 1427 void SigninScreenHandler::HandleGetTouchViewState() {
1426 if (max_mode_delegate_) { 1428 CallJS("login.AccountPickerScreen.setTouchViewState", touch_view_enabled_);
1427 CallJS("login.AccountPickerScreen.setTouchViewState",
1428 max_mode_delegate_->IsMaximizeModeEnabled());
1429 }
1430 } 1429 }
1431 1430
1432 void SigninScreenHandler::HandleLogRemoveUserWarningShown() { 1431 void SigninScreenHandler::HandleLogRemoveUserWarningShown() {
1433 ProfileMetrics::LogProfileDeleteUser( 1432 ProfileMetrics::LogProfileDeleteUser(
1434 ProfileMetrics::DELETE_PROFILE_USER_MANAGER_SHOW_WARNING); 1433 ProfileMetrics::DELETE_PROFILE_USER_MANAGER_SHOW_WARNING);
1435 } 1434 }
1436 1435
1437 void SigninScreenHandler::HandleFirstIncorrectPasswordAttempt( 1436 void SigninScreenHandler::HandleFirstIncorrectPasswordAttempt(
1438 const AccountId& account_id) { 1437 const AccountId& account_id) {
1439 // TODO(ginkage): Fix this case once crbug.com/469987 is ready. 1438 // TODO(ginkage): Fix this case once crbug.com/469987 is ready.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 } 1532 }
1534 1533
1535 void SigninScreenHandler::OnFeedbackFinished() { 1534 void SigninScreenHandler::OnFeedbackFinished() {
1536 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); 1535 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI");
1537 1536
1538 // Recreate user's cryptohome after the feedback is attempted. 1537 // Recreate user's cryptohome after the feedback is attempted.
1539 HandleResyncUserData(); 1538 HandleResyncUserData();
1540 } 1539 }
1541 1540
1542 } // namespace chromeos 1541 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698