OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell_devtools_frontend.h" | 5 #include "content/shell/browser/shell_devtools_frontend.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return net::OK; | 72 return net::OK; |
73 } | 73 } |
74 | 74 |
75 int ResponseWriter::Write(net::IOBuffer* buffer, | 75 int ResponseWriter::Write(net::IOBuffer* buffer, |
76 int num_bytes, | 76 int num_bytes, |
77 const net::CompletionCallback& callback) { | 77 const net::CompletionCallback& callback) { |
78 std::string chunk = std::string(buffer->data(), num_bytes); | 78 std::string chunk = std::string(buffer->data(), num_bytes); |
79 if (!base::IsStringUTF8(chunk)) | 79 if (!base::IsStringUTF8(chunk)) |
80 return num_bytes; | 80 return num_bytes; |
81 | 81 |
82 base::FundamentalValue* id = new base::FundamentalValue(stream_id_); | 82 base::Value* id = new base::Value(stream_id_); |
83 base::StringValue* chunkValue = new base::StringValue(chunk); | 83 base::StringValue* chunkValue = new base::StringValue(chunk); |
84 | 84 |
85 content::BrowserThread::PostTask( | 85 content::BrowserThread::PostTask( |
86 content::BrowserThread::UI, FROM_HERE, | 86 content::BrowserThread::UI, FROM_HERE, |
87 base::Bind(&ShellDevToolsFrontend::CallClientFunction, | 87 base::Bind(&ShellDevToolsFrontend::CallClientFunction, |
88 shell_devtools_, "DevToolsAPI.streamWrite", | 88 shell_devtools_, "DevToolsAPI.streamWrite", |
89 base::Owned(id), base::Owned(chunkValue), nullptr)); | 89 base::Owned(id), base::Owned(chunkValue), nullptr)); |
90 return num_bytes; | 90 return num_bytes; |
91 } | 91 } |
92 | 92 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 } | 362 } |
363 } | 363 } |
364 } | 364 } |
365 javascript.append(");"); | 365 javascript.append(");"); |
366 web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( | 366 web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( |
367 base::UTF8ToUTF16(javascript)); | 367 base::UTF8ToUTF16(javascript)); |
368 } | 368 } |
369 | 369 |
370 void ShellDevToolsFrontend::SendMessageAck(int request_id, | 370 void ShellDevToolsFrontend::SendMessageAck(int request_id, |
371 const base::Value* arg) { | 371 const base::Value* arg) { |
372 base::FundamentalValue id_value(request_id); | 372 base::Value id_value(request_id); |
373 CallClientFunction("DevToolsAPI.embedderMessageAck", | 373 CallClientFunction("DevToolsAPI.embedderMessageAck", |
374 &id_value, arg, nullptr); | 374 &id_value, arg, nullptr); |
375 } | 375 } |
376 | 376 |
377 void ShellDevToolsFrontend::AgentHostClosed( | 377 void ShellDevToolsFrontend::AgentHostClosed( |
378 DevToolsAgentHost* agent_host, bool replaced) { | 378 DevToolsAgentHost* agent_host, bool replaced) { |
379 agent_host_ = nullptr; | 379 agent_host_ = nullptr; |
380 frontend_shell_->Close(); | 380 frontend_shell_->Close(); |
381 } | 381 } |
382 | 382 |
383 } // namespace content | 383 } // namespace content |
OLD | NEW |