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

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

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/account_tracker_service_factory.h" 14 #include "chrome/browser/signin/account_tracker_service_factory.h"
13 #include "chrome/browser/supervised_user/supervised_user_service.h" 15 #include "chrome/browser/supervised_user/supervised_user_service.h"
14 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 16 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
15 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" 17 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
16 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h" 18 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h"
(...skipping 10 matching lines...) Expand all
27 // consisting of a title and a list of fields. Returns a pointer to the new 29 // consisting of a title and a list of fields. Returns a pointer to the new
28 // section's contents, for use with |AddSectionEntry| below. Note that 30 // section's contents, for use with |AddSectionEntry| below. Note that
29 // |parent_list|, not the caller, owns the newly added section. 31 // |parent_list|, not the caller, owns the newly added section.
30 base::ListValue* AddSection(base::ListValue* parent_list, 32 base::ListValue* AddSection(base::ListValue* parent_list,
31 const std::string& title) { 33 const std::string& title) {
32 scoped_ptr<base::DictionaryValue> section(new base::DictionaryValue); 34 scoped_ptr<base::DictionaryValue> section(new base::DictionaryValue);
33 scoped_ptr<base::ListValue> section_contents(new base::ListValue); 35 scoped_ptr<base::ListValue> section_contents(new base::ListValue);
34 section->SetString("title", title); 36 section->SetString("title", title);
35 // Grab a raw pointer to the result before |Pass()|ing it on. 37 // Grab a raw pointer to the result before |Pass()|ing it on.
36 base::ListValue* result = section_contents.get(); 38 base::ListValue* result = section_contents.get();
37 section->Set("data", section_contents.Pass()); 39 section->Set("data", std::move(section_contents));
38 parent_list->Append(section.Pass()); 40 parent_list->Append(std::move(section));
39 return result; 41 return result;
40 } 42 }
41 43
42 // Adds a bool entry to a section (created with |AddSection| above). 44 // Adds a bool entry to a section (created with |AddSection| above).
43 void AddSectionEntry(base::ListValue* section_list, 45 void AddSectionEntry(base::ListValue* section_list,
44 const std::string& name, 46 const std::string& name,
45 bool value) { 47 bool value) {
46 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); 48 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
47 entry->SetString("stat_name", name); 49 entry->SetString("stat_name", name);
48 entry->SetBoolean("stat_value", value); 50 entry->SetBoolean("stat_value", value);
49 entry->SetBoolean("is_valid", true); 51 entry->SetBoolean("is_valid", true);
50 section_list->Append(entry.Pass()); 52 section_list->Append(std::move(entry));
51 } 53 }
52 54
53 // Adds a string entry to a section (created with |AddSection| above). 55 // Adds a string entry to a section (created with |AddSection| above).
54 void AddSectionEntry(base::ListValue* section_list, 56 void AddSectionEntry(base::ListValue* section_list,
55 const std::string& name, 57 const std::string& name,
56 const std::string& value) { 58 const std::string& value) {
57 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); 59 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
58 entry->SetString("stat_name", name); 60 entry->SetString("stat_name", name);
59 entry->SetString("stat_value", value); 61 entry->SetString("stat_value", value);
60 entry->SetBoolean("is_valid", true); 62 entry->SetBoolean("is_valid", true);
61 section_list->Append(entry.Pass()); 63 section_list->Append(std::move(entry));
62 } 64 }
63 65
64 std::string FilteringBehaviorToString( 66 std::string FilteringBehaviorToString(
65 SupervisedUserURLFilter::FilteringBehavior behavior) { 67 SupervisedUserURLFilter::FilteringBehavior behavior) {
66 switch (behavior) { 68 switch (behavior) {
67 case SupervisedUserURLFilter::ALLOW: 69 case SupervisedUserURLFilter::ALLOW:
68 return "Allow"; 70 return "Allow";
69 case SupervisedUserURLFilter::WARN: 71 case SupervisedUserURLFilter::WARN:
70 return "Warn"; 72 return "Warn";
71 case SupervisedUserURLFilter::BLOCK: 73 case SupervisedUserURLFilter::BLOCK:
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 AddSectionEntry(section_user, "Gaia", account.gaia); 259 AddSectionEntry(section_user, "Gaia", account.gaia);
258 AddSectionEntry(section_user, "Email", account.email); 260 AddSectionEntry(section_user, "Email", account.email);
259 AddSectionEntry(section_user, "Given name", account.given_name); 261 AddSectionEntry(section_user, "Given name", account.given_name);
260 AddSectionEntry(section_user, "Hosted domain", account.hosted_domain); 262 AddSectionEntry(section_user, "Hosted domain", account.hosted_domain);
261 AddSectionEntry(section_user, "Locale", account.locale); 263 AddSectionEntry(section_user, "Locale", account.locale);
262 AddSectionEntry(section_user, "Is child", account.is_child_account); 264 AddSectionEntry(section_user, "Is child", account.is_child_account);
263 AddSectionEntry(section_user, "Is valid", account.IsValid()); 265 AddSectionEntry(section_user, "Is valid", account.IsValid());
264 } 266 }
265 267
266 base::DictionaryValue result; 268 base::DictionaryValue result;
267 result.Set("sections", section_list.Pass()); 269 result.Set("sections", std::move(section_list));
268 web_ui()->CallJavascriptFunction( 270 web_ui()->CallJavascriptFunction(
269 "chrome.supervised_user_internals.receiveBasicInfo", result); 271 "chrome.supervised_user_internals.receiveBasicInfo", result);
270 272
271 // Trigger retrieval of the user settings 273 // Trigger retrieval of the user settings
272 SupervisedUserSettingsService* settings_service = 274 SupervisedUserSettingsService* settings_service =
273 SupervisedUserSettingsServiceFactory::GetForProfile(profile); 275 SupervisedUserSettingsServiceFactory::GetForProfile(profile);
274 user_settings_subscription_ = settings_service->Subscribe(base::Bind( 276 user_settings_subscription_ = settings_service->Subscribe(base::Bind(
275 &SupervisedUserInternalsMessageHandler::SendSupervisedUserSettings, 277 &SupervisedUserInternalsMessageHandler::SendSupervisedUserSettings,
276 weak_factory_.GetWeakPtr())); 278 weak_factory_.GetWeakPtr()));
277 } 279 }
(...skipping 20 matching lines...) Expand all
298 SupervisedUserURLFilter::FilteringBehaviorReason reason, 300 SupervisedUserURLFilter::FilteringBehaviorReason reason,
299 bool uncertain) { 301 bool uncertain) {
300 DCHECK_CURRENTLY_ON(BrowserThread::UI); 302 DCHECK_CURRENTLY_ON(BrowserThread::UI);
301 base::DictionaryValue result; 303 base::DictionaryValue result;
302 result.SetString("url", url.possibly_invalid_spec()); 304 result.SetString("url", url.possibly_invalid_spec());
303 result.SetString("result", FilteringBehaviorToString(behavior, uncertain)); 305 result.SetString("result", FilteringBehaviorToString(behavior, uncertain));
304 result.SetString("reason", FilteringBehaviorReasonToString(reason)); 306 result.SetString("reason", FilteringBehaviorReasonToString(reason));
305 web_ui()->CallJavascriptFunction( 307 web_ui()->CallJavascriptFunction(
306 "chrome.supervised_user_internals.receiveFilteringResult", result); 308 "chrome.supervised_user_internals.receiveFilteringResult", result);
307 } 309 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698