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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 1520403004: Devtools: Add metrics for drawer views being shown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 namespace { 70 namespace {
71 71
72 static const char kFrontendHostId[] = "id"; 72 static const char kFrontendHostId[] = "id";
73 static const char kFrontendHostMethod[] = "method"; 73 static const char kFrontendHostMethod[] = "method";
74 static const char kFrontendHostParams[] = "params"; 74 static const char kFrontendHostParams[] = "params";
75 static const char kTitleFormat[] = "Developer Tools - %s"; 75 static const char kTitleFormat[] = "Developer Tools - %s";
76 76
77 static const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken"; 77 static const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken";
78 static const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown"; 78 static const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown";
79 static const char kDevtoolsDrawerShownHistogram[] = "DevTools.DrawerShown";
79 80
80 static const char kRemotePageActionInspect[] = "inspect"; 81 static const char kRemotePageActionInspect[] = "inspect";
81 static const char kRemotePageActionReload[] = "reload"; 82 static const char kRemotePageActionReload[] = "reload";
82 static const char kRemotePageActionActivate[] = "activate"; 83 static const char kRemotePageActionActivate[] = "activate";
83 static const char kRemotePageActionClose[] = "close"; 84 static const char kRemotePageActionClose[] = "close";
84 85
85 // This constant should be in sync with 86 // This constant should be in sync with
86 // the constant at shell_devtools_frontend.cc. 87 // the constant at shell_devtools_frontend.cc.
87 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; 88 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
88 89
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 // TODO(nick): Replace with chrome::bad_message::ReceivedBadMessage(). 913 // TODO(nick): Replace with chrome::bad_message::ReceivedBadMessage().
913 frontend_host_->BadMessageRecieved(); 914 frontend_host_->BadMessageRecieved();
914 return; 915 return;
915 } 916 }
916 // Each histogram name must follow a different code path in 917 // Each histogram name must follow a different code path in
917 // order to UMA_HISTOGRAM_ENUMERATION work correctly. 918 // order to UMA_HISTOGRAM_ENUMERATION work correctly.
918 if (name == kDevToolsActionTakenHistogram) 919 if (name == kDevToolsActionTakenHistogram)
919 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); 920 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value);
920 else if (name == kDevToolsPanelShownHistogram) 921 else if (name == kDevToolsPanelShownHistogram)
921 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); 922 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value);
923 else if (name == kDevtoolsDrawerShownHistogram)
924 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value);
922 else 925 else
923 frontend_host_->BadMessageRecieved(); 926 frontend_host_->BadMessageRecieved();
924 } 927 }
925 928
926 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback, 929 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback,
927 const std::string& browser_id, 930 const std::string& browser_id,
928 const std::string& url) { 931 const std::string& url) {
929 if (!android_bridge_) { 932 if (!android_bridge_) {
930 callback.Run(nullptr); 933 callback.Run(nullptr);
931 return; 934 return;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 return; 1209 return;
1207 frontend_loaded_ = true; 1210 frontend_loaded_ = true;
1208 1211
1209 // Call delegate first - it seeds importants bit of information. 1212 // Call delegate first - it seeds importants bit of information.
1210 delegate_->OnLoadCompleted(); 1213 delegate_->OnLoadCompleted();
1211 1214
1212 AddDevToolsExtensionsToClient(); 1215 AddDevToolsExtensionsToClient();
1213 if (g_web_socket_api_channel) 1216 if (g_web_socket_api_channel)
1214 g_web_socket_api_channel->AttachedToBindings(this); 1217 g_web_socket_api_channel->AttachedToBindings(this);
1215 } 1218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698