Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/shell/browser/shell_devtools_frontend.cc

Issue 1878153002: Revert of Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
22 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/content_client.h" 22 #include "content/public/common/content_client.h"
24 #include "content/shell/browser/shell.h" 23 #include "content/shell/browser/shell.h"
25 #include "content/shell/browser/shell_browser_context.h" 24 #include "content/shell/browser/shell_browser_context.h"
26 #include "content/shell/browser/shell_browser_main_parts.h" 25 #include "content/shell/browser/shell_browser_main_parts.h"
27 #include "content/shell/browser/shell_content_browser_client.h" 26 #include "content/shell/browser/shell_content_browser_client.h"
28 #include "content/shell/browser/shell_devtools_manager_delegate.h" 27 #include "content/shell/browser/shell_devtools_manager_delegate.h"
29 #include "content/shell/common/shell_switches.h" 28 #include "content/shell/common/shell_switches.h"
30 #include "net/base/io_buffer.h" 29 #include "net/base/io_buffer.h"
31 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 if (!gurl.is_valid()) { 220 if (!gurl.is_valid()) {
222 base::DictionaryValue response; 221 base::DictionaryValue response;
223 response.SetInteger("statusCode", 404); 222 response.SetInteger("statusCode", 404);
224 SendMessageAck(request_id, &response); 223 SendMessageAck(request_id, &response);
225 return; 224 return;
226 } 225 }
227 226
228 net::URLFetcher* fetcher = 227 net::URLFetcher* fetcher =
229 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this).release(); 228 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this).release();
230 pending_requests_[fetcher] = request_id; 229 pending_requests_[fetcher] = request_id;
231 fetcher->SetRequestContext( 230 fetcher->SetRequestContext(web_contents()->GetBrowserContext()->
232 BrowserContext::GetDefaultStoragePartition( 231 GetRequestContext());
233 web_contents()->GetBrowserContext())->
234 GetURLRequestContext());
235 fetcher->SetExtraRequestHeaders(headers); 232 fetcher->SetExtraRequestHeaders(headers);
236 fetcher->SaveResponseWithWriter( 233 fetcher->SaveResponseWithWriter(
237 std::unique_ptr<net::URLFetcherResponseWriter>( 234 std::unique_ptr<net::URLFetcherResponseWriter>(
238 new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); 235 new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
239 fetcher->Start(); 236 fetcher->Start();
240 return; 237 return;
241 } else if (method == "getPreferences") { 238 } else if (method == "getPreferences") {
242 SendMessageAck(request_id, &preferences_); 239 SendMessageAck(request_id, &preferences_);
243 return; 240 return;
244 } else if (method == "setPreference") { 241 } else if (method == "setPreference") {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 CallClientFunction("DevToolsAPI.embedderMessageAck", 337 CallClientFunction("DevToolsAPI.embedderMessageAck",
341 &id_value, arg, nullptr); 338 &id_value, arg, nullptr);
342 } 339 }
343 340
344 void ShellDevToolsFrontend::AgentHostClosed( 341 void ShellDevToolsFrontend::AgentHostClosed(
345 DevToolsAgentHost* agent_host, bool replaced) { 342 DevToolsAgentHost* agent_host, bool replaced) {
346 frontend_shell_->Close(); 343 frontend_shell_->Close();
347 } 344 }
348 345
349 } // namespace content 346 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_browser_context.cc ('k') | extensions/browser/api/socket/socket_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698