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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 3579011: Chrome OS: make language per user. (Closed)
Patch Set: spellfix Created 10 years, 1 month 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/lock.h" 12 #include "base/lock.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/singleton.h" 15 #include "base/singleton.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/browser_init.h" 20 #include "chrome/browser/browser_init.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/browser_thread.h" 22 #include "chrome/browser/browser_thread.h"
23 #include "chrome/browser/chromeos/boot_times_loader.h" 23 #include "chrome/browser/chromeos/boot_times_loader.h"
24 #include "chrome/browser/chromeos/cros/login_library.h" 24 #include "chrome/browser/chromeos/cros/login_library.h"
25 #include "chrome/browser/chromeos/cros/network_library.h" 25 #include "chrome/browser/chromeos/cros/network_library.h"
26 #include "chrome/browser/chromeos/external_cookie_handler.h" 26 #include "chrome/browser/chromeos/external_cookie_handler.h"
27 #include "chrome/browser/chromeos/input_method/input_method_util.h" 27 #include "chrome/browser/chromeos/input_method/input_method_util.h"
28 #include "chrome/browser/chromeos/login/cookie_fetcher.h" 28 #include "chrome/browser/chromeos/login/cookie_fetcher.h"
29 #include "chrome/browser/chromeos/login/google_authenticator.h" 29 #include "chrome/browser/chromeos/login/google_authenticator.h"
30 #include "chrome/browser/chromeos/login/language_switch_menu.h"
30 #include "chrome/browser/chromeos/login/ownership_service.h" 31 #include "chrome/browser/chromeos/login/ownership_service.h"
31 #include "chrome/browser/chromeos/login/parallel_authenticator.h" 32 #include "chrome/browser/chromeos/login/parallel_authenticator.h"
32 #include "chrome/browser/chromeos/login/user_image_downloader.h" 33 #include "chrome/browser/chromeos/login/user_image_downloader.h"
33 #include "chrome/browser/chromeos/login/user_manager.h" 34 #include "chrome/browser/chromeos/login/user_manager.h"
34 #include "chrome/browser/extensions/extensions_service.h" 35 #include "chrome/browser/extensions/extensions_service.h"
35 #include "chrome/browser/net/gaia/token_service.h" 36 #include "chrome/browser/net/gaia/token_service.h"
36 #include "chrome/browser/net/preconnect.h" 37 #include "chrome/browser/net/preconnect.h"
37 #include "chrome/browser/prefs/pref_member.h" 38 #include "chrome/browser/prefs/pref_member.h"
38 #include "chrome/browser/profile.h" 39 #include "chrome/browser/profile.h"
39 #include "chrome/browser/profile_manager.h" 40 #include "chrome/browser/profile_manager.h"
40 #include "chrome/browser/sync/profile_sync_service.h" 41 #include "chrome/browser/sync/profile_sync_service.h"
41 #include "chrome/common/chrome_paths.h" 42 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/chrome_switches.h" 43 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/logging_chrome.h" 44 #include "chrome/common/logging_chrome.h"
44 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 45 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
45 #include "chrome/common/net/gaia/gaia_constants.h" 46 #include "chrome/common/net/gaia/gaia_constants.h"
46 #include "chrome/common/net/url_request_context_getter.h" 47 #include "chrome/common/net/url_request_context_getter.h"
47 #include "chrome/common/pref_names.h" 48 #include "chrome/common/pref_names.h"
48 #include "googleurl/src/gurl.h" 49 #include "googleurl/src/gurl.h"
49 #include "net/base/cookie_store.h" 50 #include "net/base/cookie_store.h"
50 #include "net/url_request/url_request_context.h" 51 #include "net/url_request/url_request_context.h"
51 #include "views/widget/widget_gtk.h" 52 #include "views/widget/widget_gtk.h"
52 53
53 namespace chromeos { 54 namespace chromeos {
54 55
55 namespace { 56 namespace {
56 57
57 // Prefix for Auth token received from ClientLogin request. 58 // Affixes for Auth token received from ClientLogin request.
58 const char kAuthPrefix[] = "Auth="; 59 const char kAuthPrefix[] = "Auth=";
59 // Suffix for Auth token received from ClientLogin request.
60 const char kAuthSuffix[] = "\n"; 60 const char kAuthSuffix[] = "\n";
61 61
62 // Increase logging level for Guest mode to avoid LOG(INFO) messages in logs. 62 // Increase logging level for Guest mode to avoid LOG(INFO) messages in logs.
63 const char kGuestModeLoggingLevel[] = "1"; 63 const char kGuestModeLoggingLevel[] = "1";
64 64
65 // Format of command line switch. 65 // Format of command line switch.
66 const char kSwitchFormatString[] = "--%s=\"%s\""; 66 const char kSwitchFormatString[] = "--%s=\"%s\"";
67 67
68 } // namespace 68 } // namespace
69 69
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { 204 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) {
205 if (cryptohome->TpmIsOwned()) { 205 if (cryptohome->TpmIsOwned()) {
206 cryptohome->TpmClearStoredPassword(); 206 cryptohome->TpmClearStoredPassword();
207 } else { 207 } else {
208 cryptohome->TpmCanAttemptOwnership(); 208 cryptohome->TpmCanAttemptOwnership();
209 } 209 }
210 } 210 }
211 } 211 }
212 btl->AddLoginTimeMarker("TPMOwned", false); 212 btl->AddLoginTimeMarker("TPMOwned", false);
213 213
214 std::string pref_locale = profile->GetPrefs()->GetString(
Nikita (slow) 2010/11/13 10:36:59 Please extract into a separate method. CompleteLog
Denis Lagno 2010/11/13 12:48:23 Done.
215 prefs::kApplicationLocale);
216 if (pref_locale.empty()) {
217 if (first_login) {
Nikita (slow) 2010/11/13 10:36:59 How do you intend to bootstrap this option to the
Denis Lagno 2010/11/13 12:48:23 yes, I think check for first login does not resolv
Nikita (slow) 2010/11/15 07:54:41 Agree, there's one more thing remaining - conflict
218 profile->GetPrefs()->SetString(
Nikita (slow) 2010/11/13 10:36:59 As I understand we're always forcing language sele
Denis Lagno 2010/11/13 12:48:23 Done.
219 prefs::kApplicationLocale,
220 g_browser_process->GetApplicationLocale());
221 }
222 } else {
223 LanguageSwitchMenu::SwitchLanguage(pref_locale);
224 }
225
214 static const char kFallbackInputMethodLocale[] = "en-US"; 226 static const char kFallbackInputMethodLocale[] = "en-US";
215 if (first_login) { 227 if (first_login) {
216 std::string locale(g_browser_process->GetApplicationLocale()); 228 std::string locale(g_browser_process->GetApplicationLocale());
217 // Add input methods based on the application locale when the user first 229 // Add input methods based on the application locale when the user first
218 // logs in. For instance, if the user chooses Japanese as the UI 230 // logs in. For instance, if the user chooses Japanese as the UI
219 // language at the first login, we'll add input methods associated with 231 // language at the first login, we'll add input methods associated with
220 // Japanese, such as mozc. 232 // Japanese, such as mozc.
221 if (locale != kFallbackInputMethodLocale) { 233 if (locale != kFallbackInputMethodLocale) {
222 StringPrefMember language_preload_engines; 234 StringPrefMember language_preload_engines;
223 language_preload_engines.Init(prefs::kLanguagePreloadEngines, 235 language_preload_engines.Init(prefs::kLanguagePreloadEngines,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 BrowserInit browser_init; 397 BrowserInit browser_init;
386 int return_code; 398 int return_code;
387 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), 399 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(),
388 profile, 400 profile,
389 FilePath(), 401 FilePath(),
390 true, 402 true,
391 &return_code); 403 &return_code);
392 } 404 }
393 405
394 } // namespace chromeos 406 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698