Commit a41817cd authored by Mikhail Naganov's avatar Mikhail Naganov

[Android WebView] Use NetLog for providing full request headers to DevTools

AwURLRequestContextGetter now owns an instance of net::NetLog.

BUG=277075
R=boliu@chromium.org

Review URL: https://codereview.chromium.org/557733002

Cr-Commit-Position: refs/heads/master@{#294359}
parent 8bf5f9c7
......@@ -181,6 +181,10 @@ DataReductionProxySettings* AwBrowserContext::GetDataReductionProxySettings() {
return data_reduction_proxy_settings_.get();
}
AwURLRequestContextGetter* AwBrowserContext::GetAwURLRequestContext() {
return url_request_context_getter_.get();
}
// Create user pref service for autofill functionality.
void AwBrowserContext::CreateUserPrefServiceIfNecessary() {
if (user_pref_service_)
......
......@@ -87,6 +87,8 @@ class AwBrowserContext : public content::BrowserContext,
data_reduction_proxy::DataReductionProxySettings*
GetDataReductionProxySettings();
AwURLRequestContextGetter* GetAwURLRequestContext();
void CreateUserPrefServiceIfNecessary();
// content::BrowserContext implementation.
......
......@@ -13,6 +13,7 @@
#include "android_webview/browser/aw_quota_permission_context.h"
#include "android_webview/browser/aw_web_preferences_populater.h"
#include "android_webview/browser/jni_dependency_factory.h"
#include "android_webview/browser/net/aw_url_request_context_getter.h"
#include "android_webview/browser/net_disk_cache_remover.h"
#include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h"
#include "android_webview/common/render_view_messages.h"
......@@ -508,8 +509,7 @@ void AwContentBrowserClient::ResourceDispatcherHostCreated() {
}
net::NetLog* AwContentBrowserClient::GetNetLog() {
// TODO(boliu): Implement AwNetLog.
return NULL;
return browser_context_->GetAwURLRequestContext()->GetNetLog();
}
content::AccessTokenStore* AwContentBrowserClient::CreateAccessTokenStore() {
......
......@@ -27,6 +27,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "net/base/cache_type.h"
#include "net/base/net_log.h"
#include "net/cookies/cookie_store.h"
#include "net/dns/mapped_host_resolver.h"
#include "net/http/http_cache.h"
......@@ -175,7 +176,8 @@ AwURLRequestContextGetter::AwURLRequestContextGetter(
scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService>
config_service)
: partition_path_(partition_path),
cookie_store_(cookie_store) {
cookie_store_(cookie_store),
net_log_(new net::NetLog()) {
data_reduction_proxy_config_service_ = config_service.Pass();
// CreateSystemProxyConfigService for Android must be called on main thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
......@@ -205,6 +207,7 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() {
}
builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader(
AwContentBrowserClient::GetAcceptLangsImpl()));
builder.set_net_log(net_log_.get());
ApplyCmdlineOverridesToURLRequestContextBuilder(&builder);
url_request_context_.reset(builder.Build());
......@@ -276,4 +279,8 @@ AwURLRequestContextGetter::GetDataReductionProxyAuthRequestHandler() const {
return data_reduction_proxy_auth_request_handler_.get();
}
net::NetLog* AwURLRequestContextGetter::GetNetLog() {
return net_log_.get();
}
} // namespace android_webview
......@@ -17,6 +17,7 @@
namespace net {
class CookieStore;
class HttpTransactionFactory;
class NetLog;
class ProxyConfigService;
class URLRequestContext;
class URLRequestJobFactory;
......@@ -39,8 +40,6 @@ class AwURLRequestContextGetter : public net::URLRequestContextGetter {
scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService>
config_service);
void InitializeOnNetworkThread();
// net::URLRequestContextGetter implementation.
virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
virtual scoped_refptr<base::SingleThreadTaskRunner>
......@@ -49,6 +48,10 @@ class AwURLRequestContextGetter : public net::URLRequestContextGetter {
data_reduction_proxy::DataReductionProxyAuthRequestHandler*
GetDataReductionProxyAuthRequestHandler() const;
// NetLog is thread-safe, so clients can call this method from arbitrary
// threads (UI and IO).
net::NetLog* GetNetLog();
private:
friend class AwBrowserContext;
virtual ~AwURLRequestContextGetter();
......@@ -67,6 +70,7 @@ class AwURLRequestContextGetter : public net::URLRequestContextGetter {
const base::FilePath partition_path_;
scoped_refptr<net::CookieStore> cookie_store_;
scoped_ptr<net::NetLog> net_log_;
scoped_ptr<net::URLRequestContext> url_request_context_;
scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService>
data_reduction_proxy_config_service_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment