From 9fd88e9bb7efa2bed6fe65cdc5b34673b5aca5be Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 8 Mar 2016 10:04:06 +0900 Subject: [PATCH 01/21] Update to Chrome 49 --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index ad63d8ba89..881cf10e52 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7 +Subproject commit 881cf10e5255c3037d5624616fd7544c1e7252ae From c72c89bd75dbaf3d22d9242b04b0c23482836130 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 8 Mar 2016 10:14:16 +0900 Subject: [PATCH 02/21] No more basictypes.h --- brightray/browser/devtools_contents_resizing_strategy.h | 2 +- brightray/browser/devtools_manager_delegate.h | 2 +- brightray/browser/inspectable_web_contents_impl.cc | 4 ++-- brightray/browser/inspectable_web_contents_impl.h | 4 ++-- brightray/browser/web_ui_controller_factory.h | 2 +- brightray/browser/win/scoped_hstring.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/brightray/browser/devtools_contents_resizing_strategy.h b/brightray/browser/devtools_contents_resizing_strategy.h index 9c82c060b1..c48272f797 100644 --- a/brightray/browser/devtools_contents_resizing_strategy.h +++ b/brightray/browser/devtools_contents_resizing_strategy.h @@ -5,7 +5,7 @@ #ifndef BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ #define BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" diff --git a/brightray/browser/devtools_manager_delegate.h b/brightray/browser/devtools_manager_delegate.h index ed8e357482..12eedc6608 100644 --- a/brightray/browser/devtools_manager_delegate.h +++ b/brightray/browser/devtools_manager_delegate.h @@ -5,7 +5,7 @@ #ifndef BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ #define BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/compiler_specific.h" #include "components/devtools_http_handler/devtools_http_handler_delegate.h" #include "content/public/browser/devtools_manager_delegate.h" diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 1ff21b694a..b876ef8628 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -592,9 +592,9 @@ void InspectableWebContentsImpl::WebContentsDestroyed() { bool InspectableWebContentsImpl::AddMessageToConsole( content::WebContents* source, - int32 level, + int32_t level, const base::string16& message, - int32 line_no, + int32_t line_no, const base::string16& source_id) { logging::LogMessage("CONSOLE", line_no, level).stream() << "\"" << message << "\", source: " << source_id << " (" << line_no << ")"; diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 9b985bbc6c..8543f5e99e 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -134,9 +134,9 @@ class InspectableWebContentsImpl : // content::WebContentsDelegate: bool AddMessageToConsole(content::WebContents* source, - int32 level, + int32_t level, const base::string16& message, - int32 line_no, + int32_t line_no, const base::string16& source_id) override; bool ShouldCreateWebContents( content::WebContents* web_contents, diff --git a/brightray/browser/web_ui_controller_factory.h b/brightray/browser/web_ui_controller_factory.h index 44a77da5f1..ca86de6baa 100644 --- a/brightray/browser/web_ui_controller_factory.h +++ b/brightray/browser/web_ui_controller_factory.h @@ -5,7 +5,7 @@ #ifndef BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ #define BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller_factory.h" diff --git a/brightray/browser/win/scoped_hstring.h b/brightray/browser/win/scoped_hstring.h index 5494df2fc5..67e4fe67fd 100644 --- a/brightray/browser/win/scoped_hstring.h +++ b/brightray/browser/win/scoped_hstring.h @@ -10,7 +10,7 @@ #include #include -#include "base/basictypes.h" +#include "base/macros.h" class ScopedHString { public: From da59c0f58b044b0b13aa0a522272489ada2a60fe Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 21:38:56 -0800 Subject: [PATCH 03/21] basictypes.h => macros.h --- brightray/browser/devtools_contents_resizing_strategy.h | 2 +- brightray/browser/devtools_manager_delegate.h | 2 +- brightray/browser/inspectable_web_contents_impl.cc | 4 ++-- brightray/browser/inspectable_web_contents_impl.h | 4 ++-- brightray/browser/net/devtools_network_interceptor.cc | 2 +- brightray/browser/web_ui_controller_factory.h | 2 +- brightray/browser/win/scoped_hstring.h | 2 +- brightray/browser/win/windows_toast_notification.cc | 4 ++-- brightray/browser/win/windows_toast_notification.h | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/brightray/browser/devtools_contents_resizing_strategy.h b/brightray/browser/devtools_contents_resizing_strategy.h index 9c82c060b1..c48272f797 100644 --- a/brightray/browser/devtools_contents_resizing_strategy.h +++ b/brightray/browser/devtools_contents_resizing_strategy.h @@ -5,7 +5,7 @@ #ifndef BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ #define BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" diff --git a/brightray/browser/devtools_manager_delegate.h b/brightray/browser/devtools_manager_delegate.h index ed8e357482..12eedc6608 100644 --- a/brightray/browser/devtools_manager_delegate.h +++ b/brightray/browser/devtools_manager_delegate.h @@ -5,7 +5,7 @@ #ifndef BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ #define BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/compiler_specific.h" #include "components/devtools_http_handler/devtools_http_handler_delegate.h" #include "content/public/browser/devtools_manager_delegate.h" diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 1ff21b694a..b876ef8628 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -592,9 +592,9 @@ void InspectableWebContentsImpl::WebContentsDestroyed() { bool InspectableWebContentsImpl::AddMessageToConsole( content::WebContents* source, - int32 level, + int32_t level, const base::string16& message, - int32 line_no, + int32_t line_no, const base::string16& source_id) { logging::LogMessage("CONSOLE", line_no, level).stream() << "\"" << message << "\", source: " << source_id << " (" << line_no << ")"; diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 9b985bbc6c..8543f5e99e 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -134,9 +134,9 @@ class InspectableWebContentsImpl : // content::WebContentsDelegate: bool AddMessageToConsole(content::WebContents* source, - int32 level, + int32_t level, const base::string16& message, - int32 line_no, + int32_t line_no, const base::string16& source_id) override; bool ShouldCreateWebContents( content::WebContents* web_contents, diff --git a/brightray/browser/net/devtools_network_interceptor.cc b/brightray/browser/net/devtools_network_interceptor.cc index 78afb00a09..2535ed74bd 100644 --- a/brightray/browser/net/devtools_network_interceptor.cc +++ b/brightray/browser/net/devtools_network_interceptor.cc @@ -207,7 +207,7 @@ void DevToolsNetworkInterceptor::ArmTimer(base::TimeTicks now) { base::TimeTicks desired_time = offset_ + tick_length_ * (last_tick_ + min_ticks_left); - int64_t min_baseline = std::numeric_limits::max(); + int64_t min_baseline = std::numeric_limits::max(); for (size_t i = 0; i < suspend_count; ++i) { if (suspended_transactions_[i].second < min_baseline) min_baseline = suspended_transactions_[i].second; diff --git a/brightray/browser/web_ui_controller_factory.h b/brightray/browser/web_ui_controller_factory.h index 44a77da5f1..ca86de6baa 100644 --- a/brightray/browser/web_ui_controller_factory.h +++ b/brightray/browser/web_ui_controller_factory.h @@ -5,7 +5,7 @@ #ifndef BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ #define BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller_factory.h" diff --git a/brightray/browser/win/scoped_hstring.h b/brightray/browser/win/scoped_hstring.h index 5494df2fc5..67e4fe67fd 100644 --- a/brightray/browser/win/scoped_hstring.h +++ b/brightray/browser/win/scoped_hstring.h @@ -10,7 +10,7 @@ #include #include -#include "base/basictypes.h" +#include "base/macros.h" class ScopedHString { public: diff --git a/brightray/browser/win/windows_toast_notification.cc b/brightray/browser/win/windows_toast_notification.cc index c1be87223c..badd4f2254 100644 --- a/brightray/browser/win/windows_toast_notification.cc +++ b/brightray/browser/win/windows_toast_notification.cc @@ -330,7 +330,7 @@ bool WindowsToastNotification::GetTextNodeList( ScopedHString* tag, IXmlDocument* doc, IXmlNodeList** node_list, - UINT32 req_length) { + Uint32_t req_length) { tag->Reset(L"text"); if (!tag->success()) return false; @@ -338,7 +338,7 @@ bool WindowsToastNotification::GetTextNodeList( if (FAILED(doc->GetElementsByTagName(*tag, node_list))) return false; - UINT32 node_length; + Uint32_t node_length; if (FAILED((*node_list)->get_Length(&node_length))) return false; diff --git a/brightray/browser/win/windows_toast_notification.h b/brightray/browser/win/windows_toast_notification.h index cb69d3da2a..6cd7bafe87 100644 --- a/brightray/browser/win/windows_toast_notification.h +++ b/brightray/browser/win/windows_toast_notification.h @@ -70,7 +70,7 @@ class WindowsToastNotification : public Notification { bool GetTextNodeList(ScopedHString* tag, ABI::Windows::Data::Xml::Dom::IXmlDocument* doc, ABI::Windows::Data::Xml::Dom::IXmlNodeList** nodeList, - UINT32 reqLength); + Uint32_t reqLength); bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc, ABI::Windows::Data::Xml::Dom::IXmlNode* node, const std::wstring& text); From e901b1c6caae54144805a1add9453a4636d8283e Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 21:59:14 -0800 Subject: [PATCH 04/21] Update NetworkDelegate --- brightray/browser/network_delegate.cc | 13 +++++++------ brightray/browser/network_delegate.h | 9 +++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/brightray/browser/network_delegate.cc b/brightray/browser/network_delegate.cc index 8a1f8ee828..e03adba65a 100644 --- a/brightray/browser/network_delegate.cc +++ b/brightray/browser/network_delegate.cc @@ -92,14 +92,11 @@ void NetworkDelegate::OnBeforeRedirect(net::URLRequest* request, void NetworkDelegate::OnResponseStarted(net::URLRequest* request) { } -void NetworkDelegate::OnURLRequestJobOrphaned(net::URLRequest* request) { -} - -void NetworkDelegate::OnNetworkBytesReceived(const net::URLRequest& request, +void NetworkDelegate::OnNetworkBytesReceived(net::URLRequest* request, int64_t bytes_read) { } -void NetworkDelegate::OnNetworkBytesSent(const net::URLRequest& request, +void NetworkDelegate::OnNetworkBytesSent(net::URLRequest* request, int64_t bytes_sent) { } @@ -143,7 +140,11 @@ bool NetworkDelegate::OnCanEnablePrivacyMode( return false; } -bool NetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const { +bool OnAreStrictSecureCookiesEnabled() { + return true; +} + +bool OnAreExperimentalCookieFeaturesEnabled() { return true; } diff --git a/brightray/browser/network_delegate.h b/brightray/browser/network_delegate.h index b10cabadd2..1135875400 100644 --- a/brightray/browser/network_delegate.h +++ b/brightray/browser/network_delegate.h @@ -43,10 +43,9 @@ class NetworkDelegate : public net::NetworkDelegate { void OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) override; void OnResponseStarted(net::URLRequest* request) override; - void OnURLRequestJobOrphaned(net::URLRequest* request) override; - void OnNetworkBytesReceived(const net::URLRequest& request, + void OnNetworkBytesReceived(net::URLRequest* request, int64_t bytes_read) override; - void OnNetworkBytesSent(const net::URLRequest& request, + void OnNetworkBytesSent(net::URLRequest* request, int64_t bytes_sent) override; void OnCompleted(net::URLRequest* request, bool started) override; void OnURLRequestDestroyed(net::URLRequest* request) override; @@ -67,7 +66,9 @@ class NetworkDelegate : public net::NetworkDelegate { bool OnCanEnablePrivacyMode( const GURL& url, const GURL& first_party_for_cookies) const override; - bool OnFirstPartyOnlyCookieExperimentEnabled() const override; + + virtual bool OnAreStrictSecureCookiesEnabled() const override; + virtual bool OnAreExperimentalCookieFeaturesEnabled() const override; bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( const net::URLRequest& request, const GURL& target_url, From 157f3abe64a7845f5ccba34435e77dbd4e7ebc29 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 22:02:42 -0800 Subject: [PATCH 05/21] Not quite sure how this ever worked --- .../browser/win/windows_toast_notification.cc | 28 +++++++++---------- .../browser/win/windows_toast_notification.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/brightray/browser/win/windows_toast_notification.cc b/brightray/browser/win/windows_toast_notification.cc index badd4f2254..74cd74eceb 100644 --- a/brightray/browser/win/windows_toast_notification.cc +++ b/brightray/browser/win/windows_toast_notification.cc @@ -173,10 +173,10 @@ bool WindowsToastNotification::GetToastXml( if (!SetXmlText(*toast_xml, title, msg)) return false; } - + // Configure the toast's notification sound if (silent) { - if (FAILED(SetXmlAudioSilent(*toast_xml))) + if (FAILED(SetXmlAudioSilent(*toast_xml))) return false; } @@ -200,40 +200,40 @@ bool WindowsToastNotification::SetXmlAudioSilent( ComPtr root; if (FAILED(node_list->Item(0, &root))) return false; - + ComPtr audio_element; ScopedHString audio_str(L"audio"); if (FAILED(doc->CreateElement(audio_str, &audio_element))) return false; - + ComPtr audio_node_tmp; if (FAILED(audio_element.As(&audio_node_tmp))) return false; - + // Append audio node to toast xml ComPtr audio_node; if (FAILED(root->AppendChild(audio_node_tmp.Get(), &audio_node))) return false; - + // Create silent attribute ComPtr attributes; if (FAILED(audio_node->get_Attributes(&attributes))) return false; - + ComPtr silent_attribute; ScopedHString silent_str(L"silent"); if (FAILED(doc->CreateAttribute(silent_str, &silent_attribute))) return false; - + ComPtr silent_attribute_node; if (FAILED(silent_attribute.As(&silent_attribute_node))) return false; - + // Set silent attribute to true ScopedHString silent_value(L"true"); if (!silent_value.success()) return false; - + ComPtr silent_text; if (FAILED(doc->CreateTextNode(silent_value, &silent_text))) return false; @@ -241,11 +241,11 @@ bool WindowsToastNotification::SetXmlAudioSilent( ComPtr silent_node; if (FAILED(silent_text.As(&silent_node))) return false; - + ComPtr child_node; if (FAILED(silent_attribute_node->AppendChild(silent_node.Get(), &child_node))) return false; - + ComPtr silent_attribute_pnode; return SUCCEEDED(attributes.Get()->SetNamedItem(silent_attribute_node.Get(), &silent_attribute_pnode)); } @@ -330,7 +330,7 @@ bool WindowsToastNotification::GetTextNodeList( ScopedHString* tag, IXmlDocument* doc, IXmlNodeList** node_list, - Uint32_t req_length) { + uint32_t req_length) { tag->Reset(L"text"); if (!tag->success()) return false; @@ -338,7 +338,7 @@ bool WindowsToastNotification::GetTextNodeList( if (FAILED(doc->GetElementsByTagName(*tag, node_list))) return false; - Uint32_t node_length; + uint32_t node_length; if (FAILED((*node_list)->get_Length(&node_length))) return false; diff --git a/brightray/browser/win/windows_toast_notification.h b/brightray/browser/win/windows_toast_notification.h index 6cd7bafe87..d5e5f2a82c 100644 --- a/brightray/browser/win/windows_toast_notification.h +++ b/brightray/browser/win/windows_toast_notification.h @@ -70,7 +70,7 @@ class WindowsToastNotification : public Notification { bool GetTextNodeList(ScopedHString* tag, ABI::Windows::Data::Xml::Dom::IXmlDocument* doc, ABI::Windows::Data::Xml::Dom::IXmlNodeList** nodeList, - Uint32_t reqLength); + uint32_t reqLength); bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc, ABI::Windows::Data::Xml::Dom::IXmlNode* node, const std::wstring& text); From 40c98381abbb6792f9ba0986127b4ece603968e8 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 22:18:16 -0800 Subject: [PATCH 06/21] Update headers for InspectableWebContentsImpl --- brightray/browser/inspectable_web_contents_impl.cc | 7 ++++--- brightray/browser/inspectable_web_contents_impl.h | 13 ++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index b876ef8628..76972b654e 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -573,7 +573,7 @@ void InspectableWebContentsImpl::AgentHostClosed( content::DevToolsAgentHost* agent_host, bool replaced) { } -void InspectableWebContentsImpl::AboutToNavigateRenderFrame( +void InspectableWebContentsImpl::RenderFrameHostChanged( content::RenderFrameHost* old_host, content::RenderFrameHost* new_host) { if (new_host->GetParent()) @@ -603,8 +603,9 @@ bool InspectableWebContentsImpl::AddMessageToConsole( bool InspectableWebContentsImpl::ShouldCreateWebContents( content::WebContents* web_contents, - int route_id, - int main_frame_route_id, + int32_t route_id, + int32_t main_frame_route_id, + int32_t main_frame_widget_route_id, WindowContainerType window_container_type, const std::string& frame_name, const GURL& target_url, diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 8543f5e99e..7edf9ce96e 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -33,7 +33,6 @@ class InspectableWebContentsView; class InspectableWebContentsImpl : public InspectableWebContents, - public content::DevToolsFrontendHost::Delegate, public content::DevToolsAgentHostClient, public content::WebContentsObserver, public content::WebContentsDelegate, @@ -117,8 +116,7 @@ class InspectableWebContentsImpl : void ClearPreferences() override; // content::DevToolsFrontendHostDelegate: - void HandleMessageFromDevToolsFrontend(const std::string& message) override; - void HandleMessageFromDevToolsFrontendToBackend(const std::string& message) override; + void HandleMessageFromDevToolsFrontend(const std::string& message); // content::DevToolsAgentHostClient: void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host, @@ -127,8 +125,8 @@ class InspectableWebContentsImpl : bool replaced) override; // content::WebContentsObserver: - void AboutToNavigateRenderFrame(content::RenderFrameHost* old_host, - content::RenderFrameHost* new_host) override; + void RenderFrameHostChanged(content::RenderFrameHost* old_host, + content::RenderFrameHost* new_host) override; void WebContentsDestroyed() override; void OnWebContentsFocused() override; @@ -140,8 +138,9 @@ class InspectableWebContentsImpl : const base::string16& source_id) override; bool ShouldCreateWebContents( content::WebContents* web_contents, - int route_id, - int main_frame_route_id, + int32_t route_id, + int32_t main_frame_route_id, + int32_t main_frame_widget_route_id, WindowContainerType window_container_type, const std::string& frame_name, const GURL& target_url, From d204febecfc1546b49e343eecb2b6161117a6ccf Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 22:29:23 -0800 Subject: [PATCH 07/21] Update DevtoolsNetworkTransaction --- brightray/browser/net/devtools_network_transaction.cc | 8 +++++++- brightray/browser/net/devtools_network_transaction.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/brightray/browser/net/devtools_network_transaction.cc b/brightray/browser/net/devtools_network_transaction.cc index fa3343ef98..c65230d6f5 100644 --- a/brightray/browser/net/devtools_network_transaction.cc +++ b/brightray/browser/net/devtools_network_transaction.cc @@ -106,10 +106,11 @@ int DevToolsNetworkTransaction::RestartIgnoringLastError( int DevToolsNetworkTransaction::RestartWithCertificate( net::X509Certificate* client_certificate, + net::SSLPrivateKey* client_private_key, const net::CompletionCallback& callback) { if (failed_) return net::ERR_INTERNET_DISCONNECTED; - int rv = transaction_->RestartWithCertificate(client_certificate, proxy_callback_); + int rv = transaction_->RestartWithCertificate(client_certificate, client_private_key, proxy_callback_); return SetupCallback(callback, rv, RESTART_WITH_CERTIFICATE); } @@ -185,6 +186,11 @@ bool DevToolsNetworkTransaction::GetRemoteEndpoint( return transaction_->GetRemoteEndpoint(endpoint); } +void DevToolsNetworkTransaction::PopulateNetErrorDetails( + net::NetErrorDetails* details) const { + return transaction_->PopulateNetErrorDetails(details); +} + void DevToolsNetworkTransaction::SetPriority(net::RequestPriority priority) { transaction_->SetPriority(priority); } diff --git a/brightray/browser/net/devtools_network_transaction.h b/brightray/browser/net/devtools_network_transaction.h index 3e16db0f2c..f8e54e6777 100644 --- a/brightray/browser/net/devtools_network_transaction.h +++ b/brightray/browser/net/devtools_network_transaction.h @@ -46,6 +46,7 @@ class DevToolsNetworkTransaction : public net::HttpTransaction { int RestartIgnoringLastError( const net::CompletionCallback& callback) override; int RestartWithCertificate(net::X509Certificate* client_cert, + net::SSLPrivateKey* client_private_key, const net::CompletionCallback& callback) override; int RestartWithAuth(const net::AuthCredentials& credentials, const net::CompletionCallback& callback) override; @@ -65,6 +66,7 @@ class DevToolsNetworkTransaction : public net::HttpTransaction { void SetQuicServerInfo(net::QuicServerInfo* quic_server_info) override; bool GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override; bool GetRemoteEndpoint(net::IPEndPoint* endpoint) const override; + void PopulateNetErrorDetails(net::NetErrorDetails* details) const override; void SetPriority(net::RequestPriority priority) override; void SetWebSocketHandshakeStreamCreateHelper( net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; From 18a75b5124a0d6eb26aa9c54691be771fdb9c6dc Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 22:38:48 -0800 Subject: [PATCH 08/21] Renamed enum in MediaStreamDeviceRequest --- brightray/browser/devtools_manager_delegate.cc | 2 +- brightray/browser/media/media_stream_devices_controller.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/brightray/browser/devtools_manager_delegate.cc b/brightray/browser/devtools_manager_delegate.cc index ca8f1cf2d8..cf266f0181 100644 --- a/brightray/browser/devtools_manager_delegate.cc +++ b/brightray/browser/devtools_manager_delegate.cc @@ -55,7 +55,7 @@ class TCPServerSocketFactory } std::string address_; - uint16 port_; + uint16_t port_; DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); }; diff --git a/brightray/browser/media/media_stream_devices_controller.cc b/brightray/browser/media/media_stream_devices_controller.cc index 3d4f4cc332..1a205f1ed7 100644 --- a/brightray/browser/media/media_stream_devices_controller.cc +++ b/brightray/browser/media/media_stream_devices_controller.cc @@ -33,10 +33,10 @@ MediaStreamDevicesController::MediaStreamDevicesController( // and microphone to avoid popping two infobars. microphone_requested_( request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE || - request.request_type == content::MEDIA_OPEN_DEVICE), + request.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY), webcam_requested_( request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE || - request.request_type == content::MEDIA_OPEN_DEVICE) { + request.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY) { } MediaStreamDevicesController::~MediaStreamDevicesController() { @@ -72,7 +72,7 @@ void MediaStreamDevicesController::Accept() { content::MediaStreamDevices devices; if (microphone_requested_ || webcam_requested_) { switch (request_.request_type) { - case content::MEDIA_OPEN_DEVICE: { + case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY: { const content::MediaStreamDevice* device = NULL; // For open device request pick the desired device or fall back to the // first available of the given type. From 6517dffa04f3f9c052762774fa6113b986654572 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 22:58:25 -0800 Subject: [PATCH 09/21] Start to update UrlRequestContextGetter --- brightray/browser/url_request_context_getter.cc | 10 +++++++++- brightray/browser/url_request_context_getter.h | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 5c0d7828a9..d585b1d12b 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -104,8 +104,16 @@ bool URLRequestContextGetter::DelegateURLSecurityManager::CanDelegate return delegate_->CanDelegateURLSecurity(auth_origin); } +void URLRequestContextGetter::DelegateURLSecurityManager::SetDefaultWhitelist( + scoped_ptr whitelist_default) { +} + +void URLRequestContextGetter::DelegateURLSecurityManager::SetDelegateWhitelist( + scoped_ptr whitelist_delegate) { +} + URLRequestContextGetter::Delegate::Delegate() : - orig_url_sec_mgr_(net::URLSecurityManager::Create(NULL, NULL)) {} + orig_url_sec_mgr_(net::URLSecurityManager::Create()) {} std::string URLRequestContextGetter::Delegate::GetUserAgent() { return base::EmptyString(); diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index cf647cf7b5..cb9af8c6f7 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -59,6 +59,10 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { bool CanUseDefaultCredentials(const GURL& auth_origin) const override; bool CanDelegate(const GURL& auth_origin) const override; + void SetDefaultWhitelist( + scoped_ptr whitelist_default) override; + void SetDelegateWhitelist( + scoped_ptr whitelist_delegate) override; private: URLRequestContextGetter::Delegate* delegate_; From dba668057816743533891019e35b0966f06ef552 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 7 Mar 2016 23:09:25 -0800 Subject: [PATCH 10/21] Everyone gets permission --- brightray/browser/permission_manager.cc | 21 +++++++++++++++++++++ brightray/browser/permission_manager.h | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/brightray/browser/permission_manager.cc b/brightray/browser/permission_manager.cc index c5d1ac9a9c..eff85ddc12 100644 --- a/brightray/browser/permission_manager.cc +++ b/brightray/browser/permission_manager.cc @@ -32,6 +32,27 @@ int PermissionManager::RequestPermission( return kNoPendingOperation; } +int PermissionManager::RequestPermissions( + const std::vector& permissions, + content::RenderFrameHost* render_frame_host, + const GURL& requesting_origin, + bool user_gesture, + const base::Callback&)>& callback) { + std::vector permissionStatuses; + + for (auto permission : permissions) { + if (permission == content::PermissionType::MIDI_SYSEX) { + content::ChildProcessSecurityPolicy::GetInstance()-> + GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID()); + } + + permissionStatuses.push_back(content::PERMISSION_STATUS_GRANTED); + } + + callback.Run(permissionStatuses); + return kNoPendingOperation; +} void PermissionManager::CancelPermissionRequest(int request_id) { } diff --git a/brightray/browser/permission_manager.h b/brightray/browser/permission_manager.h index 778605c51e..f3ed51d3c1 100644 --- a/brightray/browser/permission_manager.h +++ b/brightray/browser/permission_manager.h @@ -23,6 +23,13 @@ class PermissionManager : public content::PermissionManager { const GURL& requesting_origin, bool user_gesture, const base::Callback& callback) override; + int RequestPermissions( + const std::vector& permissions, + content::RenderFrameHost* render_frame_host, + const GURL& requesting_origin, + bool user_gesture, + const base::Callback&)>& callback) override; void CancelPermissionRequest(int request_id) override; void ResetPermission(content::PermissionType permission, const GURL& requesting_origin, From 948e7c4055ec03452b0ea6d29044ec8395186287 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 8 Mar 2016 17:51:16 +0900 Subject: [PATCH 11/21] virutal should not be used together with override --- brightray/browser/network_delegate.h | 5 ++--- brightray/browser/permission_manager.cc | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/brightray/browser/network_delegate.h b/brightray/browser/network_delegate.h index 1135875400..a561fc0590 100644 --- a/brightray/browser/network_delegate.h +++ b/brightray/browser/network_delegate.h @@ -66,9 +66,8 @@ class NetworkDelegate : public net::NetworkDelegate { bool OnCanEnablePrivacyMode( const GURL& url, const GURL& first_party_for_cookies) const override; - - virtual bool OnAreStrictSecureCookiesEnabled() const override; - virtual bool OnAreExperimentalCookieFeaturesEnabled() const override; + bool OnAreStrictSecureCookiesEnabled() const override; + bool OnAreExperimentalCookieFeaturesEnabled() const override; bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( const net::URLRequest& request, const GURL& target_url, diff --git a/brightray/browser/permission_manager.cc b/brightray/browser/permission_manager.cc index eff85ddc12..4492e749c8 100644 --- a/brightray/browser/permission_manager.cc +++ b/brightray/browser/permission_manager.cc @@ -53,6 +53,7 @@ int PermissionManager::RequestPermissions( callback.Run(permissionStatuses); return kNoPendingOperation; } + void PermissionManager::CancelPermissionRequest(int request_id) { } From baf5f384cd48d70382127c7e5ece0ace5c872f02 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 8 Mar 2016 20:59:29 +0900 Subject: [PATCH 12/21] Pass() is deprecated for std::move --- brightray/browser/browser_client.cc | 2 +- brightray/browser/browser_context.cc | 2 +- brightray/browser/mac/cocoa_notification.mm | 4 +- .../net/devtools_network_controller.cc | 10 ++-- .../net/devtools_network_interceptor.cc | 2 +- .../net/devtools_network_protocol_handler.cc | 10 ++-- .../net/devtools_network_transaction.cc | 2 +- .../devtools_network_transaction_factory.cc | 3 +- brightray/browser/net_log.cc | 2 +- .../browser/notification_delegate_adapter.cc | 2 +- .../browser/platform_notification_service.cc | 2 +- .../browser/url_request_context_getter.cc | 47 ++++++++++--------- .../browser/url_request_context_getter.h | 4 +- brightray/common/main_delegate.cc | 8 ++-- 14 files changed, 52 insertions(+), 48 deletions(-) diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index 465cbce439..88c41957ae 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -75,7 +75,7 @@ net::URLRequestContextGetter* BrowserClient::CreateRequestContext( auto context = static_cast(browser_context); return context->CreateRequestContext(static_cast(GetNetLog()), protocol_handlers, - protocol_interceptors.Pass()); + std::move(protocol_interceptors)); } content::MediaObserver* BrowserClient::GetMediaObserver() { diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 67ad5c8d54..e082b4ac5c 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -148,7 +148,7 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext( BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE), protocol_handlers, - protocol_interceptors.Pass()); + std::move(protocol_interceptors)); resource_context_->set_url_request_context_getter(url_request_getter_.get()); return url_request_getter_.get(); } diff --git a/brightray/browser/mac/cocoa_notification.mm b/brightray/browser/mac/cocoa_notification.mm index 68f22d3363..fefae39788 100644 --- a/brightray/browser/mac/cocoa_notification.mm +++ b/brightray/browser/mac/cocoa_notification.mm @@ -39,11 +39,11 @@ void CocoaNotification::Show(const base::string16& title, if ([notification_ respondsToSelector:@selector(setContentImage:)] && !icon.drawsNothing()) { - NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( + NSImage* image = skia::SkBitmapToNSImageWithColorSpace( icon, base::mac::GetGenericRGBColorSpace()); [notification_ setContentImage:image]; } - + if (silent) { [notification_ setSoundName:nil]; } else { diff --git a/brightray/browser/net/devtools_network_controller.cc b/brightray/browser/net/devtools_network_controller.cc index 42ebf06471..71eae70af3 100644 --- a/brightray/browser/net/devtools_network_controller.cc +++ b/brightray/browser/net/devtools_network_controller.cc @@ -30,7 +30,7 @@ void DevToolsNetworkController::SetNetworkState( if (client_id.empty()) { if (!conditions) return; - default_interceptor_->UpdateConditions(conditions.Pass()); + default_interceptor_->UpdateConditions(std::move(conditions)); return; } @@ -40,16 +40,16 @@ void DevToolsNetworkController::SetNetworkState( return; scoped_ptr new_interceptor( new DevToolsNetworkInterceptor); - new_interceptor->UpdateConditions(conditions.Pass()); - interceptors_.set(client_id, new_interceptor.Pass()); + new_interceptor->UpdateConditions(std::move(conditions)); + interceptors_.set(client_id, std::move(new_interceptor)); } else { if (!conditions) { scoped_ptr online_conditions( new DevToolsNetworkConditions(false)); - interceptor->UpdateConditions(online_conditions.Pass()); + interceptor->UpdateConditions(std::move(online_conditions)); interceptors_.erase(client_id); } else { - interceptor->UpdateConditions(conditions.Pass()); + interceptor->UpdateConditions(std::move(conditions)); } } } diff --git a/brightray/browser/net/devtools_network_interceptor.cc b/brightray/browser/net/devtools_network_interceptor.cc index 2535ed74bd..ed89fc1b54 100644 --- a/brightray/browser/net/devtools_network_interceptor.cc +++ b/brightray/browser/net/devtools_network_interceptor.cc @@ -40,7 +40,7 @@ void DevToolsNetworkInterceptor::UpdateConditions( if (conditions_->IsThrottling()) UpdateThrottledTransactions(now); - conditions_ = conditions.Pass(); + conditions_ = std::move(conditions); if (conditions_->offline()) { timer_.Stop(); diff --git a/brightray/browser/net/devtools_network_protocol_handler.cc b/brightray/browser/net/devtools_network_protocol_handler.cc index b94a041328..b06678fe92 100644 --- a/brightray/browser/net/devtools_network_protocol_handler.cc +++ b/brightray/browser/net/devtools_network_protocol_handler.cc @@ -64,7 +64,7 @@ CreateSuccessResponse(int id, scoped_ptr result) { scoped_ptr response(new base::DictionaryValue); response->SetInteger(kId, id); response->Set(params::kResult, result.release()); - return response.Pass(); + return response; } scoped_ptr @@ -75,14 +75,14 @@ CreateFailureResponse(int id, const std::string& param) { error_object->SetInteger(params::kErrorCode, kErrorInvalidParams); error_object->SetString(params::kErrorMessage, base::StringPrintf("Missing or Invalid '%s' parameter", param.c_str())); - return response.Pass(); + return response; } void UpdateNetworkStateInIO(brightray::DevToolsNetworkController* controller, const std::string& client_id, scoped_ptr conditions) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - controller->SetNetworkState(client_id, conditions.Pass()); + controller->SetNetworkState(client_id, std::move(conditions)); } } // namespace @@ -119,7 +119,7 @@ DevToolsNetworkProtocolHandler::CanEmulateNetworkConditions( const base::DictionaryValue* params) { scoped_ptr result(new base::DictionaryValue); result->SetBoolean(params::kResult, true); - return CreateSuccessResponse(id, result.Pass()); + return CreateSuccessResponse(id, std::move(result)); } scoped_ptr @@ -154,7 +154,7 @@ DevToolsNetworkProtocolHandler::EmulateNetworkConditions( latency, download_throughput, upload_throughput)); - UpdateNetworkState(agent_host, conditions.Pass()); + UpdateNetworkState(agent_host, std::move(conditions)); return scoped_ptr(); } diff --git a/brightray/browser/net/devtools_network_transaction.cc b/brightray/browser/net/devtools_network_transaction.cc index c65230d6f5..f0d66a047b 100644 --- a/brightray/browser/net/devtools_network_transaction.cc +++ b/brightray/browser/net/devtools_network_transaction.cc @@ -24,7 +24,7 @@ DevToolsNetworkTransaction::DevToolsNetworkTransaction( DevToolsNetworkController* controller, scoped_ptr transaction) : controller_(controller), - transaction_(transaction.Pass()), + transaction_(std::move(transaction)), request_(nullptr), failed_(false), throttled_byte_count_(0), diff --git a/brightray/browser/net/devtools_network_transaction_factory.cc b/brightray/browser/net/devtools_network_transaction_factory.cc index d1676a34d5..d3fb4cfb08 100644 --- a/brightray/browser/net/devtools_network_transaction_factory.cc +++ b/brightray/browser/net/devtools_network_transaction_factory.cc @@ -35,7 +35,8 @@ int DevToolsNetworkTransactionFactory::CreateTransaction( int rv = network_layer_->CreateTransaction(priority, &new_transaction); if (rv != net::OK) return rv; - transaction->reset(new DevToolsNetworkTransaction(controller_, new_transaction.Pass())); + transaction->reset( + new DevToolsNetworkTransaction(controller_, std::move(new_transaction))); return net::OK; } diff --git a/brightray/browser/net_log.cc b/brightray/browser/net_log.cc index 7d781a22e7..b0b06483f9 100644 --- a/brightray/browser/net_log.cc +++ b/brightray/browser/net_log.cc @@ -55,7 +55,7 @@ void NetLog::StartLogging(net::URLRequestContext* url_request_context) { scoped_ptr constants(GetConstants()); write_to_file_observer_.StartObserving(this, - log_file_.Pass(), + std::move(log_file_), constants.get(), url_request_context); } diff --git a/brightray/browser/notification_delegate_adapter.cc b/brightray/browser/notification_delegate_adapter.cc index da9a70aab3..1a4853723b 100644 --- a/brightray/browser/notification_delegate_adapter.cc +++ b/brightray/browser/notification_delegate_adapter.cc @@ -8,7 +8,7 @@ namespace brightray { NotificationDelegateAdapter::NotificationDelegateAdapter( scoped_ptr delegate) - : delegate_(delegate.Pass()) { + : delegate_(std::move(delegate)) { } NotificationDelegateAdapter::~NotificationDelegateAdapter() { diff --git a/brightray/browser/platform_notification_service.cc b/brightray/browser/platform_notification_service.cc index 5ce6676250..7971f28100 100644 --- a/brightray/browser/platform_notification_service.cc +++ b/brightray/browser/platform_notification_service.cc @@ -33,7 +33,7 @@ void OnWebNotificationAllowed( if (!presenter) return; scoped_ptr adapter( - new NotificationDelegateAdapter(delegate.Pass())); + new NotificationDelegateAdapter(std::move(delegate))); auto notification = presenter->CreateNotification(adapter.get()); if (notification) { ignore_result(adapter.release()); // it will release itself automatically. diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index d585b1d12b..1779170136 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -23,6 +23,7 @@ #include "net/cookies/cookie_monster.h" #include "net/dns/mapped_host_resolver.h" #include "net/http/http_auth_handler_factory.h" +#include "net/http/http_auth_preferences.h" #include "net/http/http_server_properties_impl.h" #include "net/log/net_log.h" #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" @@ -139,14 +140,14 @@ URLRequestContextGetter::Delegate::CreateURLRequestJobFactory( base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))); // Set up interceptors in the reverse order. - scoped_ptr top_job_factory = job_factory.Pass(); + scoped_ptr top_job_factory = std::move(job_factory); content::URLRequestInterceptorScopedVector::reverse_iterator i; for (i = protocol_interceptors->rbegin(); i != protocol_interceptors->rend(); ++i) top_job_factory.reset(new net::URLRequestInterceptingJobFactory( - top_job_factory.Pass(), make_scoped_ptr(*i))); + std::move(top_job_factory), make_scoped_ptr(*i))); protocol_interceptors->weak_clear(); - return top_job_factory.Pass(); + return top_job_factory; } net::HttpCache::BackendFactory* @@ -195,8 +196,7 @@ URLRequestContextGetter::URLRequestContextGetter( in_memory_(in_memory), io_loop_(io_loop), file_loop_(file_loop), - url_sec_mgr_(new URLRequestContextGetter::DelegateURLSecurityManager(delegate)), - protocol_interceptors_(protocol_interceptors.Pass()) { + protocol_interceptors_(std::move(protocol_interceptors)) { // Must first be created on the UI thread. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -265,10 +265,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { // --host-resolver-rules if (command_line.HasSwitch(switches::kHostResolverRules)) { scoped_ptr remapped_resolver( - new net::MappedHostResolver(host_resolver.Pass())); + new net::MappedHostResolver(std::move(host_resolver))); remapped_resolver->SetRulesFromString( command_line.GetSwitchValueASCII(switches::kHostResolverRules)); - host_resolver = remapped_resolver.Pass(); + host_resolver = std::move(remapped_resolver); } // --proxy-server @@ -291,7 +291,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { } else { storage_->set_proxy_service( net::CreateProxyServiceUsingV8ProxyResolver( - proxy_config_service_.Pass(), + std::move(proxy_config_service_), new net::ProxyScriptFetcherImpl(url_request_context_.get()), dhcp_factory.Create(url_request_context_.get()), host_resolver.get(), @@ -304,16 +304,15 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { schemes.push_back(std::string("digest")); schemes.push_back(std::string("ntlm")); schemes.push_back(std::string("negotiate")); - +#if defined(OS_POSIX) + http_auth_preferences_.reset(new net::HttpAuthPreferences(schemes, + std::string())); +#else + http_auth_preferences_.reset(new net::HttpAuthPreferences(schemes)); +#endif auto auth_handler_factory = make_scoped_ptr( net::HttpAuthHandlerRegistryFactory::Create( - schemes, - url_sec_mgr_.get(), - host_resolver.get(), - std::string(), // gssapi_library_name - std::string(), // gssapi_library_nam - false, // auth_android_negotiate_account_type - true)); // negotiate_enable_port + http_auth_preferences_.get(), host_resolver.get())); storage_->set_cert_verifier(delegate_->CreateCertVerifier()); storage_->set_transport_security_state( @@ -322,7 +321,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { storage_->set_http_auth_handler_factory(auth_handler_factory.Pass()); scoped_ptr server_properties( new net::HttpServerPropertiesImpl); - storage_->set_http_server_properties(server_properties.Pass()); + storage_->set_http_server_properties(std::move(server_properties)); net::HttpNetworkSession::Params network_session_params; network_session_params.cert_verifier = url_request_context_->cert_verifier(); @@ -355,21 +354,23 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { } // Give |storage_| ownership at the end in case it's |mapped_host_resolver|. - storage_->set_host_resolver(host_resolver.Pass()); + storage_->set_host_resolver(std::move(host_resolver)); network_session_params.host_resolver = url_request_context_->host_resolver(); - net::HttpNetworkSession* session = new net::HttpNetworkSession(network_session_params); - net::HttpCache::BackendFactory* backend = nullptr; + http_network_session_.reset( + new net::HttpNetworkSession(network_session_params)); + scoped_ptr backend; if (in_memory_) { backend = net::HttpCache::DefaultBackend::InMemory(0); } else { - backend = delegate_->CreateHttpCacheBackendFactory(base_path_); + backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_)); } storage_->set_http_transaction_factory(make_scoped_ptr( new net::HttpCache( - new DevToolsNetworkTransactionFactory(controller_, session), + new DevToolsNetworkTransactionFactory(controller_, + http_network_session_.get()), url_request_context_->net_log(), - backend))); + std::move(backend)))); storage_->set_job_factory(delegate_->CreateURLRequestJobFactory( &protocol_handlers_, &protocol_interceptors_)); diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index cb9af8c6f7..aaf9855d2a 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -19,6 +19,7 @@ class MessageLoop; namespace net { class HostMappingRules; class HostResolver; +class HttpAuthPreferences; class NetworkDelegate; class ProxyConfigService; class URLRequestContextStorage; @@ -103,7 +104,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { scoped_ptr storage_; scoped_ptr url_request_context_; scoped_ptr host_mapping_rules_; - scoped_ptr url_sec_mgr_; + scoped_ptr http_auth_preferences_; + scoped_ptr http_network_session_; content::ProtocolHandlerMap protocol_handlers_; content::URLRequestInterceptorScopedVector protocol_interceptors_; diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index 74ec88791b..6516111aed 100644 --- a/brightray/common/main_delegate.cc +++ b/brightray/common/main_delegate.cc @@ -81,11 +81,11 @@ MainDelegate::~MainDelegate() { } scoped_ptr MainDelegate::CreateContentClient() { - return make_scoped_ptr(new ContentClient).Pass(); + return make_scoped_ptr(new ContentClient); } bool MainDelegate::BasicStartupComplete(int* exit_code) { - content_client_ = CreateContentClient().Pass(); + content_client_ = CreateContentClient(); SetContentClient(content_client_.get()); #if defined(OS_MACOSX) OverrideChildProcessPath(); @@ -108,12 +108,12 @@ void MainDelegate::PreSandboxStartup() { } content::ContentBrowserClient* MainDelegate::CreateContentBrowserClient() { - browser_client_ = CreateBrowserClient().Pass(); + browser_client_ = CreateBrowserClient(); return browser_client_.get(); } scoped_ptr MainDelegate::CreateBrowserClient() { - return make_scoped_ptr(new BrowserClient).Pass(); + return make_scoped_ptr(new BrowserClient); } } // namespace brightray From d3a39540b5a67a70a80aa930a2aff033266f4602 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 8 Mar 2016 23:28:28 +0900 Subject: [PATCH 13/21] Fix compilation errors on OS X --- brightray/browser/browser_context.cc | 4 ++++ brightray/browser/browser_context.h | 1 + .../devtools_embedder_message_dispatcher.cc | 5 +++-- .../devtools_embedder_message_dispatcher.h | 3 ++- .../browser/inspectable_web_contents_impl.cc | 19 ++++++++++--------- .../browser/inspectable_web_contents_impl.h | 3 ++- brightray/browser/network_delegate.cc | 4 ++-- .../browser/url_request_context_getter.cc | 14 +++++++------- 8 files changed, 31 insertions(+), 22 deletions(-) diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index e082b4ac5c..6181f8ec63 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -232,4 +232,8 @@ content::PermissionManager* BrowserContext::GetPermissionManager() { return permission_manager_.get(); } +content::BackgroundSyncController* BrowserContext::GetBackgroundSyncController() { + return nullptr; +} + } // namespace brightray diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index 3c9b68d883..9866732cbc 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -57,6 +57,7 @@ class BrowserContext : public base::RefCounted, content::PushMessagingService* GetPushMessagingService() override; content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; content::PermissionManager* GetPermissionManager() override; + content::BackgroundSyncController* GetBackgroundSyncController() override; net::URLRequestContextGetter* CreateRequestContext( NetLog* net_log, diff --git a/brightray/browser/devtools_embedder_message_dispatcher.cc b/brightray/browser/devtools_embedder_message_dispatcher.cc index 2a4b381765..f45d90d753 100644 --- a/brightray/browser/devtools_embedder_message_dispatcher.cc +++ b/brightray/browser/devtools_embedder_message_dispatcher.cc @@ -190,8 +190,9 @@ DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend( d->RegisterHandler("resetZoom", &Delegate::ResetZoom, delegate); d->RegisterHandler("setDevicesUpdatesEnabled", &Delegate::SetDevicesUpdatesEnabled, delegate); - d->RegisterHandler("sendMessageToBrowser", - &Delegate::SendMessageToBrowser, delegate); + d->RegisterHandler("dispatchProtocolMessage", + &Delegate::DispatchProtocolMessageFromDevToolsFrontend, + delegate); d->RegisterHandler("recordActionUMA", &Delegate::RecordActionUMA, delegate); d->RegisterHandlerWithCallback("sendJsonRequest", &Delegate::SendJsonRequest, delegate); diff --git a/brightray/browser/devtools_embedder_message_dispatcher.h b/brightray/browser/devtools_embedder_message_dispatcher.h index 46f54dfbf2..eb3dc38978 100644 --- a/brightray/browser/devtools_embedder_message_dispatcher.h +++ b/brightray/browser/devtools_embedder_message_dispatcher.h @@ -68,7 +68,8 @@ class DevToolsEmbedderMessageDispatcher { virtual void ZoomOut() = 0; virtual void ResetZoom() = 0; virtual void SetDevicesUpdatesEnabled(bool enabled) = 0; - virtual void SendMessageToBrowser(const std::string& message) = 0; + virtual void DispatchProtocolMessageFromDevToolsFrontend( + const std::string& message) = 0; virtual void RecordActionUMA(const std::string& name, int action) = 0; virtual void SendJsonRequest(const DispatchCallback& callback, const std::string& browser_id, diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 76972b654e..5afff01ff6 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -26,6 +26,7 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/common/user_agent.h" +#include "ipc/ipc_channel.h" #include "net/http/http_response_headers.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_fetcher_response_writer.h" @@ -251,7 +252,9 @@ void InspectableWebContentsImpl::ShowDevTools() { agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get()); frontend_host_.reset(content::DevToolsFrontendHost::Create( - web_contents_->GetMainFrame(), this)); + web_contents_->GetMainFrame(), + base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, + base::Unretained(this)))); agent_host_->AttachClient(this); GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, @@ -477,7 +480,8 @@ void InspectableWebContentsImpl::ResetZoom() { void InspectableWebContentsImpl::SetDevicesUpdatesEnabled(bool enabled) { } -void InspectableWebContentsImpl::SendMessageToBrowser(const std::string& message) { +void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend( + const std::string& message) { if (agent_host_.get()) agent_host_->DispatchProtocolMessage(message); } @@ -543,12 +547,6 @@ void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::st params); } -void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontendToBackend( - const std::string& message) { - if (agent_host_.get()) - agent_host_->DispatchProtocolMessage(message); -} - void InspectableWebContentsImpl::DispatchProtocolMessage( content::DevToolsAgentHost* agent_host, const std::string& message) { if (!frontend_loaded_) @@ -578,7 +576,10 @@ void InspectableWebContentsImpl::RenderFrameHostChanged( content::RenderFrameHost* new_host) { if (new_host->GetParent()) return; - frontend_host_.reset(content::DevToolsFrontendHost::Create(new_host, this)); + frontend_host_.reset(content::DevToolsFrontendHost::Create( + web_contents_->GetMainFrame(), + base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, + base::Unretained(this)))); } void InspectableWebContentsImpl::WebContentsDestroyed() { diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 7edf9ce96e..e4a964adf0 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -104,7 +104,8 @@ class InspectableWebContentsImpl : void ZoomOut() override; void ResetZoom() override; void SetDevicesUpdatesEnabled(bool enabled) override; - void SendMessageToBrowser(const std::string& message) override; + void DispatchProtocolMessageFromDevToolsFrontend( + const std::string& message) override; void RecordActionUMA(const std::string& name, int action) override; void SendJsonRequest(const DispatchCallback& callback, const std::string& browser_id, diff --git a/brightray/browser/network_delegate.cc b/brightray/browser/network_delegate.cc index e03adba65a..a179560556 100644 --- a/brightray/browser/network_delegate.cc +++ b/brightray/browser/network_delegate.cc @@ -140,11 +140,11 @@ bool NetworkDelegate::OnCanEnablePrivacyMode( return false; } -bool OnAreStrictSecureCookiesEnabled() { +bool NetworkDelegate::OnAreStrictSecureCookiesEnabled() const { return true; } -bool OnAreExperimentalCookieFeaturesEnabled() { +bool NetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { return true; } diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 1779170136..6e516edef5 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -310,15 +310,15 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { #else http_auth_preferences_.reset(new net::HttpAuthPreferences(schemes)); #endif - auto auth_handler_factory = make_scoped_ptr( + auto auth_handler_factory = net::HttpAuthHandlerRegistryFactory::Create( - http_auth_preferences_.get(), host_resolver.get())); + http_auth_preferences_.get(), host_resolver.get()); storage_->set_cert_verifier(delegate_->CreateCertVerifier()); storage_->set_transport_security_state( make_scoped_ptr(new net::TransportSecurityState)); storage_->set_ssl_config_service(delegate_->CreateSSLConfigService()); - storage_->set_http_auth_handler_factory(auth_handler_factory.Pass()); + storage_->set_http_auth_handler_factory(std::move(auth_handler_factory)); scoped_ptr server_properties( new net::HttpServerPropertiesImpl); storage_->set_http_server_properties(std::move(server_properties)); @@ -367,10 +367,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { } storage_->set_http_transaction_factory(make_scoped_ptr( new net::HttpCache( - new DevToolsNetworkTransactionFactory(controller_, - http_network_session_.get()), - url_request_context_->net_log(), - std::move(backend)))); + make_scoped_ptr(new DevToolsNetworkTransactionFactory( + controller_, http_network_session_.get())), + std::move(backend), + false))); storage_->set_job_factory(delegate_->CreateURLRequestJobFactory( &protocol_handlers_, &protocol_interceptors_)); From ead0bb0cfc1ce7c2a10c598840408c65e41e3045 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 9 Mar 2016 14:55:46 +0900 Subject: [PATCH 14/21] Fix devtools not working --- brightray/browser/devtools_manager_delegate.cc | 1 - brightray/browser/inspectable_web_contents_impl.cc | 14 ++++++++++---- brightray/browser/inspectable_web_contents_impl.h | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/brightray/browser/devtools_manager_delegate.cc b/brightray/browser/devtools_manager_delegate.cc index cf266f0181..155f35728d 100644 --- a/brightray/browser/devtools_manager_delegate.cc +++ b/brightray/browser/devtools_manager_delegate.cc @@ -109,7 +109,6 @@ DevToolsDelegate::~DevToolsDelegate() { } std::string DevToolsDelegate::GetDiscoveryPageHTML() { - LOG(WARNING) << IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE; return ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); } diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 5afff01ff6..4065053b1a 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -251,10 +251,6 @@ void InspectableWebContentsImpl::ShowDevTools() { devtools_web_contents_->SetDelegate(this); agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get()); - frontend_host_.reset(content::DevToolsFrontendHost::Create( - web_contents_->GetMainFrame(), - base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, - base::Unretained(this)))); agent_host_->AttachClient(this); GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, @@ -634,6 +630,16 @@ void InspectableWebContentsImpl::OnWebContentsFocused() { #endif } +void InspectableWebContentsImpl::DidStartNavigationToPendingEntry( + const GURL& url, + content::NavigationController::ReloadType reload_type) { + frontend_host_.reset( + content::DevToolsFrontendHost::Create( + web_contents()->GetMainFrame(), + base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, + base::Unretained(this)))); +} + void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) { DCHECK(source); PendingRequestsMap::iterator it = pending_requests_.find(source); diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index e4a964adf0..1e2bab8a26 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -130,6 +130,9 @@ class InspectableWebContentsImpl : content::RenderFrameHost* new_host) override; void WebContentsDestroyed() override; void OnWebContentsFocused() override; + void DidStartNavigationToPendingEntry( + const GURL& url, + content::NavigationController::ReloadType reload_type) override; // content::WebContentsDelegate: bool AddMessageToConsole(content::WebContents* source, From 82c30ef9b992179db1a4655afab74b274a4ff7c3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 9 Mar 2016 18:47:11 +0900 Subject: [PATCH 15/21] Fix RenderFrameHostChanged --- brightray/browser/inspectable_web_contents_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 4065053b1a..8217812b58 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -573,7 +573,7 @@ void InspectableWebContentsImpl::RenderFrameHostChanged( if (new_host->GetParent()) return; frontend_host_.reset(content::DevToolsFrontendHost::Create( - web_contents_->GetMainFrame(), + new_host, base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, base::Unretained(this)))); } From f70ece16696c955523ba61a23e3f1d8026620e46 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 9 Mar 2016 22:24:25 +0900 Subject: [PATCH 16/21] No more libyuv_neon --- brightray/brightray.gyp | 3 --- 1 file changed, 3 deletions(-) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index d7120ea98f..85af875c48 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -117,9 +117,6 @@ }], ['target_arch=="arm"', { 'link_settings': { - 'libraries': [ - '<(libchromiumcontent_dir)/libyuv_neon.a', - ], 'libraries!': [ '<(libchromiumcontent_dir)/libdesktop_capture_differ_sse2.a', ], From 3983566fa316e9da44c79af87038c27903667e56 Mon Sep 17 00:00:00 2001 From: Robo Date: Wed, 9 Mar 2016 19:43:33 +0530 Subject: [PATCH 17/21] allow setting pkg-config variable --- brightray/brightray.gyp | 8 ++++---- brightray/brightray.gypi | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 85af875c48..87604fb49f 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -55,15 +55,15 @@ ['OS=="linux"', { 'link_settings': { 'ldflags': [ - ' Date: Thu, 10 Mar 2016 14:39:07 +0900 Subject: [PATCH 18/21] Handle nullptr in RequestConextGetter --- .../browser/url_request_context_getter.cc | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 6e516edef5..976a779484 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -200,7 +200,8 @@ URLRequestContextGetter::URLRequestContextGetter( // Must first be created on the UI thread. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - std::swap(protocol_handlers_, *protocol_handlers); + if (protocol_handlers) + std::swap(protocol_handlers_, *protocol_handlers); // We must create the proxy config service on the UI loop on Linux because it // must synchronously run on the glib message loop. This will be passed to @@ -231,8 +232,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { #endif // --log-net-log - net_log_->StartLogging(url_request_context_.get()); - url_request_context_->set_net_log(net_log_); + if (net_log_) { + net_log_->StartLogging(url_request_context_.get()); + url_request_context_->set_net_log(net_log_); + } network_delegate_.reset(delegate_->CreateNetworkDelegate()); url_request_context_->set_network_delegate(network_delegate_.get()); @@ -365,12 +368,20 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { } else { backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_)); } - storage_->set_http_transaction_factory(make_scoped_ptr( - new net::HttpCache( - make_scoped_ptr(new DevToolsNetworkTransactionFactory( - controller_, http_network_session_.get())), - std::move(backend), - false))); + + if (controller_) { + storage_->set_http_transaction_factory(make_scoped_ptr( + new net::HttpCache( + make_scoped_ptr(new DevToolsNetworkTransactionFactory( + controller_, http_network_session_.get())), + std::move(backend), + false))); + } else { + storage_->set_http_transaction_factory(make_scoped_ptr( + new net::HttpCache(http_network_session_.get(), + std::move(backend), + false))); + } storage_->set_job_factory(delegate_->CreateURLRequestJobFactory( &protocol_handlers_, &protocol_interceptors_)); From b68d2ba8b5ec95d3fb16996e5a63fbf9b6059fdf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 10 Mar 2016 15:56:13 +0900 Subject: [PATCH 19/21] Fix compilation error on Windows --- brightray/browser/url_request_context_getter.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index 976a779484..dffc106ede 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -22,6 +22,7 @@ #include "net/cert/cert_verifier.h" #include "net/cookies/cookie_monster.h" #include "net/dns/mapped_host_resolver.h" +#include "net/http/http_auth_filter.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_auth_preferences.h" #include "net/http/http_server_properties_impl.h" From 6b79926cc7f63678971c0d8e4f66e564d671dc0b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 10 Mar 2016 16:11:38 +0900 Subject: [PATCH 20/21] Link with sandbox_helper_win.lib --- brightray/brightray.gyp | 1 + 1 file changed, 1 insertion(+) diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 85af875c48..05a63c7aee 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -198,6 +198,7 @@ 'libraries': [ '<(libchromiumcontent_dir)/base_static.lib', '<(libchromiumcontent_dir)/sandbox.lib', + '<(libchromiumcontent_dir)/sandbox_helper_win.lib', '<(libchromiumcontent_dir)/devtools_discovery.lib', '<(libchromiumcontent_dir)/devtools_http_handler.lib', '<(libchromiumcontent_dir)/http_server.lib', From deb1abe15257d482d91b3363ee184afd280d2b09 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 10 Mar 2016 21:00:49 +0900 Subject: [PATCH 21/21] Fix linking error for Release build --- brightray/vendor/libchromiumcontent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index 881cf10e52..217af42402 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 881cf10e5255c3037d5624616fd7544c1e7252ae +Subproject commit 217af424022afea696510146cd0d3e6bba453771