From dca1c51b3214c287914258570d5db406aa1299ec Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 31 Aug 2014 18:43:01 +0800 Subject: [PATCH] Fix API changes of Chrome37. --- brightray/browser/browser_client.cc | 2 +- brightray/browser/browser_client.h | 2 +- brightray/browser/browser_context.cc | 45 +++---------------- brightray/browser/browser_context.h | 36 +++------------ brightray/browser/devtools_delegate.cc | 5 ++- .../browser/inspectable_web_contents_impl.cc | 3 +- .../browser/url_request_context_getter.cc | 16 +++---- .../browser/url_request_context_getter.h | 6 +-- .../inspectable_web_contents_view_views.cc | 1 - 9 files changed, 30 insertions(+), 86 deletions(-) diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index 3c7377d6d9a0..c306bfc26c72 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -61,7 +61,7 @@ content::BrowserMainParts* BrowserClient::CreateBrowserMainParts( net::URLRequestContextGetter* BrowserClient::CreateRequestContext( content::BrowserContext* browser_context, content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector protocol_interceptors) { + content::URLRequestInterceptorScopedVector protocol_interceptors) { auto context = static_cast(browser_context); return context->CreateRequestContext(protocol_handlers, protocol_interceptors.Pass()); } diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index 6d1944ca0264..565ff18cc9c8 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -36,7 +36,7 @@ class BrowserClient : public content::ContentBrowserClient { virtual net::URLRequestContextGetter* CreateRequestContext( content::BrowserContext* browser_context, content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector protocol_interceptors) OVERRIDE; + content::URLRequestInterceptorScopedVector protocol_interceptors) OVERRIDE; private: virtual content::BrowserMainParts* CreateBrowserMainParts( diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 3396531ed35d..26eba048b30d 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -101,7 +101,7 @@ void BrowserContext::RegisterInternalPrefs(PrefRegistrySimple* registry) { net::URLRequestContextGetter* BrowserContext::CreateRequestContext( content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector protocol_interceptors) { + content::URLRequestInterceptorScopedVector protocol_interceptors) { DCHECK(!url_request_getter_); url_request_getter_ = new URLRequestContextGetter( this, @@ -120,7 +120,7 @@ net::NetworkDelegate* BrowserContext::CreateNetworkDelegate() { net::URLRequestJobFactory* BrowserContext::CreateURLRequestJobFactory( content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector* protocol_interceptors) { + content::URLRequestInterceptorScopedVector* protocol_interceptors) { return NULL; } @@ -158,36 +158,6 @@ net::URLRequestContextGetter* 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() { return resource_context_.get(); } @@ -198,17 +168,16 @@ content::DownloadManagerDelegate* BrowserContext::GetDownloadManagerDelegate() { return download_manager_delegate_.get(); } -content::GeolocationPermissionContext* - BrowserContext::GetGeolocationPermissionContext() { - return nullptr; +content::BrowserPluginGuestManager* BrowserContext::GetGuestManager() { + return NULL; } quota::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() { - return nullptr; + return NULL; } -content::BrowserPluginGuestManagerDelegate* BrowserContext::GetGuestManagerDelegate() { - return nullptr; +content::PushMessagingService* BrowserContext::GetPushMessagingService() { + return NULL; } } // namespace brightray diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index 6bd2a1b81d9c..8ed7bc1a3c01 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -26,7 +26,7 @@ class BrowserContext : public content::BrowserContext, net::URLRequestContextGetter* CreateRequestContext( content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector protocol_interceptors); + content::URLRequestInterceptorScopedVector protocol_interceptors); net::URLRequestContextGetter* url_request_context_getter() const { return url_request_getter_.get(); @@ -42,7 +42,7 @@ class BrowserContext : public content::BrowserContext, virtual net::NetworkDelegate* CreateNetworkDelegate() OVERRIDE; virtual net::URLRequestJobFactory* CreateURLRequestJobFactory( content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector* protocol_interceptors) OVERRIDE; + content::URLRequestInterceptorScopedVector* protocol_interceptors) OVERRIDE; virtual base::FilePath GetPath() const OVERRIDE; @@ -61,35 +61,11 @@ class BrowserContext : public content::BrowserContext, virtual net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( 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::DownloadManagerDelegate* - GetDownloadManagerDelegate() OVERRIDE; - virtual content::GeolocationPermissionContext* - GetGeolocationPermissionContext() OVERRIDE; - virtual content::BrowserPluginGuestManagerDelegate* - GetGuestManagerDelegate() OVERRIDE; - virtual quota::SpecialStoragePolicy* - GetSpecialStoragePolicy() OVERRIDE; + virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; + virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE; + virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; + virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE; base::FilePath path_; scoped_ptr resource_context_; diff --git a/brightray/browser/devtools_delegate.cc b/brightray/browser/devtools_delegate.cc index ded349dce67d..d6ef0144711f 100644 --- a/brightray/browser/devtools_delegate.cc +++ b/brightray/browser/devtools_delegate.cc @@ -68,6 +68,7 @@ class Target : public content::DevToolsTarget { explicit Target(WebContents* web_contents); 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 GetTitle() const OVERRIDE { return title_; } virtual std::string GetDescription() const OVERRIDE { return std::string(); } @@ -134,8 +135,8 @@ DevToolsDelegate::DevToolsDelegate( content::BrowserContext* browser_context) : browser_context_(browser_context) { std::string frontend_url; - devtools_http_handler_ = - DevToolsHttpHandler::Start(CreateSocketFactory(), frontend_url, this); + devtools_http_handler_ = DevToolsHttpHandler::Start( + CreateSocketFactory(), frontend_url, this, base::FilePath()); } DevToolsDelegate::~DevToolsDelegate() { diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 4938b355db9c..c512d2eb2e9d 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -156,8 +156,7 @@ void InspectableWebContentsImpl::ShowDevTools() { embedder_message_dispatcher_.reset( new DevToolsEmbedderMessageDispatcher(this)); - auto create_params = content::WebContents::CreateParams( - web_contents_->GetBrowserContext()); + content::WebContents::CreateParams create_params(web_contents_->GetBrowserContext()); devtools_web_contents_.reset(content::WebContents::Create(create_params)); Observe(devtools_web_contents_.get()); diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index da57591ed95e..a366c7918d0b 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -15,7 +15,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_store_factory.h" #include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" #include "net/base/host_mapping_rules.h" #include "net/cert/cert_verifier.h" #include "net/cookies/cookie_monster.h" @@ -33,11 +32,12 @@ #include "net/ssl/ssl_config_service_defaults.h" #include "net/url_request/data_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/url_request_context.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 "url/url_constants.h" #include "webkit/browser/quota/special_storage_policy.h" using content::BrowserThread; @@ -75,24 +75,24 @@ const char kProxyServer[] = "proxy-server"; net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJobFactory( content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector* protocol_interceptors) { + content::URLRequestInterceptorScopedVector* protocol_interceptors) { scoped_ptr job_factory(new net::URLRequestJobFactoryImpl); for (auto it = protocol_handlers->begin(); it != protocol_handlers->end(); ++it) job_factory->SetProtocolHandler(it->first, it->second.release()); protocol_handlers->clear(); - job_factory->SetProtocolHandler(content::kDataScheme, new net::DataProtocolHandler); - job_factory->SetProtocolHandler(content::kFileScheme, new net::FileProtocolHandler( + job_factory->SetProtocolHandler(url::kDataScheme, new net::DataProtocolHandler); + job_factory->SetProtocolHandler(url::kFileScheme, new net::FileProtocolHandler( BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); // Set up interceptors in the reverse order. scoped_ptr top_job_factory = job_factory.PassAs(); - for (content::ProtocolHandlerScopedVector::reverse_iterator i = protocol_interceptors->rbegin(); + for (content::URLRequestInterceptorScopedVector::reverse_iterator i = protocol_interceptors->rbegin(); 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))); protocol_interceptors->weak_clear(); @@ -105,7 +105,7 @@ URLRequestContextGetter::URLRequestContextGetter( base::MessageLoop* io_loop, base::MessageLoop* file_loop, content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector protocol_interceptors) + content::URLRequestInterceptorScopedVector protocol_interceptors) : delegate_(delegate), base_path_(base_path), io_loop_(io_loop), diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index c7379f2248a0..970d4b8458a6 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -35,7 +35,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { virtual net::NetworkDelegate* CreateNetworkDelegate() { return NULL; } virtual net::URLRequestJobFactory* CreateURLRequestJobFactory( content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector* protocol_interceptors); + content::URLRequestInterceptorScopedVector* protocol_interceptors); }; URLRequestContextGetter( @@ -44,7 +44,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { base::MessageLoop* io_loop, base::MessageLoop* file_loop, content::ProtocolHandlerMap* protocol_handlers, - content::ProtocolHandlerScopedVector protocol_interceptors); + content::URLRequestInterceptorScopedVector protocol_interceptors); virtual ~URLRequestContextGetter(); // net::URLRequestContextGetter: @@ -66,7 +66,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { scoped_ptr url_request_context_; scoped_ptr host_mapping_rules_; content::ProtocolHandlerMap protocol_handlers_; - content::ProtocolHandlerScopedVector protocol_interceptors_; + content::URLRequestInterceptorScopedVector protocol_interceptors_; DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter); }; diff --git a/brightray/browser/views/inspectable_web_contents_view_views.cc b/brightray/browser/views/inspectable_web_contents_view_views.cc index e810414e0d21..5a5e1d9ff3ed 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.cc +++ b/brightray/browser/views/inspectable_web_contents_view_views.cc @@ -138,7 +138,6 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) { params.delegate = new DevToolsWindowDelegate(this, devtools_window_web_view_, devtools_window_.get()); - params.top_level = true; params.bounds = inspectable_web_contents()->GetDevToolsBounds(); #if defined(USE_X11) // In X11 the window frame is drawn by the application.