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

Side by Side Diff: components/physical_web/webui/physical_web_base_message_handler.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Nits Created 3 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
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 "components/physical_web/webui/physical_web_base_message_handler.h" 5 #include "components/physical_web/webui/physical_web_base_message_handler.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
9 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
10 #include "base/metrics/user_metrics.h" 12 #include "base/metrics/user_metrics.h"
11 #include "components/physical_web/data_source/physical_web_data_source.h" 13 #include "components/physical_web/data_source/physical_web_data_source.h"
12 #include "components/physical_web/webui/physical_web_ui_constants.h" 14 #include "components/physical_web/webui/physical_web_ui_constants.h"
13 15
14 namespace physical_web_ui { 16 namespace physical_web_ui {
15 17
16 PhysicalWebBaseMessageHandler::PhysicalWebBaseMessageHandler() 18 PhysicalWebBaseMessageHandler::PhysicalWebBaseMessageHandler()
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 metadata_list_item.title); 83 metadata_list_item.title);
82 metadata_item->SetString(physical_web_ui::kPageInfoDescription, 84 metadata_item->SetString(physical_web_ui::kPageInfoDescription,
83 metadata_list_item.description); 85 metadata_list_item.description);
84 // Add the item index so when an item is selected, the index can be recorded 86 // Add the item index so when an item is selected, the index can be recorded
85 // in a UMA histogram. 87 // in a UMA histogram.
86 metadata_item->SetInteger(physical_web_ui::kIndex, index); 88 metadata_item->SetInteger(physical_web_ui::kIndex, index);
87 metadata->Append(std::move(metadata_item)); 89 metadata->Append(std::move(metadata_item));
88 ++index; 90 ++index;
89 } 91 }
90 92
91 results.Set(physical_web_ui::kMetadata, metadata.release()); 93 results.Set(physical_web_ui::kMetadata, std::move(metadata));
92 94
93 // Pass the list of Physical Web URL metadata to the WebUI. A jstemplate will 95 // Pass the list of Physical Web URL metadata to the WebUI. A jstemplate will
94 // create a list view with an item for each URL. 96 // create a list view with an item for each URL.
95 CallJavaScriptFunction(physical_web_ui::kPushNearbyUrls, results); 97 CallJavaScriptFunction(physical_web_ui::kPushNearbyUrls, results);
96 } 98 }
97 99
98 void PhysicalWebBaseMessageHandler::HandlePhysicalWebPageLoaded( 100 void PhysicalWebBaseMessageHandler::HandlePhysicalWebPageLoaded(
99 const base::ListValue* args) { 101 const base::ListValue* args) {
100 PushNearbyURLs(); 102 PushNearbyURLs();
101 UMA_HISTOGRAM_EXACT_LINEAR("PhysicalWeb.TotalUrls.OnInitialDisplay", 103 UMA_HISTOGRAM_EXACT_LINEAR("PhysicalWeb.TotalUrls.OnInitialDisplay",
(...skipping 11 matching lines...) Expand all
113 // Record the index of the selected item. 115 // Record the index of the selected item.
114 UMA_HISTOGRAM_EXACT_LINEAR("PhysicalWeb.WebUI.ListViewUrlPosition", index, 116 UMA_HISTOGRAM_EXACT_LINEAR("PhysicalWeb.WebUI.ListViewUrlPosition", index,
115 50); 117 50);
116 118
117 // Count the number of selections. 119 // Count the number of selections.
118 base::RecordAction( 120 base::RecordAction(
119 base::UserMetricsAction("PhysicalWeb.WebUI.ListViewUrlSelected")); 121 base::UserMetricsAction("PhysicalWeb.WebUI.ListViewUrlSelected"));
120 } 122 }
121 123
122 } // namespace physical_web_ui 124 } // namespace physical_web_ui
OLDNEW
« no previous file with comments | « components/login/screens/screen_context.cc ('k') | components/policy/core/common/config_dir_policy_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698