| 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/web_view/frame_devtools_agent.h" | 5 #include "components/web_view/frame_devtools_agent.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // monotonously so iterating over |pending_messages_| preserves the order in | 113 // monotonously so iterating over |pending_messages_| preserves the order in |
| 114 // which they were received. | 114 // which they were received. |
| 115 for (const auto& item : pending_messages_) | 115 for (const auto& item : pending_messages_) |
| 116 forward_agent_->DispatchProtocolMessage(item.second); | 116 forward_agent_->DispatchProtocolMessage(item.second); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void FrameDevToolsAgent::RegisterAgentIfNecessary() { | 119 void FrameDevToolsAgent::RegisterAgentIfNecessary() { |
| 120 if (binding_.is_bound()) | 120 if (binding_.is_bound()) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 mojo::URLRequestPtr request(mojo::URLRequest::New()); | |
| 124 request->url = "mojo:devtools_service"; | |
| 125 DevToolsRegistryPtr devtools_registry; | 123 DevToolsRegistryPtr devtools_registry; |
| 126 app_->ConnectToService(request.Pass(), &devtools_registry); | 124 app_->ConnectToService("mojo:devtools_service", &devtools_registry); |
| 127 | 125 |
| 128 DevToolsAgentPtr agent; | 126 DevToolsAgentPtr agent; |
| 129 binding_.Bind(&agent); | 127 binding_.Bind(&agent); |
| 130 devtools_registry->RegisterAgent(id_, agent.Pass()); | 128 devtools_registry->RegisterAgent(id_, agent.Pass()); |
| 131 } | 129 } |
| 132 | 130 |
| 133 void FrameDevToolsAgent::HandlePageNavigateRequest( | 131 void FrameDevToolsAgent::HandlePageNavigateRequest( |
| 134 const base::DictionaryValue* request) { | 132 const base::DictionaryValue* request) { |
| 135 std::string method; | 133 std::string method; |
| 136 if (!request->GetString("method", &method) || method != "Page.navigate") | 134 if (!request->GetString("method", &method) || method != "Page.navigate") |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 pending_messages_.erase(call_id); | 188 pending_messages_.erase(call_id); |
| 191 } | 189 } |
| 192 | 190 |
| 193 void FrameDevToolsAgent::OnForwardClientClosed() { | 191 void FrameDevToolsAgent::OnForwardClientClosed() { |
| 194 client_impl_.reset(); | 192 client_impl_.reset(); |
| 195 state_.clear(); | 193 state_.clear(); |
| 196 pending_messages_.clear(); | 194 pending_messages_.clear(); |
| 197 } | 195 } |
| 198 | 196 |
| 199 } // namespace web_view | 197 } // namespace web_view |
| OLD | NEW |