OLD | NEW |
---|---|
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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 agent_host_->DispatchProtocolMessage(message); | 742 agent_host_->DispatchProtocolMessage(message); |
743 } | 743 } |
744 | 744 |
745 void DevToolsUIBindings::RecordActionUMA(const std::string& name, int action) { | 745 void DevToolsUIBindings::RecordActionUMA(const std::string& name, int action) { |
746 if (name == kDevToolsActionTakenHistogram) | 746 if (name == kDevToolsActionTakenHistogram) |
747 UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary); | 747 UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary); |
748 else if (name == kDevToolsPanelShownHistogram) | 748 else if (name == kDevToolsPanelShownHistogram) |
749 UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary); | 749 UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary); |
750 } | 750 } |
751 | 751 |
752 void DevToolsUIBindings::RecordUMA(const std::string& name, | |
753 int action, | |
754 int bucket_size) { | |
755 CHECK(0 < bucket_size && bucket_size < 100); | |
Tom Sepez
2015/04/03 17:46:51
CHECK-ing in the browser is bad when the renderer
lushnikov
2015/04/06 10:10:39
Done.
| |
756 CHECK(0 <= action && action < bucket_size); | |
757 | |
758 if (name == kDevToolsActionTakenHistogram || | |
759 name == kDevToolsPanelShownHistogram) | |
760 UMA_HISTOGRAM_ENUMERATION(name, action, bucket_size); | |
761 } | |
762 | |
752 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback, | 763 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback, |
753 const std::string& browser_id, | 764 const std::string& browser_id, |
754 const std::string& url) { | 765 const std::string& url) { |
755 if (!android_bridge_) { | 766 if (!android_bridge_) { |
756 callback.Run(nullptr); | 767 callback.Run(nullptr); |
757 return; | 768 return; |
758 } | 769 } |
759 android_bridge_->SendJsonRequest(browser_id, url, | 770 android_bridge_->SendJsonRequest(browser_id, url, |
760 base::Bind(&DevToolsUIBindings::JsonReceived, | 771 base::Bind(&DevToolsUIBindings::JsonReceived, |
761 weak_factory_.GetWeakPtr(), | 772 weak_factory_.GetWeakPtr(), |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 if (frontend_loaded_) | 1021 if (frontend_loaded_) |
1011 return; | 1022 return; |
1012 frontend_loaded_ = true; | 1023 frontend_loaded_ = true; |
1013 | 1024 |
1014 // Call delegate first - it seeds importants bit of information. | 1025 // Call delegate first - it seeds importants bit of information. |
1015 delegate_->OnLoadCompleted(); | 1026 delegate_->OnLoadCompleted(); |
1016 | 1027 |
1017 UpdateTheme(); | 1028 UpdateTheme(); |
1018 AddDevToolsExtensionsToClient(); | 1029 AddDevToolsExtensionsToClient(); |
1019 } | 1030 } |
OLD | NEW |