diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index c306bfc26c72..a7e2f3f73f8a 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -69,11 +69,11 @@ net::URLRequestContextGetter* BrowserClient::CreateRequestContext( void BrowserClient::ShowDesktopNotification( const content::ShowDesktopNotificationHostMsgParams& params, content::RenderFrameHost* render_frame_host, - content::DesktopNotificationDelegate* delegate, + scoped_ptr delegate, base::Closure* cancel_callback) { auto presenter = notification_presenter(); if (presenter) - presenter->ShowNotification(params, delegate, cancel_callback); + presenter->ShowNotification(params, delegate.Pass(), cancel_callback); } content::MediaObserver* BrowserClient::GetMediaObserver() { diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index 565ff18cc9c8..ca06b739a387 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -42,10 +42,10 @@ class BrowserClient : public content::ContentBrowserClient { virtual content::BrowserMainParts* CreateBrowserMainParts( const content::MainFunctionParams&) OVERRIDE; virtual void ShowDesktopNotification( - const content::ShowDesktopNotificationHostMsgParams&, + const content::ShowDesktopNotificationHostMsgParams& params, content::RenderFrameHost* render_frame_host, - content::DesktopNotificationDelegate* delegate, - base::Closure* cancel_callback) OVERRIDE; + scoped_ptr delegate, + base::Closure* cancel_callback) override; virtual content::MediaObserver* GetMediaObserver() OVERRIDE; virtual void GetAdditionalAllowedSchemesForFileSystem( std::vector* additional_schemes) OVERRIDE; diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index d539ccbccede..8d5a926c1948 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -174,4 +174,8 @@ content::PushMessagingService* BrowserContext::GetPushMessagingService() { return NULL; } +content::SSLHostStateDelegate* BrowserContext::GetSSLHostStateDelegate() { + return nullptr; +} + } // namespace brightray diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index 9dfd03d9e2d7..6b477d104ff2 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -63,6 +63,7 @@ class BrowserContext : public content::BrowserContext, virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE; virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE; + virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; base::FilePath path_; scoped_ptr resource_context_; diff --git a/brightray/browser/devtools_delegate.cc b/brightray/browser/devtools_delegate.cc index d6ef0144711f..e46973505bbf 100644 --- a/brightray/browser/devtools_delegate.cc +++ b/brightray/browser/devtools_delegate.cc @@ -96,8 +96,7 @@ class Target : public content::DevToolsTarget { }; Target::Target(WebContents* web_contents) { - agent_host_ = - DevToolsAgentHost::GetOrCreateFor(web_contents->GetRenderViewHost()); + agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents); id_ = agent_host_->GetId(); title_ = base::UTF16ToUTF8(web_contents->GetTitle()); url_ = web_contents->GetURL(); @@ -109,10 +108,7 @@ Target::Target(WebContents* web_contents) { } bool Target::Activate() const { - RenderViewHost* rvh = agent_host_->GetRenderViewHost(); - if (!rvh) - return false; - WebContents* web_contents = WebContents::FromRenderViewHost(rvh); + WebContents* web_contents = agent_host_->GetWebContents(); if (!web_contents) return false; web_contents->GetDelegate()->ActivateContents(web_contents); @@ -120,10 +116,10 @@ bool Target::Activate() const { } bool Target::Close() const { - RenderViewHost* rvh = agent_host_->GetRenderViewHost(); - if (!rvh) + WebContents* web_contents = agent_host_->GetWebContents(); + if (!web_contents) return false; - rvh->ClosePage(); + web_contents->GetRenderViewHost()->ClosePage(); return true; } @@ -176,13 +172,12 @@ DevToolsDelegate::CreateNewTarget(const GURL& url) { void DevToolsDelegate::EnumerateTargets(TargetCallback callback) { TargetList targets; - std::vector rvh_list = - content::DevToolsAgentHost::GetValidRenderViewHosts(); - for (std::vector::iterator it = rvh_list.begin(); - it != rvh_list.end(); ++it) { - WebContents* web_contents = WebContents::FromRenderViewHost(*it); - if (web_contents) - targets.push_back(new Target(web_contents)); + std::vector wc_list = + content::DevToolsAgentHost::GetInspectableWebContents(); + for (std::vector::iterator it = wc_list.begin(); + it != wc_list.end(); + ++it) { + targets.push_back(new Target(*it)); } callback.Run(targets); } diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 2cb8aba6defe..b2af61d8f108 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -164,13 +164,10 @@ void InspectableWebContentsImpl::ShowDevTools() { Observe(devtools_web_contents_.get()); devtools_web_contents_->SetDelegate(this); - agent_host_ = content::DevToolsAgentHost::GetOrCreateFor( - web_contents_->GetRenderViewHost()); - frontend_host_.reset( - content::DevToolsClientHost::CreateDevToolsFrontendHost( - devtools_web_contents_.get(), this)); - content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor( - agent_host_, frontend_host_.get()); + agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get()); + frontend_host_.reset(content::DevToolsFrontendHost::Create( + web_contents_->GetRenderViewHost(), this)); + content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(agent_host_, this); GURL devtools_url(kChromeUIDevToolsURL); devtools_web_contents_->GetController().LoadURL( @@ -291,8 +288,7 @@ void InspectableWebContentsImpl::ResetZoom() { SetZoomLevelForWebContents(devtools_web_contents(), 0.); } -void InspectableWebContentsImpl::DispatchOnEmbedder( - const std::string& message) { +void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::string& message) { std::string method; base::ListValue params; int id; @@ -309,31 +305,43 @@ void InspectableWebContentsImpl::DispatchOnEmbedder( } } +void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontendToBackend( + const std::string& message) { + content::DevToolsManager::GetInstance()->DispatchOnInspectorBackend( + this, message); +} + +void InspectableWebContentsImpl::DispatchOnInspectorFrontend( + const std::string& message) { + std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");"; + base::string16 javascript = base::UTF8ToUTF16(code); + web_contents()->GetMainFrame()->ExecuteJavaScript(javascript); +} + void InspectableWebContentsImpl::InspectedContentsClosing() { } +void InspectableWebContentsImpl::ReplacedWithAnotherClient() { +} + void InspectableWebContentsImpl::AboutToNavigateRenderView( content::RenderViewHost* render_view_host) { - content::DevToolsClientHost::SetupDevToolsFrontendClient( - web_contents()->GetRenderViewHost()); + frontend_host_.reset(content::DevToolsFrontendHost::Create( + render_view_host, this)); } -void InspectableWebContentsImpl::DidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost*) { - if (!is_main_frame) +void InspectableWebContentsImpl::DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { + if (render_frame_host->GetParent()) return; view_->ShowDevTools(); } void InspectableWebContentsImpl::WebContentsDestroyed() { - content::DevToolsManager::GetInstance()->ClientHostClosing( - frontend_host_.get()); + content::DevToolsManager::GetInstance()->ClientHostClosing(this); Observe(nullptr); agent_host_ = nullptr; - frontend_host_.reset(); } bool InspectableWebContentsImpl::AddMessageToConsole( diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 4caf9cdac6bf..1e4ad995e445 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -11,7 +11,8 @@ #include "browser/devtools_contents_resizing_strategy.h" #include "browser/devtools_embedder_message_dispatcher.h" -#include "content/public/browser/devtools_frontend_host_delegate.h" +#include "content/public/browser/devtools_client_host.h" +#include "content/public/browser/devtools_frontend_host.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" #include "ui/gfx/rect.h" @@ -20,7 +21,6 @@ class PrefRegistrySimple; namespace content { class DevToolsAgentHost; -class DevToolsClientHost; } namespace brightray { @@ -30,10 +30,11 @@ class InspectableWebContentsView; class InspectableWebContentsImpl : public InspectableWebContents, - content::DevToolsFrontendHostDelegate, - content::WebContentsObserver, - content::WebContentsDelegate, - DevToolsEmbedderMessageDispatcher::Delegate { + public content::DevToolsFrontendHost::Delegate, + public content::DevToolsClientHost, + public content::WebContentsObserver, + public content::WebContentsDelegate, + public DevToolsEmbedderMessageDispatcher::Delegate { public: static void RegisterPrefs(PrefRegistrySimple* pref_registry); @@ -92,19 +93,19 @@ class InspectableWebContentsImpl : virtual void ZoomOut() OVERRIDE; virtual void ResetZoom() OVERRIDE; - // content::DevToolsFrontendHostDelegate + // content::DevToolsClientHost: + virtual void DispatchOnInspectorFrontend(const std::string& message) override; + virtual void InspectedContentsClosing() override; + virtual void ReplacedWithAnotherClient() override; - virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE; - virtual void InspectedContentsClosing() OVERRIDE; + // content::DevToolsFrontendHostDelegate: + virtual void HandleMessageFromDevToolsFrontend(const std::string& message) override; + virtual void HandleMessageFromDevToolsFrontendToBackend(const std::string& message) override; - // content::WebContentsObserver - - virtual void AboutToNavigateRenderView( - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void DidFinishLoad(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - content::RenderViewHost*) OVERRIDE; + // content::WebContentsObserver: + virtual void AboutToNavigateRenderView(content::RenderViewHost* render_view_host) override; + virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) OVERRIDE; virtual void WebContentsDestroyed() OVERRIDE; // content::WebContentsDelegate @@ -119,10 +120,10 @@ class InspectableWebContentsImpl : virtual void CloseContents(content::WebContents* source) OVERRIDE; scoped_ptr web_contents_; - scoped_ptr frontend_host_; scoped_ptr devtools_web_contents_; scoped_ptr view_; scoped_refptr agent_host_; + scoped_ptr frontend_host_; DevToolsContentsResizingStrategy contents_resizing_strategy_; gfx::Rect devtools_bounds_; diff --git a/brightray/browser/linux/notification_presenter_linux.cc b/brightray/browser/linux/notification_presenter_linux.cc index f73479980927..c31e3d01e9fc 100644 --- a/brightray/browser/linux/notification_presenter_linux.cc +++ b/brightray/browser/linux/notification_presenter_linux.cc @@ -52,13 +52,15 @@ NotificationPresenterLinux::~NotificationPresenterLinux() { void NotificationPresenterLinux::ShowNotification( const content::ShowDesktopNotificationHostMsgParams& params, - content::DesktopNotificationDelegate* delegate, + scoped_ptr delegate_ptr, base::Closure* cancel_callback) { std::string title = base::UTF16ToUTF8(params.title); std::string body = base::UTF16ToUTF8(params.body); NotifyNotification* notification = notify_notification_new(title.c_str(), body.c_str(), nullptr); - g_object_set_data(G_OBJECT(notification), "delegate", delegate); + content::DesktopNotificationDelegate* delegate = delegate_ptr.release(); + + g_object_set_data_full(G_OBJECT(notification), "delegate", delegate, operator delete); g_signal_connect(notification, "closed", G_CALLBACK(OnNotificationClosedThunk), this); notify_notification_add_action(notification, "default", "View", OnNotificationViewThunk, this, nullptr); diff --git a/brightray/browser/linux/notification_presenter_linux.h b/brightray/browser/linux/notification_presenter_linux.h index 07e628e29a47..b42e4eb3dbeb 100644 --- a/brightray/browser/linux/notification_presenter_linux.h +++ b/brightray/browser/linux/notification_presenter_linux.h @@ -27,7 +27,7 @@ class NotificationPresenterLinux : public NotificationPresenter { // NotificationPresenter: virtual void ShowNotification( const content::ShowDesktopNotificationHostMsgParams&, - content::DesktopNotificationDelegate* delegate, + scoped_ptr delegate, base::Closure* cancel_callback) OVERRIDE; void CancelNotification(NotifyNotification* notification); diff --git a/brightray/browser/media/media_capture_devices_dispatcher.cc b/brightray/browser/media/media_capture_devices_dispatcher.cc index e38770024de4..ddf1948a18e4 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.cc +++ b/brightray/browser/media/media_capture_devices_dispatcher.cc @@ -138,9 +138,8 @@ void MediaCaptureDevicesDispatcher::OnMediaRequestStateChanged( int render_view_id, int page_request_id, const GURL& security_origin, - const content::MediaStreamDevice& device, + content::MediaStreamType stream_type, content::MediaRequestState state) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); } void MediaCaptureDevicesDispatcher::OnAudioStreamPlaying( diff --git a/brightray/browser/media/media_capture_devices_dispatcher.h b/brightray/browser/media/media_capture_devices_dispatcher.h index 3b29fae4701a..b38a6b8a3715 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.h +++ b/brightray/browser/media/media_capture_devices_dispatcher.h @@ -58,8 +58,8 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver { int render_view_id, int page_request_id, const GURL& security_origin, - const content::MediaStreamDevice& device, - content::MediaRequestState state) OVERRIDE; + content::MediaStreamType stream_type, + content::MediaRequestState state) override; virtual void OnAudioStreamPlaying( int render_process_id, int render_frame_id, diff --git a/brightray/browser/notification_presenter.h b/brightray/browser/notification_presenter.h index 23420fb9cf5a..6c7def322ae1 100644 --- a/brightray/browser/notification_presenter.h +++ b/brightray/browser/notification_presenter.h @@ -2,6 +2,7 @@ #define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_ #include "base/callback_forward.h" +#include "base/memory/scoped_ptr.h" namespace content { class DesktopNotificationDelegate; @@ -18,7 +19,7 @@ class NotificationPresenter { virtual void ShowNotification( const content::ShowDesktopNotificationHostMsgParams&, - content::DesktopNotificationDelegate* delegate, + scoped_ptr delegate, base::Closure* cancel_callback) = 0; }; diff --git a/brightray/browser/notification_presenter_mac.h b/brightray/browser/notification_presenter_mac.h index 9c7a3a3c2767..508ad315f018 100644 --- a/brightray/browser/notification_presenter_mac.h +++ b/brightray/browser/notification_presenter_mac.h @@ -22,8 +22,8 @@ class NotificationPresenterMac : public NotificationPresenter { virtual void ShowNotification( const content::ShowDesktopNotificationHostMsgParams&, - content::DesktopNotificationDelegate* delegate, - base::Closure* cancel_callback) OVERRIDE; + scoped_ptr delegate, + base::Closure* cancel_callback) override; // Get the delegate accroding from the notification object. content::DesktopNotificationDelegate* GetDelegateFromNotification( diff --git a/brightray/browser/notification_presenter_mac.mm b/brightray/browser/notification_presenter_mac.mm index 2bb595ed55ce..78e3cc2fd455 100644 --- a/brightray/browser/notification_presenter_mac.mm +++ b/brightray/browser/notification_presenter_mac.mm @@ -41,20 +41,20 @@ NotificationPresenterMac::~NotificationPresenterMac() { void NotificationPresenterMac::ShowNotification( const content::ShowDesktopNotificationHostMsgParams& params, - content::DesktopNotificationDelegate* delegate, + scoped_ptr delegate, base::Closure* cancel_callback) { auto notification = [[NSUserNotification alloc] init]; notification.title = base::SysUTF16ToNSString(params.title); notification.informativeText = base::SysUTF16ToNSString(params.body); - notifications_map_[delegate].reset(notification); + notifications_map_[delegate.get()].reset(notification); [NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:notification]; if (cancel_callback) *cancel_callback = base::Bind( &NotificationPresenterMac::CancelNotification, base::Unretained(this), - delegate); + delegate.release()); } content::DesktopNotificationDelegate* NotificationPresenterMac::GetDelegateFromNotification( @@ -67,8 +67,10 @@ content::DesktopNotificationDelegate* NotificationPresenterMac::GetDelegateFromN } void NotificationPresenterMac::RemoveNotification(content::DesktopNotificationDelegate* delegate) { - if (ContainsKey(notifications_map_, delegate)) + if (ContainsKey(notifications_map_, delegate)) { + delete delegate; notifications_map_.erase(delegate); + } } void NotificationPresenterMac::CancelNotification(content::DesktopNotificationDelegate* delegate) { diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 167228beca51..7010aa464a4a 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -27,8 +27,8 @@ #include "net/proxy/proxy_script_fetcher_impl.h" #include "net/proxy/proxy_service.h" #include "net/proxy/proxy_service_v8.h" -#include "net/ssl/default_server_bound_cert_store.h" -#include "net/ssl/server_bound_cert_service.h" +#include "net/ssl/channel_id_service.h" +#include "net/ssl/default_channel_id_store.h" #include "net/ssl/ssl_config_service_defaults.h" #include "net/url_request/data_protocol_handler.h" #include "net/url_request/file_protocol_handler.h" @@ -145,8 +145,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, NULL, NULL); storage_->set_cookie_store(content::CreateCookieStore(cookie_config)); - storage_->set_server_bound_cert_service(new net::ServerBoundCertService( - new net::DefaultServerBoundCertStore(NULL), + storage_->set_channel_id_service(new net::ChannelIDService( + new net::DefaultChannelIDStore(NULL), base::WorkerPool::GetTaskRunner(true))); storage_->set_http_user_agent_settings(new net::StaticHttpUserAgentSettings( "en-us,en", base::EmptyString())); @@ -197,8 +197,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { network_session_params.ignore_certificate_errors = false; network_session_params.transport_security_state = url_request_context_->transport_security_state(); - network_session_params.server_bound_cert_service = - url_request_context_->server_bound_cert_service(); + network_session_params.channel_id_service = + url_request_context_->channel_id_service(); network_session_params.http_auth_handler_factory = url_request_context_->http_auth_handler_factory(); diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index 887f3b7895c5..f9abe65eddd9 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 887f3b7895c55625d20d7ea06fa041dcacdb8b47 +Subproject commit f9abe65eddd9f233e215151c7487ac19af2a60d9