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

Side by Side Diff: chrome/browser/ui/webui/supervised_user_internals_message_handler.cc

Issue 1859393002: chrome://supervised-user-internals: handle null AccountTrackerService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@policy_bleh
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/supervised_user_internals_message_handler.h" 5 #include "chrome/browser/ui/webui/supervised_user_internals_message_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 base::ListValue* section_filter = AddSection(section_list.get(), "Filter"); 259 base::ListValue* section_filter = AddSection(section_list.get(), "Filter");
260 AddSectionEntry(section_filter, "Blacklist active", filter->HasBlacklist()); 260 AddSectionEntry(section_filter, "Blacklist active", filter->HasBlacklist());
261 AddSectionEntry(section_filter, "Online checks active", 261 AddSectionEntry(section_filter, "Online checks active",
262 filter->HasAsyncURLChecker()); 262 filter->HasAsyncURLChecker());
263 AddSectionEntry(section_filter, "Default behavior", 263 AddSectionEntry(section_filter, "Default behavior",
264 FilteringBehaviorToString( 264 FilteringBehaviorToString(
265 filter->GetDefaultFilteringBehavior())); 265 filter->GetDefaultFilteringBehavior()));
266 266
267 AccountTrackerService* account_tracker = 267 AccountTrackerService* account_tracker =
268 AccountTrackerServiceFactory::GetForProfile(profile); 268 AccountTrackerServiceFactory::GetForProfile(profile);
269 269 // |account_tracker| is null in incognito and guest profiles.
270 for (const auto& account: account_tracker->GetAccounts()) { 270 if (account_tracker) {
271 base::ListValue* section_user = AddSection(section_list.get(), 271 for (const auto& account: account_tracker->GetAccounts()) {
272 "User Information for " + account.full_name); 272 base::ListValue* section_user = AddSection(section_list.get(),
273 AddSectionEntry(section_user, "Account id", account.account_id); 273 "User Information for " + account.full_name);
274 AddSectionEntry(section_user, "Gaia", account.gaia); 274 AddSectionEntry(section_user, "Account id", account.account_id);
275 AddSectionEntry(section_user, "Email", account.email); 275 AddSectionEntry(section_user, "Gaia", account.gaia);
276 AddSectionEntry(section_user, "Given name", account.given_name); 276 AddSectionEntry(section_user, "Email", account.email);
277 AddSectionEntry(section_user, "Hosted domain", account.hosted_domain); 277 AddSectionEntry(section_user, "Given name", account.given_name);
278 AddSectionEntry(section_user, "Locale", account.locale); 278 AddSectionEntry(section_user, "Hosted domain", account.hosted_domain);
279 AddSectionEntry(section_user, "Is child", account.is_child_account); 279 AddSectionEntry(section_user, "Locale", account.locale);
280 AddSectionEntry(section_user, "Is valid", account.IsValid()); 280 AddSectionEntry(section_user, "Is child", account.is_child_account);
281 AddSectionEntry(section_user, "Is valid", account.IsValid());
282 }
281 } 283 }
282 284
283 base::DictionaryValue result; 285 base::DictionaryValue result;
284 result.Set("sections", std::move(section_list)); 286 result.Set("sections", std::move(section_list));
285 web_ui()->CallJavascriptFunction( 287 web_ui()->CallJavascriptFunction(
286 "chrome.supervised_user_internals.receiveBasicInfo", result); 288 "chrome.supervised_user_internals.receiveBasicInfo", result);
287 289
288 // Trigger retrieval of the user settings 290 // Trigger retrieval of the user settings
289 SupervisedUserSettingsService* settings_service = 291 SupervisedUserSettingsService* settings_service =
290 SupervisedUserSettingsServiceFactory::GetForProfile(profile); 292 SupervisedUserSettingsServiceFactory::GetForProfile(profile);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 supervised_user_error_page::FilteringBehaviorReason reason, 330 supervised_user_error_page::FilteringBehaviorReason reason,
329 bool uncertain) { 331 bool uncertain) {
330 DCHECK_CURRENTLY_ON(BrowserThread::UI); 332 DCHECK_CURRENTLY_ON(BrowserThread::UI);
331 base::DictionaryValue result; 333 base::DictionaryValue result;
332 result.SetString("url", url.possibly_invalid_spec()); 334 result.SetString("url", url.possibly_invalid_spec());
333 result.SetString("result", FilteringBehaviorToString(behavior, uncertain)); 335 result.SetString("result", FilteringBehaviorToString(behavior, uncertain));
334 result.SetString("reason", FilteringBehaviorReasonToString(reason)); 336 result.SetString("reason", FilteringBehaviorReasonToString(reason));
335 web_ui()->CallJavascriptFunction( 337 web_ui()->CallJavascriptFunction(
336 "chrome.supervised_user_internals.receiveFilteringResult", result); 338 "chrome.supervised_user_internals.receiveFilteringResult", result);
337 } 339 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698