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

Side by Side Diff: chrome/browser/ui/webui/settings/profile_info_handler.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/profile_info_handler.h" 5 #include "chrome/browser/ui/webui/settings/profile_info_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 count = 0; 146 count = 0;
147 break; 147 break;
148 } 148 }
149 count += item.count; 149 count += item.count;
150 } 150 }
151 // PushProfileStatsCount gets invoked multiple times as each stat becomes 151 // PushProfileStatsCount gets invoked multiple times as each stat becomes
152 // available. Therefore, webUIListenerCallback mechanism is used instead of 152 // available. Therefore, webUIListenerCallback mechanism is used instead of
153 // the Promise callback approach. 153 // the Promise callback approach.
154 CallJavascriptFunction("cr.webUIListenerCallback", 154 CallJavascriptFunction("cr.webUIListenerCallback",
155 base::StringValue(kProfileStatsCountReadyEventName), 155 base::StringValue(kProfileStatsCountReadyEventName),
156 base::FundamentalValue(count)); 156 base::Value(count));
157 } 157 }
158 #endif 158 #endif
159 159
160 void ProfileInfoHandler::HandleGetProfileManagesSupervisedUsers( 160 void ProfileInfoHandler::HandleGetProfileManagesSupervisedUsers(
161 const base::ListValue* args) { 161 const base::ListValue* args) {
162 AllowJavascript(); 162 AllowJavascript();
163 163
164 CHECK_EQ(1U, args->GetSize()); 164 CHECK_EQ(1U, args->GetSize());
165 const base::Value* callback_id; 165 const base::Value* callback_id;
166 CHECK(args->Get(0, &callback_id)); 166 CHECK(args->Get(0, &callback_id));
167 167
168 ResolveJavascriptCallback( 168 ResolveJavascriptCallback(*callback_id,
169 *callback_id, base::FundamentalValue(IsProfileManagingSupervisedUsers())); 169 base::Value(IsProfileManagingSupervisedUsers()));
170 } 170 }
171 171
172 void ProfileInfoHandler::PushProfileInfo() { 172 void ProfileInfoHandler::PushProfileInfo() {
173 CallJavascriptFunction("cr.webUIListenerCallback", 173 CallJavascriptFunction("cr.webUIListenerCallback",
174 base::StringValue(kProfileInfoChangedEventName), 174 base::StringValue(kProfileInfoChangedEventName),
175 *GetAccountNameAndIcon()); 175 *GetAccountNameAndIcon());
176 } 176 }
177 177
178 void ProfileInfoHandler::PushProfileManagesSupervisedUsersStatus() { 178 void ProfileInfoHandler::PushProfileManagesSupervisedUsersStatus() {
179 CallJavascriptFunction( 179 CallJavascriptFunction(
180 "cr.webUIListenerCallback", 180 "cr.webUIListenerCallback",
181 base::StringValue(kProfileManagesSupervisedUsersChangedEventName), 181 base::StringValue(kProfileManagesSupervisedUsersChangedEventName),
182 base::FundamentalValue(IsProfileManagingSupervisedUsers())); 182 base::Value(IsProfileManagingSupervisedUsers()));
183 } 183 }
184 184
185 std::unique_ptr<base::DictionaryValue> 185 std::unique_ptr<base::DictionaryValue>
186 ProfileInfoHandler::GetAccountNameAndIcon() const { 186 ProfileInfoHandler::GetAccountNameAndIcon() const {
187 std::string name; 187 std::string name;
188 std::string icon_url; 188 std::string icon_url;
189 189
190 #if defined(OS_CHROMEOS) 190 #if defined(OS_CHROMEOS)
191 name = profile_->GetProfileUserName(); 191 name = profile_->GetProfileUserName();
192 std::string user_email; 192 std::string user_email;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 response->SetString("name", name); 230 response->SetString("name", name);
231 response->SetString("iconUrl", icon_url); 231 response->SetString("iconUrl", icon_url);
232 return base::WrapUnique(response); 232 return base::WrapUnique(response);
233 } 233 }
234 234
235 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { 235 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const {
236 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); 236 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty();
237 } 237 }
238 238
239 } // namespace settings 239 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698