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

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

Issue 7171018: User Settings on CrOS now shows the managed banner for enrolled devices. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed comments. Created 9 years, 6 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
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/accounts_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chromeos/cros_settings_names.h" 12 #include "chrome/browser/chromeos/cros_settings_names.h"
13 #include "chrome/browser/chromeos/login/authenticator.h" 13 #include "chrome/browser/chromeos/login/authenticator.h"
14 #include "chrome/browser/chromeos/login/user_manager.h" 14 #include "chrome/browser/chromeos/login/user_manager.h"
15 #include "chrome/browser/chromeos/user_cros_settings_provider.h" 15 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
16 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" 17 #include "chrome/browser/policy/browser_policy_connector.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 20
21 namespace chromeos { 21 namespace chromeos {
22 22
23 AccountsOptionsHandler::AccountsOptionsHandler() 23 AccountsOptionsHandler::AccountsOptionsHandler()
24 : CrosOptionsPageUIHandler(new UserCrosSettingsProvider) { 24 : CrosOptionsPageUIHandler(new UserCrosSettingsProvider) {
25 } 25 }
26 26
27 AccountsOptionsHandler::~AccountsOptionsHandler() { 27 AccountsOptionsHandler::~AccountsOptionsHandler() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 localized_strings->SetString("owner_user_id", UTF8ToUTF16( 61 localized_strings->SetString("owner_user_id", UTF8ToUTF16(
62 UserCrosSettingsProvider::cached_owner())); 62 UserCrosSettingsProvider::cached_owner()));
63 63
64 localized_strings->SetString("current_user_is_owner", 64 localized_strings->SetString("current_user_is_owner",
65 UserManager::Get()->current_user_is_owner() ? 65 UserManager::Get()->current_user_is_owner() ?
66 ASCIIToUTF16("true") : ASCIIToUTF16("false")); 66 ASCIIToUTF16("true") : ASCIIToUTF16("false"));
67 localized_strings->SetString("logged_in_as_guest", 67 localized_strings->SetString("logged_in_as_guest",
68 UserManager::Get()->IsLoggedInAsGuest() ? 68 UserManager::Get()->IsLoggedInAsGuest() ?
69 ASCIIToUTF16("true") : ASCIIToUTF16("false")); 69 ASCIIToUTF16("true") : ASCIIToUTF16("false"));
70 localized_strings->SetString("whitelist_is_managed", 70 localized_strings->SetString("whitelist_is_managed",
71 g_browser_process->local_state()->IsManagedPreference( 71 g_browser_process->browser_policy_connector()->IsEnterpriseManaged() ?
72 kAccountsPrefUsers) ? ASCIIToUTF16("true") : ASCIIToUTF16("false")); 72 ASCIIToUTF16("true") : ASCIIToUTF16("false"));
73 } 73 }
74 74
75 UserCrosSettingsProvider* AccountsOptionsHandler::users_settings() const { 75 UserCrosSettingsProvider* AccountsOptionsHandler::users_settings() const {
76 return static_cast<UserCrosSettingsProvider*>(settings_provider_.get()); 76 return static_cast<UserCrosSettingsProvider*>(settings_provider_.get());
77 } 77 }
78 78
79 void AccountsOptionsHandler::WhitelistUser(const ListValue* args) { 79 void AccountsOptionsHandler::WhitelistUser(const ListValue* args) {
80 std::string email; 80 std::string email;
81 if (!args->GetString(0, &email)) { 81 if (!args->GetString(0, &email)) {
82 return; 82 return;
(...skipping 25 matching lines...) Expand all
108 user_dict->SetString("email", email); 108 user_dict->SetString("email", email);
109 user_dict->SetBoolean("owner", false); 109 user_dict->SetBoolean("owner", false);
110 110
111 whitelist_users.Append(user_dict); 111 whitelist_users.Append(user_dict);
112 } 112 }
113 } 113 }
114 114
115 web_ui_->CallJavascriptFunction("AccountsOptions.addUsers", whitelist_users); 115 web_ui_->CallJavascriptFunction("AccountsOptions.addUsers", whitelist_users);
116 } 116 }
117 117
118 void AccountsOptionsHandler::Initialize() {
119 DCHECK(web_ui_);
120 banner_handler_.reset(
121 OptionsManagedBannerHandler::Create(web_ui_,
122 ASCIIToUTF16("AccountsOptions"),
123 OPTIONS_PAGE_ACCOUNTS));
124 }
125
126 } // namespace chromeos 118 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698