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

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

Issue 2723633002: Add Physical Web OnInitialDisplay Uma (Closed)
Patch Set: fix tests 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
« 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 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 "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/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 metadata_list_item.description); 50 metadata_list_item.description);
51 // Add the item index so when an item is selected, the index can be recorded 51 // Add the item index so when an item is selected, the index can be recorded
52 // in a UMA histogram. 52 // in a UMA histogram.
53 metadata_item->SetInteger(physical_web_ui::kIndex, index); 53 metadata_item->SetInteger(physical_web_ui::kIndex, index);
54 metadata->Append(std::move(metadata_item)); 54 metadata->Append(std::move(metadata_item));
55 ++index; 55 ++index;
56 } 56 }
57 57
58 results.Set(physical_web_ui::kMetadata, metadata.release()); 58 results.Set(physical_web_ui::kMetadata, metadata.release());
59 59
60 UMA_HISTOGRAM_EXACT_LINEAR("PhysicalWeb.TotalUrls.OnInitialDisplay",
61 (int)metadata_list->size(), 50);
62
60 // Pass the list of Physical Web URL metadata to the WebUI. A jstemplate will 63 // Pass the list of Physical Web URL metadata to the WebUI. A jstemplate will
61 // create a list view with an item for each URL. 64 // create a list view with an item for each URL.
62 CallJavaScriptFunction(physical_web_ui::kReturnNearbyUrls, results); 65 CallJavaScriptFunction(physical_web_ui::kReturnNearbyUrls, results);
63 } 66 }
64 67
65 void PhysicalWebBaseMessageHandler::HandlePhysicalWebItemClicked( 68 void PhysicalWebBaseMessageHandler::HandlePhysicalWebItemClicked(
66 const base::ListValue* args) { 69 const base::ListValue* args) {
67 int index = 0; 70 int index = 0;
68 if (!args->GetInteger(0, &index)) { 71 if (!args->GetInteger(0, &index)) {
69 DLOG(ERROR) << "Invalid selection index"; 72 DLOG(ERROR) << "Invalid selection index";
70 return; 73 return;
71 } 74 }
72 75
73 // Record the index of the selected item. 76 // Record the index of the selected item.
74 UMA_HISTOGRAM_EXACT_LINEAR("PhysicalWeb.WebUI.ListViewUrlPosition", index, 77 UMA_HISTOGRAM_EXACT_LINEAR("PhysicalWeb.WebUI.ListViewUrlPosition", index,
75 50); 78 50);
76 79
77 // Count the number of selections. 80 // Count the number of selections.
78 base::RecordAction( 81 base::RecordAction(
79 base::UserMetricsAction("PhysicalWeb.WebUI.ListViewUrlSelected")); 82 base::UserMetricsAction("PhysicalWeb.WebUI.ListViewUrlSelected"));
80 } 83 }
81 84
82 } // namespace physical_web_ui 85 } // namespace physical_web_ui
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