Fix API changes of Chrome 37.

This commit is contained in:
Cheng Zhao 2014-09-01 15:36:37 +08:00
parent d4a46fa35f
commit 3e46363ae1
3 changed files with 9 additions and 7 deletions

View file

@ -13,7 +13,8 @@
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "net/url_request/data_protocol_handler.h" #include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h" #include "net/url_request/file_protocol_handler.h"
#include "net/url_request/protocol_intercept_job_factory.h" #include "net/url_request/url_request_intercepting_job_factory.h"
#include "url/url_constants.h"
using content::BrowserThread; using content::BrowserThread;
@ -29,7 +30,7 @@ AtomBrowserContext::~AtomBrowserContext() {
net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory( net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers, content::ProtocolHandlerMap* handlers,
content::ProtocolHandlerScopedVector* interceptors) { content::URLRequestInterceptorScopedVector* interceptors) {
scoped_ptr<AtomURLRequestJobFactory> job_factory(job_factory_); scoped_ptr<AtomURLRequestJobFactory> job_factory(job_factory_);
for (content::ProtocolHandlerMap::iterator it = handlers->begin(); for (content::ProtocolHandlerMap::iterator it = handlers->begin();
@ -38,18 +39,18 @@ net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
handlers->clear(); handlers->clear();
job_factory->SetProtocolHandler( job_factory->SetProtocolHandler(
content::kDataScheme, new net::DataProtocolHandler); url::kDataScheme, new net::DataProtocolHandler);
job_factory->SetProtocolHandler( job_factory->SetProtocolHandler(
content::kFileScheme, new net::FileProtocolHandler( url::kFileScheme, new net::FileProtocolHandler(
BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
// Set up interceptors in the reverse order. // Set up interceptors in the reverse order.
scoped_ptr<net::URLRequestJobFactory> top_job_factory = scoped_ptr<net::URLRequestJobFactory> top_job_factory =
job_factory.PassAs<net::URLRequestJobFactory>(); job_factory.PassAs<net::URLRequestJobFactory>();
content::ProtocolHandlerScopedVector::reverse_iterator it; content::URLRequestInterceptorScopedVector::reverse_iterator it;
for (it = interceptors->rbegin(); it != interceptors->rend(); ++it) for (it = interceptors->rbegin(); it != interceptors->rend(); ++it)
top_job_factory.reset(new net::ProtocolInterceptJobFactory( top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
top_job_factory.Pass(), make_scoped_ptr(*it))); top_job_factory.Pass(), make_scoped_ptr(*it)));
interceptors->weak_clear(); interceptors->weak_clear();

View file

@ -27,7 +27,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
// brightray::URLRequestContextGetter::Delegate: // brightray::URLRequestContextGetter::Delegate:
virtual net::URLRequestJobFactory* CreateURLRequestJobFactory( virtual net::URLRequestJobFactory* CreateURLRequestJobFactory(
content::ProtocolHandlerMap* handlers, content::ProtocolHandlerMap* handlers,
content::ProtocolHandlerScopedVector* interceptors) OVERRIDE; content::URLRequestInterceptorScopedVector* interceptors) OVERRIDE;
private: private:
// A fake BrowserProcess object that used to feed the source code from chrome. // A fake BrowserProcess object that used to feed the source code from chrome.

View file

@ -5,6 +5,7 @@
#ifndef ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_ #ifndef ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_
#define ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_ #define ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_
#include "base/strings/string16.h"
#include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_observer.h"
namespace base { namespace base {