refactor: Enable network service (Part 1) (#17431)

* Convert InspectableWebContentsImpl::LoadNetworkResource to SimpleURLLoader

https://bugs.chromium.org/p/chromium/issues/detail?id=721408

* Plumb creation of network context with the service
This commit is contained in:
Robo 2019-03-26 06:40:48 +05:30 committed by Cheng Zhao
parent 4ec2f8b67b
commit 6c20c6e668
18 changed files with 469 additions and 172 deletions

View file

@ -8,10 +8,12 @@
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "atom/browser/ui/inspectable_web_contents.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h"
@ -19,7 +21,6 @@
#include "content/public/browser/devtools_frontend_host.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "ui/gfx/geometry/rect.h"
class PrefService;
@ -35,8 +36,7 @@ class InspectableWebContentsImpl
public content::DevToolsAgentHostClient,
public content::WebContentsObserver,
public content::WebContentsDelegate,
public DevToolsEmbedderMessageDispatcher::Delegate,
public net::URLFetcherDelegate {
public DevToolsEmbedderMessageDispatcher::Delegate {
public:
static void RegisterPrefs(PrefRegistrySimple* pref_registry);
@ -197,9 +197,6 @@ class InspectableWebContentsImpl
std::unique_ptr<content::FileSelectListener> listener,
const base::FilePath& path) override;
// net::URLFetcherDelegate:
void OnURLFetchComplete(const net::URLFetcher* source) override;
void SendMessageAck(int request_id, const base::Value* arg1);
bool frontend_loaded_;
@ -214,8 +211,6 @@ class InspectableWebContentsImpl
std::string dock_state_;
bool activate_ = true;
using PendingRequestsMap = std::map<const net::URLFetcher*, DispatchCallback>;
PendingRequestsMap pending_requests_;
InspectableWebContentsDelegate* delegate_; // weak references.
PrefService* pref_service_; // weak reference.
@ -231,6 +226,10 @@ class InspectableWebContentsImpl
bool is_guest_;
std::unique_ptr<InspectableWebContentsView> view_;
class NetworkResourceLoader;
std::set<std::unique_ptr<NetworkResourceLoader>, base::UniquePtrComparator>
loaders_;
using ExtensionsAPIs = std::map<std::string, std::string>;
ExtensionsAPIs extensions_api_;