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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "components/devtools_http_handler/devtools_http_handler.h" | 17 #include "components/devtools_http_handler/devtools_http_handler.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/render_frame_host.h" | 19 #include "content/public/browser/render_frame_host.h" |
20 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/storage_partition.h" |
21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
22 #include "content/public/common/content_client.h" | 23 #include "content/public/common/content_client.h" |
23 #include "content/shell/browser/shell.h" | 24 #include "content/shell/browser/shell.h" |
24 #include "content/shell/browser/shell_browser_context.h" | 25 #include "content/shell/browser/shell_browser_context.h" |
25 #include "content/shell/browser/shell_browser_main_parts.h" | 26 #include "content/shell/browser/shell_browser_main_parts.h" |
26 #include "content/shell/browser/shell_content_browser_client.h" | 27 #include "content/shell/browser/shell_content_browser_client.h" |
27 #include "content/shell/browser/shell_devtools_manager_delegate.h" | 28 #include "content/shell/browser/shell_devtools_manager_delegate.h" |
28 #include "content/shell/common/shell_switches.h" | 29 #include "content/shell/common/shell_switches.h" |
29 #include "net/base/io_buffer.h" | 30 #include "net/base/io_buffer.h" |
30 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if (!gurl.is_valid()) { | 221 if (!gurl.is_valid()) { |
221 base::DictionaryValue response; | 222 base::DictionaryValue response; |
222 response.SetInteger("statusCode", 404); | 223 response.SetInteger("statusCode", 404); |
223 SendMessageAck(request_id, &response); | 224 SendMessageAck(request_id, &response); |
224 return; | 225 return; |
225 } | 226 } |
226 | 227 |
227 net::URLFetcher* fetcher = | 228 net::URLFetcher* fetcher = |
228 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this).release(); | 229 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this).release(); |
229 pending_requests_[fetcher] = request_id; | 230 pending_requests_[fetcher] = request_id; |
230 fetcher->SetRequestContext(web_contents()->GetBrowserContext()-> | 231 fetcher->SetRequestContext( |
231 GetRequestContext()); | 232 BrowserContext::GetDefaultStoragePartition( |
| 233 web_contents()->GetBrowserContext())-> |
| 234 GetURLRequestContext()); |
232 fetcher->SetExtraRequestHeaders(headers); | 235 fetcher->SetExtraRequestHeaders(headers); |
233 fetcher->SaveResponseWithWriter( | 236 fetcher->SaveResponseWithWriter( |
234 std::unique_ptr<net::URLFetcherResponseWriter>( | 237 std::unique_ptr<net::URLFetcherResponseWriter>( |
235 new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); | 238 new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); |
236 fetcher->Start(); | 239 fetcher->Start(); |
237 return; | 240 return; |
238 } else if (method == "getPreferences") { | 241 } else if (method == "getPreferences") { |
239 SendMessageAck(request_id, &preferences_); | 242 SendMessageAck(request_id, &preferences_); |
240 return; | 243 return; |
241 } else if (method == "setPreference") { | 244 } else if (method == "setPreference") { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 CallClientFunction("DevToolsAPI.embedderMessageAck", | 340 CallClientFunction("DevToolsAPI.embedderMessageAck", |
338 &id_value, arg, nullptr); | 341 &id_value, arg, nullptr); |
339 } | 342 } |
340 | 343 |
341 void ShellDevToolsFrontend::AgentHostClosed( | 344 void ShellDevToolsFrontend::AgentHostClosed( |
342 DevToolsAgentHost* agent_host, bool replaced) { | 345 DevToolsAgentHost* agent_host, bool replaced) { |
343 frontend_shell_->Close(); | 346 frontend_shell_->Close(); |
344 } | 347 } |
345 | 348 |
346 } // namespace content | 349 } // namespace content |
OLD | NEW |