Allow clients to supply their own NetworkDelegate implementation

This commit is contained in:
Adam Roben 2013-07-17 10:21:33 -04:00
parent 09efd19d2f
commit 33b574b434
5 changed files with 20 additions and 6 deletions

View file

@ -5,6 +5,7 @@
#include "browser_context.h"
#include "browser/inspectable_web_contents_impl.h"
#include "browser/network_delegate.h"
#include "common/application_info.h"
#include "base/files/file_path.h"
@ -66,11 +67,16 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(content::Prot
GetPath(),
content::BrowserThread::UnsafeGetMessageLoopForThread(content::BrowserThread::IO),
content::BrowserThread::UnsafeGetMessageLoopForThread(content::BrowserThread::FILE),
CreateNetworkDelegate().Pass(),
protocol_handlers);
resource_context_->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}
scoped_ptr<NetworkDelegate> BrowserContext::CreateNetworkDelegate() {
return make_scoped_ptr(new NetworkDelegate).Pass();
}
base::FilePath BrowserContext::GetPath() {
if (!path_.empty())
return path_;