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

Side by Side Diff: chrome/browser/chromeos/login/screens/network_screen.cc

Issue 1055863002: ChromeOS: switch UI language before apps are loaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove empty line. Created 5 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/network_screen.h" 5 #include "chrome/browser/chromeos/login/screens/network_screen.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chromeos/base/locale_util.h" 13 #include "chrome/browser/chromeos/base/locale_util.h"
14 #include "chrome/browser/chromeos/customization/customization_document.h" 14 #include "chrome/browser/chromeos/customization/customization_document.h"
15 #include "chrome/browser/chromeos/login/help_app_launcher.h" 15 #include "chrome/browser/chromeos/login/help_app_launcher.h"
16 #include "chrome/browser/chromeos/login/helper.h" 16 #include "chrome/browser/chromeos/login/helper.h"
17 #include "chrome/browser/chromeos/login/screen_manager.h" 17 #include "chrome/browser/chromeos/login/screen_manager.h"
18 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" 18 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h"
19 #include "chrome/browser/chromeos/login/screens/network_view.h" 19 #include "chrome/browser/chromeos/login/screens/network_view.h"
20 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" 20 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h"
21 #include "chrome/browser/chromeos/login/wizard_controller.h" 21 #include "chrome/browser/chromeos/login/wizard_controller.h"
22 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 23 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "chrome/grit/chromium_strings.h" 25 #include "chrome/grit/chromium_strings.h"
25 #include "chrome/grit/generated_resources.h" 26 #include "chrome/grit/generated_resources.h"
26 #include "chromeos/network/network_handler.h" 27 #include "chromeos/network/network_handler.h"
27 #include "chromeos/network/network_state_handler.h" 28 #include "chromeos/network/network_state_handler.h"
28 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
30 31
31 namespace { 32 namespace {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 167
167 void NetworkScreen::DefaultNetworkChanged(const NetworkState* network) { 168 void NetworkScreen::DefaultNetworkChanged(const NetworkState* network) {
168 UpdateStatus(); 169 UpdateStatus();
169 } 170 }
170 171
171 //////////////////////////////////////////////////////////////////////////////// 172 ////////////////////////////////////////////////////////////////////////////////
172 // NetworkScreen, InputMethodManager::Observer implementation: 173 // NetworkScreen, InputMethodManager::Observer implementation:
173 174
174 void NetworkScreen::InputMethodChanged( 175 void NetworkScreen::InputMethodChanged(
175 input_method::InputMethodManager* manager, 176 input_method::InputMethodManager* manager,
177 Profile* /* proflie */,
176 bool /* show_message */) { 178 bool /* show_message */) {
177 GetContextEditor().SetString( 179 GetContextEditor().SetString(
178 kContextKeyInputMethod, 180 kContextKeyInputMethod,
179 manager->GetActiveIMEState()->GetCurrentInputMethod().id()); 181 manager->GetActiveIMEState()->GetCurrentInputMethod().id());
180 } 182 }
181 183
182 //////////////////////////////////////////////////////////////////////////////// 184 ////////////////////////////////////////////////////////////////////////////////
183 // NetworkScreen, setters and getters for input method and timezone. 185 // NetworkScreen, setters and getters for input method and timezone.
184 186
185 void NetworkScreen::SetApplicationLocale(const std::string& locale) { 187 void NetworkScreen::SetApplicationLocale(const std::string& locale) {
186 const std::string app_locale = g_browser_process->GetApplicationLocale(); 188 const std::string app_locale = g_browser_process->GetApplicationLocale();
187 if (app_locale == locale) 189 if (app_locale == locale)
188 return; 190 return;
189 191
190 // Block UI while resource bundle is being reloaded. 192 // Block UI while resource bundle is being reloaded.
191 // (InputEventsBlocker will live until callback is finished.) 193 // (InputEventsBlocker will live until callback is finished.)
192 locale_util::SwitchLanguageCallback callback(base::Bind( 194 locale_util::SwitchLanguageCallback callback(base::Bind(
193 &NetworkScreen::OnLanguageChangedCallback, weak_factory_.GetWeakPtr(), 195 &NetworkScreen::OnLanguageChangedCallback, weak_factory_.GetWeakPtr(),
194 base::Owned(new chromeos::InputEventsBlocker))); 196 base::Owned(new chromeos::InputEventsBlocker)));
195 locale_util::SwitchLanguage(locale, true /* enableLocaleKeyboardLayouts */, 197 locale_util::SwitchLanguage(locale, true /* enableLocaleKeyboardLayouts */,
196 true /* login_layouts_only */, callback); 198 true /* login_layouts_only */, callback,
199 ProfileManager::GetActiveUserProfile());
197 } 200 }
198 201
199 std::string NetworkScreen::GetApplicationLocale() { 202 std::string NetworkScreen::GetApplicationLocale() {
200 return g_browser_process->GetApplicationLocale(); 203 return g_browser_process->GetApplicationLocale();
201 } 204 }
202 205
203 void NetworkScreen::SetInputMethod(const std::string& input_method) { 206 void NetworkScreen::SetInputMethod(const std::string& input_method) {
204 input_method_ = input_method; 207 input_method_ = input_method;
205 input_method::InputMethodManager::Get() 208 input_method::InputMethodManager::Get()
206 ->GetActiveIMEState() 209 ->GetActiveIMEState()
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 FOR_EACH_OBSERVER(Observer, observers_, OnLanguageListReloaded()); 390 FOR_EACH_OBSERVER(Observer, observers_, OnLanguageListReloaded());
388 } 391 }
389 392
390 void NetworkScreen::OnSystemTimezoneChanged() { 393 void NetworkScreen::OnSystemTimezoneChanged() {
391 std::string current_timezone_id; 394 std::string current_timezone_id;
392 CrosSettings::Get()->GetString(kSystemTimezone, &current_timezone_id); 395 CrosSettings::Get()->GetString(kSystemTimezone, &current_timezone_id);
393 GetContextEditor().SetString(kContextKeyTimezone, current_timezone_id); 396 GetContextEditor().SetString(kContextKeyTimezone, current_timezone_id);
394 } 397 }
395 398
396 } // namespace chromeos 399 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/network_screen.h ('k') | chrome/browser/chromeos/login/session/user_session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698