| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/html_viewer/devtools_agent_impl.h" | 5 #include "components/html_viewer/devtools_agent_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 DevToolsAgentImpl::DevToolsAgentImpl(blink::WebLocalFrame* frame, | 22 DevToolsAgentImpl::DevToolsAgentImpl(blink::WebLocalFrame* frame, |
| 23 mojo::Shell* shell) | 23 mojo::Shell* shell) |
| 24 : frame_(frame), binding_(this), handling_page_navigate_request_(false) { | 24 : frame_(frame), binding_(this), handling_page_navigate_request_(false) { |
| 25 DCHECK(frame); | 25 DCHECK(frame); |
| 26 DCHECK(shell); | 26 DCHECK(shell); |
| 27 | 27 |
| 28 mojo::ServiceProviderPtr devtools_service_provider; | 28 mojo::ServiceProviderPtr devtools_service_provider; |
| 29 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 29 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 30 request->url = "mojo:devtools_service"; | 30 request->url = "mojo:devtools_service"; |
| 31 shell->ConnectToApplication( | 31 shell->ConnectToApplication(request.Pass(), |
| 32 request.Pass(), mojo::GetProxy(&devtools_service_provider), nullptr); | 32 mojo::GetProxy(&devtools_service_provider), |
| 33 nullptr, |
| 34 nullptr); |
| 33 devtools_service::DevToolsRegistryPtr devtools_registry; | 35 devtools_service::DevToolsRegistryPtr devtools_registry; |
| 34 mojo::ConnectToService(devtools_service_provider.get(), &devtools_registry); | 36 mojo::ConnectToService(devtools_service_provider.get(), &devtools_registry); |
| 35 | 37 |
| 36 devtools_service::DevToolsAgentPtr agent; | 38 devtools_service::DevToolsAgentPtr agent; |
| 37 binding_.Bind(&agent); | 39 binding_.Bind(&agent); |
| 38 devtools_registry->RegisterAgent(agent.Pass()); | 40 devtools_registry->RegisterAgent(agent.Pass()); |
| 39 | 41 |
| 40 frame_->setDevToolsAgentClient(this); | 42 frame_->setDevToolsAgentClient(this); |
| 41 } | 43 } |
| 42 | 44 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (client_) | 102 if (client_) |
| 101 client_->DispatchProtocolMessage(response.utf8()); | 103 client_->DispatchProtocolMessage(response.utf8()); |
| 102 } | 104 } |
| 103 | 105 |
| 104 void DevToolsAgentImpl::OnConnectionError() { | 106 void DevToolsAgentImpl::OnConnectionError() { |
| 105 client_.reset(); | 107 client_.reset(); |
| 106 frame_->devToolsAgent()->detach(); | 108 frame_->devToolsAgent()->detach(); |
| 107 } | 109 } |
| 108 | 110 |
| 109 } // namespace html_viewer | 111 } // namespace html_viewer |
| OLD | NEW |