OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "headless/lib/browser/headless_devtools_client_impl.h" | 5 #include "headless/lib/browser/headless_devtools_client_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 memory_domain_(this), | 55 memory_domain_(this), |
56 network_domain_(this), | 56 network_domain_(this), |
57 page_domain_(this), | 57 page_domain_(this), |
58 profiler_domain_(this), | 58 profiler_domain_(this), |
59 rendering_domain_(this), | 59 rendering_domain_(this), |
60 runtime_domain_(this), | 60 runtime_domain_(this), |
61 security_domain_(this), | 61 security_domain_(this), |
62 service_worker_domain_(this), | 62 service_worker_domain_(this), |
63 target_domain_(this), | 63 target_domain_(this), |
64 tracing_domain_(this), | 64 tracing_domain_(this), |
65 worker_domain_(this), | |
66 browser_main_thread_(content::BrowserThread::GetTaskRunnerForThread( | 65 browser_main_thread_(content::BrowserThread::GetTaskRunnerForThread( |
67 content::BrowserThread::UI)), | 66 content::BrowserThread::UI)), |
68 weak_ptr_factory_(this) {} | 67 weak_ptr_factory_(this) {} |
69 | 68 |
70 HeadlessDevToolsClientImpl::~HeadlessDevToolsClientImpl() {} | 69 HeadlessDevToolsClientImpl::~HeadlessDevToolsClientImpl() {} |
71 | 70 |
72 void HeadlessDevToolsClientImpl::AttachToHost( | 71 void HeadlessDevToolsClientImpl::AttachToHost( |
73 content::DevToolsAgentHost* agent_host) { | 72 content::DevToolsAgentHost* agent_host) { |
74 DCHECK(!agent_host_); | 73 DCHECK(!agent_host_); |
75 agent_host_ = agent_host; | 74 agent_host_ = agent_host; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 281 } |
283 | 282 |
284 target::Domain* HeadlessDevToolsClientImpl::GetTarget() { | 283 target::Domain* HeadlessDevToolsClientImpl::GetTarget() { |
285 return &target_domain_; | 284 return &target_domain_; |
286 } | 285 } |
287 | 286 |
288 tracing::Domain* HeadlessDevToolsClientImpl::GetTracing() { | 287 tracing::Domain* HeadlessDevToolsClientImpl::GetTracing() { |
289 return &tracing_domain_; | 288 return &tracing_domain_; |
290 } | 289 } |
291 | 290 |
292 worker::Domain* HeadlessDevToolsClientImpl::GetWorker() { | |
293 return &worker_domain_; | |
294 } | |
295 | |
296 template <typename CallbackType> | 291 template <typename CallbackType> |
297 void HeadlessDevToolsClientImpl::FinalizeAndSendMessage( | 292 void HeadlessDevToolsClientImpl::FinalizeAndSendMessage( |
298 base::DictionaryValue* message, | 293 base::DictionaryValue* message, |
299 CallbackType callback) { | 294 CallbackType callback) { |
300 DCHECK(agent_host_); | 295 DCHECK(agent_host_); |
301 int id = next_message_id_++; | 296 int id = next_message_id_++; |
302 message->SetInteger("id", id); | 297 message->SetInteger("id", id); |
303 std::string json_message; | 298 std::string json_message; |
304 base::JSONWriter::Write(*message, &json_message); | 299 base::JSONWriter::Write(*message, &json_message); |
305 pending_messages_[id] = Callback(callback); | 300 pending_messages_[id] = Callback(callback); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 HeadlessDevToolsClientImpl::Callback::Callback( | 363 HeadlessDevToolsClientImpl::Callback::Callback( |
369 base::Callback<void(const base::Value&)> callback) | 364 base::Callback<void(const base::Value&)> callback) |
370 : callback_with_result(callback) {} | 365 : callback_with_result(callback) {} |
371 | 366 |
372 HeadlessDevToolsClientImpl::Callback::~Callback() {} | 367 HeadlessDevToolsClientImpl::Callback::~Callback() {} |
373 | 368 |
374 HeadlessDevToolsClientImpl::Callback& HeadlessDevToolsClientImpl::Callback:: | 369 HeadlessDevToolsClientImpl::Callback& HeadlessDevToolsClientImpl::Callback:: |
375 operator=(Callback&& other) = default; | 370 operator=(Callback&& other) = default; |
376 | 371 |
377 } // namespace headless | 372 } // namespace headless |
OLD | NEW |