| 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/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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 bindings_->open_api_channel_ = nullptr; | 394 bindings_->open_api_channel_ = nullptr; |
| 395 } | 395 } |
| 396 | 396 |
| 397 void DevToolsUIBindings::WebSocketAPIChannel::DispatchOnClientHost( | 397 void DevToolsUIBindings::WebSocketAPIChannel::DispatchOnClientHost( |
| 398 const std::string& message) { | 398 const std::string& message) { |
| 399 if (attached_proxy_) | 399 if (attached_proxy_) |
| 400 attached_proxy_->DispatchOnClientHost(message); | 400 attached_proxy_->DispatchOnClientHost(message); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void DevToolsUIBindings::WebSocketAPIChannel::ConnectionClosed() { | 403 void DevToolsUIBindings::WebSocketAPIChannel::ConnectionClosed() { |
| 404 if (bindings_) { |
| 405 bindings_->CallClientFunction("DevToolsAPI.frontendAPIDetached", |
| 406 nullptr, nullptr, nullptr); |
| 407 } |
| 404 if (attached_proxy_) | 408 if (attached_proxy_) |
| 405 attached_proxy_->ConnectionClosed(); | 409 attached_proxy_->ConnectionClosed(); |
| 406 } | 410 } |
| 407 | 411 |
| 408 void DevToolsUIBindings::WebSocketAPIChannel::Attach( | 412 void DevToolsUIBindings::WebSocketAPIChannel::Attach( |
| 409 content::DevToolsExternalAgentProxy* proxy) { | 413 content::DevToolsExternalAgentProxy* proxy) { |
| 410 attached_proxy_ = proxy; | 414 attached_proxy_ = proxy; |
| 411 if (bindings_) { | 415 if (bindings_) { |
| 412 bindings_->CallClientFunction("DevToolsAPI.frontendAPIAttached", | 416 bindings_->CallClientFunction("DevToolsAPI.frontendAPIAttached", |
| 413 nullptr, nullptr, nullptr); | 417 nullptr, nullptr, nullptr); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 void DevToolsUIBindings::FrontendLoaded() { | 1080 void DevToolsUIBindings::FrontendLoaded() { |
| 1077 if (frontend_loaded_) | 1081 if (frontend_loaded_) |
| 1078 return; | 1082 return; |
| 1079 frontend_loaded_ = true; | 1083 frontend_loaded_ = true; |
| 1080 | 1084 |
| 1081 // Call delegate first - it seeds importants bit of information. | 1085 // Call delegate first - it seeds importants bit of information. |
| 1082 delegate_->OnLoadCompleted(); | 1086 delegate_->OnLoadCompleted(); |
| 1083 | 1087 |
| 1084 AddDevToolsExtensionsToClient(); | 1088 AddDevToolsExtensionsToClient(); |
| 1085 } | 1089 } |
| OLD | NEW |