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

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

Issue 597723003: Revert of ChromeOS: "Add New User" screen should enable all hardware keyboards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/gaia_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/browser_shutdown.h" 14 #include "chrome/browser/browser_shutdown.h"
15 #include "chrome/browser/chromeos/input_method/input_method_util.h"
16 #include "chrome/browser/chromeos/language_preferences.h"
17 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 15 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
18 #include "chrome/browser/chromeos/policy/consumer_management_service.h" 16 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" 17 #include "chrome/browser/chromeos/profiles/profile_helper.h"
20 #include "chrome/browser/chromeos/settings/cros_settings.h" 18 #include "chrome/browser/chromeos/settings/cros_settings.h"
21 #include "chrome/browser/io_thread.h" 19 #include "chrome/browser/io_thread.h"
22 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 20 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
23 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" 21 #include "chrome/browser/ui/webui/signin/inline_login_ui.h"
24 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
25 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
26 #include "chromeos/chromeos_switches.h" 24 #include "chromeos/chromeos_switches.h"
27 #include "chromeos/ime/input_method_manager.h"
28 #include "chromeos/settings/cros_settings_names.h" 25 #include "chromeos/settings/cros_settings_names.h"
29 #include "components/user_manager/user_manager.h" 26 #include "components/user_manager/user_manager.h"
30 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
31 #include "content/public/browser/render_frame_host.h" 28 #include "content/public/browser/render_frame_host.h"
32 #include "google_apis/gaia/gaia_auth_util.h" 29 #include "google_apis/gaia/gaia_auth_util.h"
33 #include "google_apis/gaia/gaia_switches.h" 30 #include "google_apis/gaia/gaia_switches.h"
34 #include "google_apis/gaia/gaia_urls.h" 31 #include "google_apis/gaia/gaia_urls.h"
35 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
36 33
37 using content::BrowserThread; 34 using content::BrowserThread;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO 98 // The Task posted to PostTaskAndReply in StartClearingDnsCache on the IO
102 // thread. 99 // thread.
103 void ClearDnsCache(IOThread* io_thread) { 100 void ClearDnsCache(IOThread* io_thread) {
104 DCHECK_CURRENTLY_ON(BrowserThread::IO); 101 DCHECK_CURRENTLY_ON(BrowserThread::IO);
105 if (browser_shutdown::IsTryingToQuit()) 102 if (browser_shutdown::IsTryingToQuit())
106 return; 103 return;
107 104
108 io_thread->ClearHostCache(); 105 io_thread->ClearHostCache();
109 } 106 }
110 107
111 void PushFrontIMIfNotExists(const std::string& input_method,
112 std::vector<std::string>* input_methods) {
113 if (input_method.empty())
114 return;
115
116 if (std::find(input_methods->begin(), input_methods->end(), input_method) ==
117 input_methods->end())
118 input_methods->insert(input_methods->begin(), input_method);
119 }
120
121 } // namespace 108 } // namespace
122 109
123 GaiaContext::GaiaContext() 110 GaiaContext::GaiaContext()
124 : force_reload(false), 111 : force_reload(false),
125 is_local(false), 112 is_local(false),
126 password_changed(false), 113 password_changed(false),
127 show_users(false), 114 show_users(false),
128 use_offline(false), 115 use_offline(false),
129 has_users(false) {} 116 has_users(false) {}
130 117
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 // Gaia page will be realoded, so focus isn't stolen anymore. 550 // Gaia page will be realoded, so focus isn't stolen anymore.
564 focus_stolen_ = false; 551 focus_stolen_ = false;
565 } 552 }
566 553
567 // Note that LoadAuthExtension clears |populated_email_|. 554 // Note that LoadAuthExtension clears |populated_email_|.
568 if (populated_email_.empty()) 555 if (populated_email_.empty())
569 Delegate()->LoadSigninWallpaper(); 556 Delegate()->LoadSigninWallpaper();
570 else 557 else
571 Delegate()->LoadWallpaper(populated_email_); 558 Delegate()->LoadWallpaper(populated_email_);
572 559
573 input_method::InputMethodManager* imm =
574 input_method::InputMethodManager::Get();
575
576 scoped_refptr<input_method::InputMethodManager::State> gaia_ime_state =
577 imm->GetActiveIMEState()->Clone();
578 imm->SetState(gaia_ime_state);
579
580 // Set Least Recently Used input method for the user. 560 // Set Least Recently Used input method for the user.
581 if (!populated_email_.empty()) { 561 if (!populated_email_.empty())
582 signin_screen_handler_->SetUserInputMethod(populated_email_, 562 signin_screen_handler_->SetUserInputMethod(populated_email_);
583 gaia_ime_state.get());
584 } else {
585 std::vector<std::string> input_methods =
586 imm->GetInputMethodUtil()->GetHardwareLoginInputMethodIds();
587 const std::string owner_im = signin_screen_handler_->GetUserLRUInputMethod(
588 user_manager::UserManager::Get()->GetOwnerEmail());
589 const std::string system_im = g_browser_process->local_state()->GetString(
590 language_prefs::kPreferredKeyboardLayout);
591
592 PushFrontIMIfNotExists(owner_im, &input_methods);
593 PushFrontIMIfNotExists(system_im, &input_methods);
594
595 gaia_ime_state->EnableLoginLayouts(
596 g_browser_process->GetApplicationLocale(), input_methods);
597
598 if (!system_im.empty()) {
599 gaia_ime_state->ChangeInputMethod(system_im, false /* show_message */);
600 } else if (!owner_im.empty()) {
601 gaia_ime_state->ChangeInputMethod(owner_im, false /* show_message */);
602 }
603 }
604 563
605 LoadAuthExtension(!gaia_silent_load_, false, false); 564 LoadAuthExtension(!gaia_silent_load_, false, false);
606 signin_screen_handler_->UpdateUIState( 565 signin_screen_handler_->UpdateUIState(
607 SigninScreenHandler::UI_STATE_GAIA_SIGNIN, NULL); 566 SigninScreenHandler::UI_STATE_GAIA_SIGNIN, NULL);
608 567
609 if (gaia_silent_load_) { 568 if (gaia_silent_load_) {
610 // The variable is assigned to false because silently loaded Gaia page was 569 // The variable is assigned to false because silently loaded Gaia page was
611 // used. 570 // used.
612 gaia_silent_load_ = false; 571 gaia_silent_load_ = false;
613 if (focus_stolen_) 572 if (focus_stolen_)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 625
667 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { 626 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() {
668 DCHECK(signin_screen_handler_); 627 DCHECK(signin_screen_handler_);
669 return signin_screen_handler_->delegate_; 628 return signin_screen_handler_->delegate_;
670 } 629 }
671 630
672 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { 631 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) {
673 signin_screen_handler_ = handler; 632 signin_screen_handler_ = handler;
674 } 633 }
675 } // namespace chromeos 634 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698