Fix API changes of Chrome37.

This commit is contained in:
Cheng Zhao 2014-08-31 18:43:01 +08:00
parent f0e46a4728
commit dca1c51b32
9 changed files with 30 additions and 86 deletions

View file

@ -61,7 +61,7 @@ content::BrowserMainParts* BrowserClient::CreateBrowserMainParts(
net::URLRequestContextGetter* BrowserClient::CreateRequestContext( net::URLRequestContextGetter* BrowserClient::CreateRequestContext(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector protocol_interceptors) { content::URLRequestInterceptorScopedVector protocol_interceptors) {
auto context = static_cast<BrowserContext*>(browser_context); auto context = static_cast<BrowserContext*>(browser_context);
return context->CreateRequestContext(protocol_handlers, protocol_interceptors.Pass()); return context->CreateRequestContext(protocol_handlers, protocol_interceptors.Pass());
} }

View file

@ -36,7 +36,7 @@ class BrowserClient : public content::ContentBrowserClient {
virtual net::URLRequestContextGetter* CreateRequestContext( virtual net::URLRequestContextGetter* CreateRequestContext(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE; content::URLRequestInterceptorScopedVector protocol_interceptors) OVERRIDE;
private: private:
virtual content::BrowserMainParts* CreateBrowserMainParts( virtual content::BrowserMainParts* CreateBrowserMainParts(

View file

@ -101,7 +101,7 @@ void BrowserContext::RegisterInternalPrefs(PrefRegistrySimple* registry) {
net::URLRequestContextGetter* BrowserContext::CreateRequestContext( net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector protocol_interceptors) { content::URLRequestInterceptorScopedVector protocol_interceptors) {
DCHECK(!url_request_getter_); DCHECK(!url_request_getter_);
url_request_getter_ = new URLRequestContextGetter( url_request_getter_ = new URLRequestContextGetter(
this, this,
@ -120,7 +120,7 @@ net::NetworkDelegate* BrowserContext::CreateNetworkDelegate() {
net::URLRequestJobFactory* BrowserContext::CreateURLRequestJobFactory( net::URLRequestJobFactory* BrowserContext::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector* protocol_interceptors) { content::URLRequestInterceptorScopedVector* protocol_interceptors) {
return NULL; return NULL;
} }
@ -158,36 +158,6 @@ net::URLRequestContextGetter*
return GetRequestContext(); return GetRequestContext();
} }
void BrowserContext::RequestMidiSysExPermission(
int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const MidiSysExPermissionCallback& callback) {
callback.Run(false);
}
void BrowserContext::CancelMidiSysExPermissionRequest(
int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame) {
}
void BrowserContext::RequestProtectedMediaIdentifierPermission(
int render_process_id,
int render_view_id,
int bridge_id,
int group_id,
const GURL& requesting_frame,
const ProtectedMediaIdentifierPermissionCallback& callback) {
callback.Run(false);
}
void BrowserContext::CancelProtectedMediaIdentifierPermissionRequests(int group_id) {
}
content::ResourceContext* BrowserContext::GetResourceContext() { content::ResourceContext* BrowserContext::GetResourceContext() {
return resource_context_.get(); return resource_context_.get();
} }
@ -198,17 +168,16 @@ content::DownloadManagerDelegate* BrowserContext::GetDownloadManagerDelegate() {
return download_manager_delegate_.get(); return download_manager_delegate_.get();
} }
content::GeolocationPermissionContext* content::BrowserPluginGuestManager* BrowserContext::GetGuestManager() {
BrowserContext::GetGeolocationPermissionContext() { return NULL;
return nullptr;
} }
quota::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() { quota::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() {
return nullptr; return NULL;
} }
content::BrowserPluginGuestManagerDelegate* BrowserContext::GetGuestManagerDelegate() { content::PushMessagingService* BrowserContext::GetPushMessagingService() {
return nullptr; return NULL;
} }
} // namespace brightray } // namespace brightray

View file

@ -26,7 +26,7 @@ class BrowserContext : public content::BrowserContext,
net::URLRequestContextGetter* CreateRequestContext( net::URLRequestContextGetter* CreateRequestContext(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector protocol_interceptors); content::URLRequestInterceptorScopedVector protocol_interceptors);
net::URLRequestContextGetter* url_request_context_getter() const { net::URLRequestContextGetter* url_request_context_getter() const {
return url_request_getter_.get(); return url_request_getter_.get();
@ -42,7 +42,7 @@ class BrowserContext : public content::BrowserContext,
virtual net::NetworkDelegate* CreateNetworkDelegate() OVERRIDE; virtual net::NetworkDelegate* CreateNetworkDelegate() OVERRIDE;
virtual net::URLRequestJobFactory* CreateURLRequestJobFactory( virtual net::URLRequestJobFactory* CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector* protocol_interceptors) OVERRIDE; content::URLRequestInterceptorScopedVector* protocol_interceptors) OVERRIDE;
virtual base::FilePath GetPath() const OVERRIDE; virtual base::FilePath GetPath() const OVERRIDE;
@ -61,35 +61,11 @@ class BrowserContext : public content::BrowserContext,
virtual net::URLRequestContextGetter* virtual net::URLRequestContextGetter*
GetMediaRequestContextForStoragePartition( GetMediaRequestContextForStoragePartition(
const base::FilePath& partition_path, bool in_memory); const base::FilePath& partition_path, bool in_memory);
virtual void RequestMidiSysExPermission(
int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const MidiSysExPermissionCallback& callback) OVERRIDE;
virtual void CancelMidiSysExPermissionRequest(
int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame) OVERRIDE;
virtual void RequestProtectedMediaIdentifierPermission(
int render_process_id,
int render_view_id,
int bridge_id,
int group_id,
const GURL& requesting_frame,
const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE;
virtual void CancelProtectedMediaIdentifierPermissionRequests(int group_id) OVERRIDE;
virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE;
virtual content::DownloadManagerDelegate* virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE;
GetDownloadManagerDelegate() OVERRIDE; virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
virtual content::GeolocationPermissionContext* virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
GetGeolocationPermissionContext() OVERRIDE; virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
virtual content::BrowserPluginGuestManagerDelegate*
GetGuestManagerDelegate() OVERRIDE;
virtual quota::SpecialStoragePolicy*
GetSpecialStoragePolicy() OVERRIDE;
base::FilePath path_; base::FilePath path_;
scoped_ptr<ResourceContext> resource_context_; scoped_ptr<ResourceContext> resource_context_;

View file

@ -68,6 +68,7 @@ class Target : public content::DevToolsTarget {
explicit Target(WebContents* web_contents); explicit Target(WebContents* web_contents);
virtual std::string GetId() const OVERRIDE { return id_; } virtual std::string GetId() const OVERRIDE { return id_; }
virtual std::string GetParentId() const { return std::string(); }
virtual std::string GetType() const OVERRIDE { return kTargetTypePage; } virtual std::string GetType() const OVERRIDE { return kTargetTypePage; }
virtual std::string GetTitle() const OVERRIDE { return title_; } virtual std::string GetTitle() const OVERRIDE { return title_; }
virtual std::string GetDescription() const OVERRIDE { return std::string(); } virtual std::string GetDescription() const OVERRIDE { return std::string(); }
@ -134,8 +135,8 @@ DevToolsDelegate::DevToolsDelegate(
content::BrowserContext* browser_context) content::BrowserContext* browser_context)
: browser_context_(browser_context) { : browser_context_(browser_context) {
std::string frontend_url; std::string frontend_url;
devtools_http_handler_ = devtools_http_handler_ = DevToolsHttpHandler::Start(
DevToolsHttpHandler::Start(CreateSocketFactory(), frontend_url, this); CreateSocketFactory(), frontend_url, this, base::FilePath());
} }
DevToolsDelegate::~DevToolsDelegate() { DevToolsDelegate::~DevToolsDelegate() {

View file

@ -156,8 +156,7 @@ void InspectableWebContentsImpl::ShowDevTools() {
embedder_message_dispatcher_.reset( embedder_message_dispatcher_.reset(
new DevToolsEmbedderMessageDispatcher(this)); new DevToolsEmbedderMessageDispatcher(this));
auto create_params = content::WebContents::CreateParams( content::WebContents::CreateParams create_params(web_contents_->GetBrowserContext());
web_contents_->GetBrowserContext());
devtools_web_contents_.reset(content::WebContents::Create(create_params)); devtools_web_contents_.reset(content::WebContents::Create(create_params));
Observe(devtools_web_contents_.get()); Observe(devtools_web_contents_.get());

View file

@ -15,7 +15,6 @@
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h" #include "content/public/browser/cookie_store_factory.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "net/base/host_mapping_rules.h" #include "net/base/host_mapping_rules.h"
#include "net/cert/cert_verifier.h" #include "net/cert/cert_verifier.h"
#include "net/cookies/cookie_monster.h" #include "net/cookies/cookie_monster.h"
@ -33,11 +32,12 @@
#include "net/ssl/ssl_config_service_defaults.h" #include "net/ssl/ssl_config_service_defaults.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/static_http_user_agent_settings.h" #include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_context_storage.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_job_factory_impl.h"
#include "url/url_constants.h"
#include "webkit/browser/quota/special_storage_policy.h" #include "webkit/browser/quota/special_storage_policy.h"
using content::BrowserThread; using content::BrowserThread;
@ -75,24 +75,24 @@ const char kProxyServer[] = "proxy-server";
net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJobFactory( net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector* protocol_interceptors) { content::URLRequestInterceptorScopedVector* protocol_interceptors) {
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(new net::URLRequestJobFactoryImpl); scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(new net::URLRequestJobFactoryImpl);
for (auto it = protocol_handlers->begin(); it != protocol_handlers->end(); ++it) for (auto it = protocol_handlers->begin(); it != protocol_handlers->end(); ++it)
job_factory->SetProtocolHandler(it->first, it->second.release()); job_factory->SetProtocolHandler(it->first, it->second.release());
protocol_handlers->clear(); protocol_handlers->clear();
job_factory->SetProtocolHandler(content::kDataScheme, new net::DataProtocolHandler); job_factory->SetProtocolHandler(url::kDataScheme, new net::DataProtocolHandler);
job_factory->SetProtocolHandler(content::kFileScheme, new net::FileProtocolHandler( job_factory->SetProtocolHandler(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>();
for (content::ProtocolHandlerScopedVector::reverse_iterator i = protocol_interceptors->rbegin(); for (content::URLRequestInterceptorScopedVector::reverse_iterator i = protocol_interceptors->rbegin();
i != protocol_interceptors->rend(); ++i) i != protocol_interceptors->rend(); ++i)
top_job_factory.reset(new net::ProtocolInterceptJobFactory( top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
top_job_factory.Pass(), make_scoped_ptr(*i))); top_job_factory.Pass(), make_scoped_ptr(*i)));
protocol_interceptors->weak_clear(); protocol_interceptors->weak_clear();
@ -105,7 +105,7 @@ URLRequestContextGetter::URLRequestContextGetter(
base::MessageLoop* io_loop, base::MessageLoop* io_loop,
base::MessageLoop* file_loop, base::MessageLoop* file_loop,
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector protocol_interceptors) content::URLRequestInterceptorScopedVector protocol_interceptors)
: delegate_(delegate), : delegate_(delegate),
base_path_(base_path), base_path_(base_path),
io_loop_(io_loop), io_loop_(io_loop),

View file

@ -35,7 +35,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
virtual net::NetworkDelegate* CreateNetworkDelegate() { return NULL; } virtual net::NetworkDelegate* CreateNetworkDelegate() { return NULL; }
virtual net::URLRequestJobFactory* CreateURLRequestJobFactory( virtual net::URLRequestJobFactory* CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector* protocol_interceptors); content::URLRequestInterceptorScopedVector* protocol_interceptors);
}; };
URLRequestContextGetter( URLRequestContextGetter(
@ -44,7 +44,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
base::MessageLoop* io_loop, base::MessageLoop* io_loop,
base::MessageLoop* file_loop, base::MessageLoop* file_loop,
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
content::ProtocolHandlerScopedVector protocol_interceptors); content::URLRequestInterceptorScopedVector protocol_interceptors);
virtual ~URLRequestContextGetter(); virtual ~URLRequestContextGetter();
// net::URLRequestContextGetter: // net::URLRequestContextGetter:
@ -66,7 +66,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
scoped_ptr<net::URLRequestContext> url_request_context_; scoped_ptr<net::URLRequestContext> url_request_context_;
scoped_ptr<net::HostMappingRules> host_mapping_rules_; scoped_ptr<net::HostMappingRules> host_mapping_rules_;
content::ProtocolHandlerMap protocol_handlers_; content::ProtocolHandlerMap protocol_handlers_;
content::ProtocolHandlerScopedVector protocol_interceptors_; content::URLRequestInterceptorScopedVector protocol_interceptors_;
DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter); DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
}; };

View file

@ -138,7 +138,6 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) {
params.delegate = new DevToolsWindowDelegate(this, params.delegate = new DevToolsWindowDelegate(this,
devtools_window_web_view_, devtools_window_web_view_,
devtools_window_.get()); devtools_window_.get());
params.top_level = true;
params.bounds = inspectable_web_contents()->GetDevToolsBounds(); params.bounds = inspectable_web_contents()->GetDevToolsBounds();
#if defined(USE_X11) #if defined(USE_X11)
// In X11 the window frame is drawn by the application. // In X11 the window frame is drawn by the application.