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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.cc

Issue 10006028: Plugins page in BWSI session has unnecessary and misleading UI components (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit fix Created 8 years, 8 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/options2/chromeos/accounts_options_handler2.h" 5 #include "chrome/browser/ui/webui/options2/chromeos/accounts_options_handler2.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/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/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/chromeos/cros_settings.h" 14 #include "chrome/browser/chromeos/cros_settings.h"
15 #include "chrome/browser/chromeos/cros_settings_names.h" 15 #include "chrome/browser/chromeos/cros_settings_names.h"
16 #include "chrome/browser/chromeos/login/authenticator.h" 16 #include "chrome/browser/chromeos/login/authenticator.h"
17 #include "chrome/browser/chromeos/login/user_manager.h" 17 #include "chrome/browser/chromeos/login/user_manager.h"
18 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
19 #include "chrome/browser/policy/browser_policy_connector.h" 19 #include "chrome/browser/policy/browser_policy_connector.h"
20 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h"
20 #include "content/public/browser/web_ui.h" 21 #include "content/public/browser/web_ui.h"
21 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
23 24
24 namespace chromeos { 25 namespace chromeos {
25 26
26 namespace { 27 namespace {
27 28
28 // Adds specified user to the whitelist. Returns false if that user is already 29 // Adds specified user to the whitelist. Returns false if that user is already
29 // in the whitelist. 30 // in the whitelist.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 IDS_OPTIONS_ACCOUNTS_SHOW_USER_NAMES_ON_SINGIN_DESCRIPTION)); 74 IDS_OPTIONS_ACCOUNTS_SHOW_USER_NAMES_ON_SINGIN_DESCRIPTION));
74 localized_strings->SetString("username_edit_hint",l10n_util::GetStringUTF16( 75 localized_strings->SetString("username_edit_hint",l10n_util::GetStringUTF16(
75 IDS_OPTIONS_ACCOUNTS_USERNAME_EDIT_HINT)); 76 IDS_OPTIONS_ACCOUNTS_USERNAME_EDIT_HINT));
76 localized_strings->SetString("username_format",l10n_util::GetStringUTF16( 77 localized_strings->SetString("username_format",l10n_util::GetStringUTF16(
77 IDS_OPTIONS_ACCOUNTS_USERNAME_FORMAT)); 78 IDS_OPTIONS_ACCOUNTS_USERNAME_FORMAT));
78 localized_strings->SetString("add_users",l10n_util::GetStringUTF16( 79 localized_strings->SetString("add_users",l10n_util::GetStringUTF16(
79 IDS_OPTIONS_ACCOUNTS_ADD_USERS)); 80 IDS_OPTIONS_ACCOUNTS_ADD_USERS));
80 localized_strings->SetString("owner_only", l10n_util::GetStringUTF16( 81 localized_strings->SetString("owner_only", l10n_util::GetStringUTF16(
81 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); 82 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY));
82 83
83 std::string owner_email;
84 CrosSettings::Get()->GetString(kDeviceOwner, &owner_email);
85 // Translate owner's email to the display email.
86 std::string display_email =
87 UserManager::Get()->GetUserDisplayEmail(owner_email);
88 localized_strings->SetString("owner_user_id", UTF8ToUTF16(display_email));
89
90 localized_strings->SetString("current_user_is_owner",
91 UserManager::Get()->IsCurrentUserOwner() ?
92 ASCIIToUTF16("true") : ASCIIToUTF16("false"));
93 localized_strings->SetString("whitelist_is_managed", 84 localized_strings->SetString("whitelist_is_managed",
94 g_browser_process->browser_policy_connector()->IsEnterpriseManaged() ? 85 g_browser_process->browser_policy_connector()->IsEnterpriseManaged() ?
95 ASCIIToUTF16("true") : ASCIIToUTF16("false")); 86 ASCIIToUTF16("true") : ASCIIToUTF16("false"));
87
88 AddAccountUITweaksLocalizedValues(localized_strings);
96 } 89 }
97 90
98 void AccountsOptionsHandler::HandleWhitelistUser(const base::ListValue* args) { 91 void AccountsOptionsHandler::HandleWhitelistUser(const base::ListValue* args) {
99 std::string typed_email; 92 std::string typed_email;
100 std::string name; 93 std::string name;
101 if (!args->GetString(0, &typed_email) || 94 if (!args->GetString(0, &typed_email) ||
102 !args->GetString(1, &name)) { 95 !args->GetString(1, &name)) {
103 return; 96 return;
104 } 97 }
105 98
(...skipping 17 matching lines...) Expand all
123 DCHECK(args && args->empty()); 116 DCHECK(args && args->empty());
124 117
125 const UserList& users = UserManager::Get()->GetUsers(); 118 const UserList& users = UserManager::Get()->GetUsers();
126 for (UserList::const_iterator it = users.begin(); it < users.end(); ++it) { 119 for (UserList::const_iterator it = users.begin(); it < users.end(); ++it) {
127 WhitelistUser((*it)->email()); 120 WhitelistUser((*it)->email());
128 } 121 }
129 } 122 }
130 123
131 } // namespace options2 124 } // namespace options2
132 } // namespace chromeos 125 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698