| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 namespace { | 74 namespace { |
| 75 | 75 |
| 76 static const char kFrontendHostId[] = "id"; | 76 static const char kFrontendHostId[] = "id"; |
| 77 static const char kFrontendHostMethod[] = "method"; | 77 static const char kFrontendHostMethod[] = "method"; |
| 78 static const char kFrontendHostParams[] = "params"; | 78 static const char kFrontendHostParams[] = "params"; |
| 79 static const char kTitleFormat[] = "Developer Tools - %s"; | 79 static const char kTitleFormat[] = "Developer Tools - %s"; |
| 80 | 80 |
| 81 static const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken"; | 81 static const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken"; |
| 82 static const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown"; | 82 static const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown"; |
| 83 static const char kDevtoolsDrawerShownHistogram[] = "DevTools.DrawerShown"; | |
| 84 | 83 |
| 85 static const char kRemotePageActionInspect[] = "inspect"; | 84 static const char kRemotePageActionInspect[] = "inspect"; |
| 86 static const char kRemotePageActionReload[] = "reload"; | 85 static const char kRemotePageActionReload[] = "reload"; |
| 87 static const char kRemotePageActionActivate[] = "activate"; | 86 static const char kRemotePageActionActivate[] = "activate"; |
| 88 static const char kRemotePageActionClose[] = "close"; | 87 static const char kRemotePageActionClose[] = "close"; |
| 89 | 88 |
| 90 // This constant should be in sync with | 89 // This constant should be in sync with |
| 91 // the constant at shell_devtools_frontend.cc. | 90 // the constant at shell_devtools_frontend.cc. |
| 92 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; | 91 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; |
| 93 | 92 |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 // TODO(nick): Replace with chrome::bad_message::ReceivedBadMessage(). | 922 // TODO(nick): Replace with chrome::bad_message::ReceivedBadMessage(). |
| 924 frontend_host_->BadMessageRecieved(); | 923 frontend_host_->BadMessageRecieved(); |
| 925 return; | 924 return; |
| 926 } | 925 } |
| 927 // Each histogram name must follow a different code path in | 926 // Each histogram name must follow a different code path in |
| 928 // order to UMA_HISTOGRAM_ENUMERATION work correctly. | 927 // order to UMA_HISTOGRAM_ENUMERATION work correctly. |
| 929 if (name == kDevToolsActionTakenHistogram) | 928 if (name == kDevToolsActionTakenHistogram) |
| 930 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); | 929 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); |
| 931 else if (name == kDevToolsPanelShownHistogram) | 930 else if (name == kDevToolsPanelShownHistogram) |
| 932 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); | 931 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); |
| 933 else if (name == kDevtoolsDrawerShownHistogram) | |
| 934 UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); | |
| 935 else | 932 else |
| 936 frontend_host_->BadMessageRecieved(); | 933 frontend_host_->BadMessageRecieved(); |
| 937 } | 934 } |
| 938 | 935 |
| 939 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback, | 936 void DevToolsUIBindings::SendJsonRequest(const DispatchCallback& callback, |
| 940 const std::string& browser_id, | 937 const std::string& browser_id, |
| 941 const std::string& url) { | 938 const std::string& url) { |
| 942 if (!android_bridge_) { | 939 if (!android_bridge_) { |
| 943 callback.Run(nullptr); | 940 callback.Run(nullptr); |
| 944 return; | 941 return; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 return; | 1216 return; |
| 1220 frontend_loaded_ = true; | 1217 frontend_loaded_ = true; |
| 1221 | 1218 |
| 1222 // Call delegate first - it seeds importants bit of information. | 1219 // Call delegate first - it seeds importants bit of information. |
| 1223 delegate_->OnLoadCompleted(); | 1220 delegate_->OnLoadCompleted(); |
| 1224 | 1221 |
| 1225 AddDevToolsExtensionsToClient(); | 1222 AddDevToolsExtensionsToClient(); |
| 1226 if (g_web_socket_api_channel) | 1223 if (g_web_socket_api_channel) |
| 1227 g_web_socket_api_channel->AttachedToBindings(this); | 1224 g_web_socket_api_channel->AttachedToBindings(this); |
| 1228 } | 1225 } |
| OLD | NEW |