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

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 133273032: Guest Mode: input method should default to the underlying latin keyboard layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-upload missing CL. Created 6 years, 11 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 (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/chromeos/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
30 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 30 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
31 #include "chrome/browser/chromeos/boot_times_loader.h" 31 #include "chrome/browser/chromeos/boot_times_loader.h"
32 #include "chrome/browser/chromeos/contacts/contact_manager.h" 32 #include "chrome/browser/chromeos/contacts/contact_manager.h"
33 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" 33 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h"
34 #include "chrome/browser/chromeos/extensions/default_app_order.h" 34 #include "chrome/browser/chromeos/extensions/default_app_order.h"
35 #include "chrome/browser/chromeos/extensions/extension_system_event_observer.h" 35 #include "chrome/browser/chromeos/extensions/extension_system_event_observer.h"
36 #include "chrome/browser/chromeos/external_metrics.h" 36 #include "chrome/browser/chromeos/external_metrics.h"
37 #include "chrome/browser/chromeos/imageburner/burn_manager.h" 37 #include "chrome/browser/chromeos/imageburner/burn_manager.h"
38 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 38 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
39 #include "chrome/browser/chromeos/input_method/input_method_util.h"
39 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" 40 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h"
40 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" 41 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h"
41 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" 42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
43 #include "chrome/browser/chromeos/language_preferences.h"
42 #include "chrome/browser/chromeos/login/authenticator.h" 44 #include "chrome/browser/chromeos/login/authenticator.h"
43 #include "chrome/browser/chromeos/login/login_utils.h" 45 #include "chrome/browser/chromeos/login/login_utils.h"
44 #include "chrome/browser/chromeos/login/login_wizard.h" 46 #include "chrome/browser/chromeos/login/login_wizard.h"
45 #include "chrome/browser/chromeos/login/screen_locker.h" 47 #include "chrome/browser/chromeos/login/screen_locker.h"
46 #include "chrome/browser/chromeos/login/startup_utils.h" 48 #include "chrome/browser/chromeos/login/startup_utils.h"
47 #include "chrome/browser/chromeos/login/user_manager.h" 49 #include "chrome/browser/chromeos/login/user_manager.h"
48 #include "chrome/browser/chromeos/login/wallpaper_manager.h" 50 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
49 #include "chrome/browser/chromeos/login/wizard_controller.h" 51 #include "chrome/browser/chromeos/login/wizard_controller.h"
50 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" 52 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
51 #include "chrome/browser/chromeos/net/network_portal_detector.h" 53 #include "chrome/browser/chromeos/net/network_portal_detector.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 UserManager* user_manager = UserManager::Get(); 542 UserManager* user_manager = UserManager::Get();
541 // In case of multi-profiles --login-profile will contain user_id_hash. 543 // In case of multi-profiles --login-profile will contain user_id_hash.
542 std::string username_hash = 544 std::string username_hash =
543 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); 545 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile);
544 user_manager->UserLoggedIn(username, username_hash, true); 546 user_manager->UserLoggedIn(username, username_hash, true);
545 VLOG(1) << "Relaunching browser for user: " << username 547 VLOG(1) << "Relaunching browser for user: " << username
546 << " with hash: " << username_hash; 548 << " with hash: " << username_hash;
547 } 549 }
548 } 550 }
549 551
552 class GuestLanguageSetCallbackData {
553 public:
554 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) {
555 }
556
557 // must match SwitchLanguageCallback type.
558 static void Callback(const scoped_ptr<GuestLanguageSetCallbackData>& self,
559 const std::string& locale,
560 const std::string& loaded_locale,
561 bool success);
562
563 Profile* profile;
564 };
565
566 // static
567 void GuestLanguageSetCallbackData::Callback(
568 const scoped_ptr<GuestLanguageSetCallbackData>& self,
569 const std::string& locale,
570 const std::string& loaded_locale,
571 bool success) {
572 input_method::InputMethodManager* const ime =
Hiro Komatsu 2014/01/21 05:46:01 Please use 'imm' or 'ime_manager' instead of 'ime'
Alexander Alekseev 2014/01/21 14:05:27 Done.
573 input_method::InputMethodManager::Get();
574 // Implicitly enable owners choise.
575 ime->EnableInputMethod(g_browser_process->local_state()->GetString(
576 language_prefs::kPreferredKeyboardLayout));
577 // Active layout must be hardware "login layout".
578 // The previous one must be "locale default layout".
579 const std::string login_im =
580 ime->GetInputMethodUtil()->GetHardwareLoginInputMethodId();
581 ime->ChangeInputMethod(login_im);
582
583 const std::string locale_default_input_method =
584 ime->GetInputMethodUtil()->GetLanguageDefaultInputMethodId(loaded_locale);
585 if (!locale_default_input_method.empty()) {
586 PrefService* user_prefs = self->profile->GetPrefs();
587 user_prefs->SetString(prefs::kLanguagePreviousInputMethod,
588 locale_default_input_method);
589 }
590 }
591
592 void SetGuestLocale(UserManager* const usermanager, Profile* const profile) {
593 scoped_ptr<GuestLanguageSetCallbackData> data(
594 new GuestLanguageSetCallbackData(profile));
595 scoped_ptr<locale_util::SwitchLanguageCallback> callback(
596 new locale_util::SwitchLanguageCallback(base::Bind(
597 &GuestLanguageSetCallbackData::Callback, base::Passed(data.Pass()))));
598 User* const user = usermanager->GetUserByProfile(profile);
599 usermanager->RespectLocalePreference(profile, user, callback.Pass());
600 }
601
550 void ChromeBrowserMainPartsChromeos::PostProfileInit() { 602 void ChromeBrowserMainPartsChromeos::PostProfileInit() {
551 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() 603 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun()
552 // -- just after CreateProfile(). 604 // -- just after CreateProfile().
553 605
554 // Restarting Chrome inside existing user session. Possible cases: 606 // Restarting Chrome inside existing user session. Possible cases:
555 // 1. Chrome is restarted after crash. 607 // 1. Chrome is restarted after crash.
556 // 2. Chrome is started in browser_tests skipping the login flow 608 // 2. Chrome is started in browser_tests skipping the login flow
557 // 3. Chrome is started on dev machine 609 // 3. Chrome is started on dev machine
558 // i.e. not on Chrome OS device w/o login flow. 610 // i.e. not on Chrome OS device w/o login flow.
559 if (parsed_command_line().HasSwitch(switches::kLoginUser) && 611 if (parsed_command_line().HasSwitch(switches::kLoginUser) &&
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 detector->Enable(true); 648 detector->Enable(true);
597 } 649 }
598 650
599 // Tests should be able to tune login manager before showing it. 651 // Tests should be able to tune login manager before showing it.
600 // Thus only show login manager in normal (non-testing) mode. 652 // Thus only show login manager in normal (non-testing) mode.
601 if (!parameters().ui_task || 653 if (!parameters().ui_task ||
602 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) { 654 parsed_command_line().HasSwitch(switches::kForceLoginManagerInTests)) {
603 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); 655 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile());
604 } 656 }
605 657
658 // Guest user profile is never initialized with locale settings,
659 // so we need special handling for Guest session.
660 UserManager* const usermanager = UserManager::Get();
661 if (usermanager->IsUserLoggedIn() && usermanager->IsLoggedInAsGuest()) {
662 SetGuestLocale(usermanager, profile());
663 }
664
606 // These observers must be initialized after the profile because 665 // These observers must be initialized after the profile because
607 // they use the profile to dispatch extension events. 666 // they use the profile to dispatch extension events.
608 extension_system_event_observer_.reset(new ExtensionSystemEventObserver()); 667 extension_system_event_observer_.reset(new ExtensionSystemEventObserver());
609 if (KioskModeSettings::Get()->IsKioskModeEnabled()) { 668 if (KioskModeSettings::Get()->IsKioskModeEnabled()) {
610 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create( 669 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create(
611 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, 670 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
612 "Retail mode"); 671 "Retail mode");
613 } 672 }
614 673
615 peripheral_battery_observer_.reset(new PeripheralBatteryObserver()); 674 peripheral_battery_observer_.reset(new PeripheralBatteryObserver());
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 // Destroy DBus services immediately after threads are stopped. 819 // Destroy DBus services immediately after threads are stopped.
761 dbus_services_.reset(); 820 dbus_services_.reset();
762 821
763 ChromeBrowserMainPartsLinux::PostDestroyThreads(); 822 ChromeBrowserMainPartsLinux::PostDestroyThreads();
764 823
765 // Destroy DeviceSettingsService after g_browser_process. 824 // Destroy DeviceSettingsService after g_browser_process.
766 DeviceSettingsService::Shutdown(); 825 DeviceSettingsService::Shutdown();
767 } 826 }
768 827
769 } // namespace chromeos 828 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698