diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index d7120ea98f89..a2e95fbcbe94 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -55,15 +55,15 @@ ['OS=="linux"', { 'link_settings': { 'ldflags': [ - '(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 67ad5c8d540a..6181f8ec6328 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(); } @@ -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 3c9b68d88385..9866732cbcb0 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_contents_resizing_strategy.h b/brightray/browser/devtools_contents_resizing_strategy.h index 9c82c060b1e7..c48272f79774 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_embedder_message_dispatcher.cc b/brightray/browser/devtools_embedder_message_dispatcher.cc index 2a4b38176595..f45d90d753fb 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 46f54dfbf2ce..eb3dc389786b 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/devtools_manager_delegate.cc b/brightray/browser/devtools_manager_delegate.cc index ca8f1cf2d84b..155f35728dfa 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); }; @@ -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/devtools_manager_delegate.h b/brightray/browser/devtools_manager_delegate.h index ed8e357482b2..12eedc66082f 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 1ff21b694a05..8217812b58c7 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" @@ -250,8 +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(), this)); agent_host_->AttachClient(this); GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL, @@ -477,7 +476,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 +543,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_) @@ -573,12 +567,15 @@ 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()) return; - frontend_host_.reset(content::DevToolsFrontendHost::Create(new_host, this)); + frontend_host_.reset(content::DevToolsFrontendHost::Create( + new_host, + base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend, + base::Unretained(this)))); } void InspectableWebContentsImpl::WebContentsDestroyed() { @@ -592,9 +589,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 << ")"; @@ -603,8 +600,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, @@ -632,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 9b985bbc6c96..1e2bab8a26c5 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, @@ -105,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, @@ -117,8 +117,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,21 +126,25 @@ 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; + void DidStartNavigationToPendingEntry( + const GURL& url, + content::NavigationController::ReloadType reload_type) override; // 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, - 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/mac/cocoa_notification.mm b/brightray/browser/mac/cocoa_notification.mm index 68f22d336370..fefae3978808 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/media/media_stream_devices_controller.cc b/brightray/browser/media/media_stream_devices_controller.cc index 3d4f4cc3328c..1a205f1ed775 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. diff --git a/brightray/browser/net/devtools_network_controller.cc b/brightray/browser/net/devtools_network_controller.cc index 42ebf06471fe..71eae70af3ca 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 78afb00a09a5..ed89fc1b54c0 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(); @@ -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/net/devtools_network_protocol_handler.cc b/brightray/browser/net/devtools_network_protocol_handler.cc index b94a04132897..b06678fe92de 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 fa3343ef9879..f0d66a047bb4 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), @@ -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 3e16db0f2c2c..f8e54e67775f 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; diff --git a/brightray/browser/net/devtools_network_transaction_factory.cc b/brightray/browser/net/devtools_network_transaction_factory.cc index d1676a34d56e..d3fb4cfb08b5 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 7d781a22e7b7..b0b06483f9b7 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/network_delegate.cc b/brightray/browser/network_delegate.cc index 8a1f8ee828ce..a1795605562a 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 NetworkDelegate::OnAreStrictSecureCookiesEnabled() const { + return true; +} + +bool NetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { return true; } diff --git a/brightray/browser/network_delegate.h b/brightray/browser/network_delegate.h index b10cabadd229..a561fc059024 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,8 @@ class NetworkDelegate : public net::NetworkDelegate { bool OnCanEnablePrivacyMode( const GURL& url, const GURL& first_party_for_cookies) const override; - bool OnFirstPartyOnlyCookieExperimentEnabled() 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/notification_delegate_adapter.cc b/brightray/browser/notification_delegate_adapter.cc index da9a70aab391..1a4853723b51 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/permission_manager.cc b/brightray/browser/permission_manager.cc index c5d1ac9a9cd5..4492e749c8af 100644 --- a/brightray/browser/permission_manager.cc +++ b/brightray/browser/permission_manager.cc @@ -32,6 +32,28 @@ 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 778605c51ec1..f3ed51d3c1a8 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, diff --git a/brightray/browser/platform_notification_service.cc b/brightray/browser/platform_notification_service.cc index 5ce667625085..7971f2810016 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 5c0d7828a96f..dffc106ede5b 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -22,7 +22,9 @@ #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" #include "net/log/net_log.h" #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" @@ -104,8 +106,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(); @@ -131,14 +141,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* @@ -187,12 +197,12 @@ 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)); - 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 @@ -223,8 +233,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()); @@ -257,10 +269,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 @@ -283,7 +295,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(), @@ -296,25 +308,24 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { schemes.push_back(std::string("digest")); schemes.push_back(std::string("ntlm")); schemes.push_back(std::string("negotiate")); - - auto auth_handler_factory = make_scoped_ptr( +#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 = 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( 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(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(); @@ -347,21 +358,31 @@ 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_)); + } + + 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_http_transaction_factory(make_scoped_ptr( - new net::HttpCache( - new DevToolsNetworkTransactionFactory(controller_, session), - url_request_context_->net_log(), - 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 cf647cf7b512..aaf9855d2a59 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; @@ -59,6 +60,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_; @@ -99,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/browser/web_ui_controller_factory.h b/brightray/browser/web_ui_controller_factory.h index 44a77da5f1ea..ca86de6baa65 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 5494df2fc5ce..67e4fe67fd07 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 c1be87223cd1..74cd74ecebdc 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 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 cb69d3da2a14..d5e5f2a82cf8 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); diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index 74ec88791b96..6516111aedd0 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 diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index ad63d8ba890b..217af424022a 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7 +Subproject commit 217af424022afea696510146cd0d3e6bba453771