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

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

Issue 1060573003: DevTools: cleanup unused method and constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor
Patch Set: rebaseline Created 5 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 | « chrome/browser/devtools/devtools_ui_bindings.h ('k') | 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 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 namespace { 66 namespace {
67 67
68 static const char kFrontendHostId[] = "id"; 68 static const char kFrontendHostId[] = "id";
69 static const char kFrontendHostMethod[] = "method"; 69 static const char kFrontendHostMethod[] = "method";
70 static const char kFrontendHostParams[] = "params"; 70 static const char kFrontendHostParams[] = "params";
71 static const char kTitleFormat[] = "Developer Tools - %s"; 71 static const char kTitleFormat[] = "Developer Tools - %s";
72 72
73 static const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken"; 73 static const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken";
74 static const int kDevToolsActionTakenBoundary = 100;
75 static const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown"; 74 static const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown";
76 static const int kDevToolsPanelShownBoundary = 20;
77 75
78 // This constant should be in sync with 76 // This constant should be in sync with
79 // the constant at shell_devtools_frontend.cc. 77 // the constant at shell_devtools_frontend.cc.
80 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; 78 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
81 79
82 typedef std::vector<DevToolsUIBindings*> DevToolsUIBindingsList; 80 typedef std::vector<DevToolsUIBindings*> DevToolsUIBindingsList;
83 base::LazyInstance<DevToolsUIBindingsList>::Leaky g_instances = 81 base::LazyInstance<DevToolsUIBindingsList>::Leaky g_instances =
84 LAZY_INSTANCE_INITIALIZER; 82 LAZY_INSTANCE_INITIALIZER;
85 83
86 std::string SkColorToRGBAString(SkColor color) { 84 std::string SkColorToRGBAString(SkColor color) {
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } else { 733 } else {
736 remote_targets_handler_.reset(); 734 remote_targets_handler_.reset();
737 } 735 }
738 } 736 }
739 737
740 void DevToolsUIBindings::SendMessageToBrowser(const std::string& message) { 738 void DevToolsUIBindings::SendMessageToBrowser(const std::string& message) {
741 if (agent_host_.get()) 739 if (agent_host_.get())
742 agent_host_->DispatchProtocolMessage(message); 740 agent_host_->DispatchProtocolMessage(message);
743 } 741 }
744 742
745 void DevToolsUIBindings::RecordActionUMA(const std::string& name, int action) {
746 if (name == kDevToolsActionTakenHistogram)
747 UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary);
748 else if (name == kDevToolsPanelShownHistogram)
749 UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary);
750 }
751
752 void DevToolsUIBindings::RecordEnumeratedHistogram(const std::string& name, 743 void DevToolsUIBindings::RecordEnumeratedHistogram(const std::string& name,
753 int sample, 744 int sample,
754 int boundary_value) { 745 int boundary_value) {
755 if (!(boundary_value >= 0 && boundary_value < 100 && sample >= 0 && 746 if (!(boundary_value >= 0 && boundary_value < 100 && sample >= 0 &&
756 sample < boundary_value)) { 747 sample < boundary_value)) {
757 frontend_host_->BadMessageRecieved(); 748 frontend_host_->BadMessageRecieved();
758 return; 749 return;
759 } 750 }
760 // Each histogram name must follow a different code path in 751 // Each histogram name must follow a different code path in
761 // order to UMA_HISTOGRAM_ENUMERATION work correctly. 752 // order to UMA_HISTOGRAM_ENUMERATION work correctly.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 if (frontend_loaded_) 1019 if (frontend_loaded_)
1029 return; 1020 return;
1030 frontend_loaded_ = true; 1021 frontend_loaded_ = true;
1031 1022
1032 // Call delegate first - it seeds importants bit of information. 1023 // Call delegate first - it seeds importants bit of information.
1033 delegate_->OnLoadCompleted(); 1024 delegate_->OnLoadCompleted();
1034 1025
1035 UpdateTheme(); 1026 UpdateTheme();
1036 AddDevToolsExtensionsToClient(); 1027 AddDevToolsExtensionsToClient();
1037 } 1028 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_ui_bindings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698