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 bool valid_name = name == kDevToolsActionTakenHistogram || | |
756 name == kDevToolsPanelShownHistogram; | |
757 if (bucket_size >= 0 && bucket_size < 100 && | |
758 action >= 0 && action < bucket_size && valid_name) | |
759 UMA_HISTOGRAM_ENUMERATION(name, action, bucket_size); | |
dgozman
2015/04/06 10:07:04
Please wrap in {}
lushnikov
2015/04/06 10:10:06
Done.
| |
760 else | |
761 frontend_host_->BadMessageRecieved(); | |
762 } | |
763 | |
752 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback, | 764 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback, |
753 const std::string& browser_id, | 765 const std::string& browser_id, |
754 const std::string& url) { | 766 const std::string& url) { |
755 if (!android_bridge_) { | 767 if (!android_bridge_) { |
756 callback.Run(nullptr); | 768 callback.Run(nullptr); |
757 return; | 769 return; |
758 } | 770 } |
759 android_bridge_->SendJsonRequest(browser_id, url, | 771 android_bridge_->SendJsonRequest(browser_id, url, |
760 base::Bind(&DevToolsUIBindings::JsonReceived, | 772 base::Bind(&DevToolsUIBindings::JsonReceived, |
761 weak_factory_.GetWeakPtr(), | 773 weak_factory_.GetWeakPtr(), |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1010 if (frontend_loaded_) | 1022 if (frontend_loaded_) |
1011 return; | 1023 return; |
1012 frontend_loaded_ = true; | 1024 frontend_loaded_ = true; |
1013 | 1025 |
1014 // Call delegate first - it seeds importants bit of information. | 1026 // Call delegate first - it seeds importants bit of information. |
1015 delegate_->OnLoadCompleted(); | 1027 delegate_->OnLoadCompleted(); |
1016 | 1028 |
1017 UpdateTheme(); | 1029 UpdateTheme(); |
1018 AddDevToolsExtensionsToClient(); | 1030 AddDevToolsExtensionsToClient(); |
1019 } | 1031 } |
OLD | NEW |