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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
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/ui/webui/options/chromeos/cros_language_options_handler .h" 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/chromeos/input_method/input_method_util.h" 13 #include "chrome/browser/chromeos/input_method/input_method_util.h"
14 #include "chrome/browser/chromeos/login/users/user_manager.h"
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" 14 #include "chrome/browser/chromeos/profiles/profile_helper.h"
16 #include "chrome/browser/extensions/extension_tab_util.h" 15 #include "chrome/browser/extensions/extension_tab_util.h"
17 #include "chrome/browser/lifetime/application_lifetime.h" 16 #include "chrome/browser/lifetime/application_lifetime.h"
18 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
21 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
24 #include "chrome/common/extensions/manifest_url_handler.h" 23 #include "chrome/common/extensions/manifest_url_handler.h"
25 #include "chromeos/ime/component_extension_ime_manager.h" 24 #include "chromeos/ime/component_extension_ime_manager.h"
26 #include "chromeos/ime/extension_ime_util.h" 25 #include "chromeos/ime/extension_ime_util.h"
27 #include "chromeos/ime/input_method_manager.h" 26 #include "chromeos/ime/input_method_manager.h"
27 #include "components/user_manager/user_manager.h"
28 #include "components/user_manager/user_type.h" 28 #include "components/user_manager/user_type.h"
29 #include "content/public/browser/navigation_controller.h" 29 #include "content/public/browser/navigation_controller.h"
30 #include "content/public/browser/user_metrics.h" 30 #include "content/public/browser/user_metrics.h"
31 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
32 #include "extensions/browser/extension_registry.h" 32 #include "extensions/browser/extension_registry.h"
33 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
34 #include "grit/chromium_strings.h" 34 #include "grit/chromium_strings.h"
35 #include "grit/generated_resources.h" 35 #include "grit/generated_resources.h"
36 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
37 37
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return ime_ids_list.release(); 177 return ime_ids_list.release();
178 } 178 }
179 179
180 base::string16 CrosLanguageOptionsHandler::GetProductName() { 180 base::string16 CrosLanguageOptionsHandler::GetProductName() {
181 return l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME); 181 return l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME);
182 } 182 }
183 183
184 void CrosLanguageOptionsHandler::SetApplicationLocale( 184 void CrosLanguageOptionsHandler::SetApplicationLocale(
185 const std::string& language_code) { 185 const std::string& language_code) {
186 Profile* profile = Profile::FromWebUI(web_ui()); 186 Profile* profile = Profile::FromWebUI(web_ui());
187 UserManager* user_manager = UserManager::Get(); 187 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
188 188
189 // Secondary users and public session users cannot change the locale. 189 // Secondary users and public session users cannot change the locale.
190 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); 190 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile);
191 if (user && 191 if (user &&
192 user->email() == user_manager->GetPrimaryUser()->email() && 192 user->email() == user_manager->GetPrimaryUser()->email() &&
193 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { 193 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) {
194 profile->ChangeAppLocale(language_code, 194 profile->ChangeAppLocale(language_code,
195 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); 195 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS);
196 } 196 }
197 } 197 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); 263 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id);
264 const extensions::Extension* extension = 264 const extensions::Extension* extension =
265 enabled_extensions.GetByID(extension_id); 265 enabled_extensions.GetByID(extension_id);
266 if (extension) 266 if (extension)
267 entry->SetString("extensionName", extension->name()); 267 entry->SetString("extensionName", extension->name());
268 } 268 }
269 } 269 }
270 270
271 } // namespace options 271 } // namespace options
272 } // namespace chromeos 272 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698