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

Side by Side Diff: content/browser/devtools/protocol/network_handler.cc

Issue 2590293003: [DevTools] Rework DevToolsSession interaction with domain handlers. (Closed)
Patch Set: addressed comments Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/devtools/protocol/network_handler.h" 5 #include "content/browser/devtools/protocol/network_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "content/browser/devtools/devtools_session.h"
12 #include "content/browser/frame_host/frame_tree_node.h" 13 #include "content/browser/frame_host/frame_tree_node.h"
13 #include "content/browser/frame_host/render_frame_host_impl.h" 14 #include "content/browser/frame_host/render_frame_host_impl.h"
14 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/resource_context.h" 19 #include "content/public/browser/resource_context.h"
19 #include "content/public/browser/site_instance.h" 20 #include "content/public/browser/site_instance.h"
20 #include "content/public/browser/storage_partition.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"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 base::Unretained(frame_host->GetProcess() 261 base::Unretained(frame_host->GetProcess()
261 ->GetStoragePartition() 262 ->GetStoragePartition()
262 ->GetURLRequestContext()), 263 ->GetURLRequestContext()),
263 got_cookies_callback)); 264 got_cookies_callback));
264 } 265 }
265 }; 266 };
266 267
267 } // namespace 268 } // namespace
268 269
269 NetworkHandler::NetworkHandler() 270 NetworkHandler::NetworkHandler()
270 : host_(nullptr), enabled_(false) { 271 : DevToolsDomainHandler(Network::Metainfo::domainName),
272 host_(nullptr),
273 enabled_(false) {
271 } 274 }
272 275
273 NetworkHandler::~NetworkHandler() { 276 NetworkHandler::~NetworkHandler() {
274 } 277 }
275 278
279 // static
280 NetworkHandler* NetworkHandler::FromSession(DevToolsSession* session) {
281 return static_cast<NetworkHandler*>(
282 session->GetHandlerByName(Network::Metainfo::domainName));
283 }
284
276 void NetworkHandler::Wire(UberDispatcher* dispatcher) { 285 void NetworkHandler::Wire(UberDispatcher* dispatcher) {
277 Network::Dispatcher::wire(dispatcher, this); 286 Network::Dispatcher::wire(dispatcher, this);
278 } 287 }
279 288
280 void NetworkHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { 289 void NetworkHandler::SetRenderFrameHost(RenderFrameHostImpl* host) {
281 host_ = host; 290 host_ = host;
282 } 291 }
283 292
284 Response NetworkHandler::Enable(Maybe<int> max_total_size, 293 Response NetworkHandler::Enable(Maybe<int> max_total_size,
285 Maybe<int> max_resource_size) { 294 Maybe<int> max_resource_size) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 *result = false; 405 *result = false;
397 return Response::OK(); 406 return Response::OK();
398 } 407 }
399 408
400 std::string NetworkHandler::UserAgentOverride() const { 409 std::string NetworkHandler::UserAgentOverride() const {
401 return enabled_ ? user_agent_ : std::string(); 410 return enabled_ ? user_agent_ : std::string();
402 } 411 }
403 412
404 } // namespace protocol 413 } // namespace protocol
405 } // namespace content 414 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698