diff --git a/atom/browser/api/atom_api_content_tracing.cc b/atom/browser/api/atom_api_content_tracing.cc index 937a87ea213..fa275c1c90d 100644 --- a/atom/browser/api/atom_api_content_tracing.cc +++ b/atom/browser/api/atom_api_content_tracing.cc @@ -7,12 +7,13 @@ #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/file_path_converter.h" -#include "atom/common/node_includes.h" #include "base/bind.h" #include "base/files/file_util.h" #include "content/public/browser/tracing_controller.h" #include "native_mate/dictionary.h" +#include "atom/common/node_includes.h" + using content::TracingController; namespace mate { diff --git a/atom/browser/api/atom_api_debugger.cc b/atom/browser/api/atom_api_debugger.cc index 88d2a7adf4a..90999a4f602 100644 --- a/atom/browser/api/atom_api_debugger.cc +++ b/atom/browser/api/atom_api_debugger.cc @@ -9,7 +9,6 @@ #include "atom/browser/atom_browser_main_parts.h" #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/value_converter.h" -#include "atom/common/node_includes.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "content/public/browser/devtools_agent_host.h" @@ -17,6 +16,8 @@ #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" +#include "atom/common/node_includes.h" + using content::DevToolsAgentHost; namespace atom { @@ -107,7 +108,7 @@ bool Debugger::IsAttached() { void Debugger::Detach() { if (!agent_host_.get()) return; - agent_host_->DetachClient(); + agent_host_->DetachClient(this); AgentHostClosed(agent_host_.get(), false); agent_host_ = nullptr; } @@ -136,7 +137,7 @@ void Debugger::SendCommand(mate::Arguments* args) { std::string json_args; base::JSONWriter::Write(request, &json_args); - agent_host_->DispatchProtocolMessage(json_args); + agent_host_->DispatchProtocolMessage(this, json_args); } // static diff --git a/atom/browser/api/atom_api_power_save_blocker.cc b/atom/browser/api/atom_api_power_save_blocker.cc index 0f017be5fb1..e4072250940 100644 --- a/atom/browser/api/atom_api_power_save_blocker.cc +++ b/atom/browser/api/atom_api_power_save_blocker.cc @@ -6,18 +6,19 @@ #include -#include "atom/common/node_includes.h" -#include "content/public/browser/power_save_blocker.h" +#include "content/public/browser/browser_thread.h" #include "native_mate/dictionary.h" +#include "atom/common/node_includes.h" + namespace mate { template<> -struct Converter { +struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Local val, - content::PowerSaveBlocker::PowerSaveBlockerType* out) { - using content::PowerSaveBlocker; + device::PowerSaveBlocker::PowerSaveBlockerType* out) { + using device::PowerSaveBlocker; std::string type; if (!ConvertFromV8(isolate, val, &type)) return false; @@ -39,7 +40,7 @@ namespace api { PowerSaveBlocker::PowerSaveBlocker(v8::Isolate* isolate) : current_blocker_type_( - content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) { + device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension) { Init(isolate); } @@ -58,30 +59,34 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() { // higher precedence level than |kPowerSaveBlockPreventAppSuspension|. // // Only the highest-precedence blocker type takes effect. - content::PowerSaveBlocker::PowerSaveBlockerType new_blocker_type = - content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension; + device::PowerSaveBlocker::PowerSaveBlockerType new_blocker_type = + device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension; for (const auto& element : power_save_blocker_types_) { if (element.second == - content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep) { + device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep) { new_blocker_type = - content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep; + device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep; break; } } if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) { - std::unique_ptr new_blocker = - content::PowerSaveBlocker::Create( + std::unique_ptr new_blocker( + new device::PowerSaveBlocker( new_blocker_type, - content::PowerSaveBlocker::kReasonOther, - ATOM_PRODUCT_NAME); + device::PowerSaveBlocker::kReasonOther, + ATOM_PRODUCT_NAME, + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::UI), + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::FILE))); power_save_blocker_.swap(new_blocker); current_blocker_type_ = new_blocker_type; } } int PowerSaveBlocker::Start( - content::PowerSaveBlocker::PowerSaveBlockerType type) { + device::PowerSaveBlocker::PowerSaveBlockerType type) { static int count = 0; power_save_blocker_types_[count] = type; UpdatePowerSaveBlocker(); diff --git a/atom/browser/api/atom_api_power_save_blocker.h b/atom/browser/api/atom_api_power_save_blocker.h index 0687106ab8b..73e3663913a 100644 --- a/atom/browser/api/atom_api_power_save_blocker.h +++ b/atom/browser/api/atom_api_power_save_blocker.h @@ -9,7 +9,7 @@ #include #include "atom/browser/api/trackable_object.h" -#include "content/public/browser/power_save_blocker.h" +#include "device/power_save_blocker/power_save_blocker.h" #include "native_mate/handle.h" namespace mate { @@ -33,18 +33,18 @@ class PowerSaveBlocker : public mate::TrackableObject { private: void UpdatePowerSaveBlocker(); - int Start(content::PowerSaveBlocker::PowerSaveBlockerType type); + int Start(device::PowerSaveBlocker::PowerSaveBlockerType type); bool Stop(int id); bool IsStarted(int id); - std::unique_ptr power_save_blocker_; + std::unique_ptr power_save_blocker_; // Currnet blocker type used by |power_save_blocker_| - content::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_; + device::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_; // Map from id to the corresponding blocker type for each request. using PowerSaveBlockerTypeMap = - std::map; + std::map; PowerSaveBlockerTypeMap power_save_blocker_types_; DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker); diff --git a/atom/browser/api/atom_api_render_process_preferences.cc b/atom/browser/api/atom_api_render_process_preferences.cc index d5017122dd6..5786d694cfd 100644 --- a/atom/browser/api/atom_api_render_process_preferences.cc +++ b/atom/browser/api/atom_api_render_process_preferences.cc @@ -7,11 +7,12 @@ #include "atom/browser/api/atom_api_web_contents.h" #include "atom/browser/atom_browser_client.h" #include "atom/common/native_mate_converters/value_converter.h" -#include "atom/common/node_includes.h" #include "content/public/browser/render_process_host.h" #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" +#include "atom/common/node_includes.h" + namespace atom { namespace api { diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 4e9e1a67807..467131a6a9a 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -37,7 +37,6 @@ #include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/value_converter.h" -#include "atom/common/node_includes.h" #include "atom/common/options_switches.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -77,6 +76,8 @@ #include "ui/aura/window.h" #endif +#include "atom/common/node_includes.h" + namespace { struct PrintSettings { @@ -871,7 +872,8 @@ void WebContents::DownloadURL(const GURL& url) { content::BrowserContext::GetDownloadManager(browser_context); download_manager->DownloadUrl( - content::DownloadUrlParameters::FromWebContents(web_contents(), url)); + content::DownloadUrlParameters::CreateForWebContentsMainFrame( + web_contents(), url)); } GURL WebContents::GetURL() const { @@ -1177,7 +1179,7 @@ void WebContents::ShowDefinitionForSelection() { } void WebContents::CopyImageAt(int x, int y) { - const auto host = web_contents()->GetRenderViewHost(); + const auto host = web_contents()->GetMainFrame(); if (host) host->CopyImageAt(x, y); } diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index f171e3f7ee5..535a1552571 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -14,7 +14,6 @@ #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/native_mate_converters/string16_converter.h" -#include "atom/common/node_includes.h" #include "atom/common/options_switches.h" #include "base/command_line.h" #include "content/public/browser/render_process_host.h" @@ -31,6 +30,8 @@ #include "atom/browser/ui/win/taskbar_host.h" #endif +#include "atom/common/node_includes.h" + #if defined(OS_WIN) namespace mate { diff --git a/atom/browser/api/frame_subscriber.cc b/atom/browser/api/frame_subscriber.cc index 1e80acd9233..252b94bd376 100644 --- a/atom/browser/api/frame_subscriber.cc +++ b/atom/browser/api/frame_subscriber.cc @@ -5,10 +5,11 @@ #include "atom/browser/api/frame_subscriber.h" #include "atom/common/native_mate_converters/gfx_converter.h" -#include "atom/common/node_includes.h" #include "base/bind.h" #include "content/public/browser/render_widget_host.h" +#include "atom/common/node_includes.h" + namespace atom { namespace api { diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 80951e7d6e8..edaf20dbd13 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -32,6 +32,7 @@ #include "chrome/browser/speech/tts_message_filter.h" #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/client_certificate_delegate.h" +#include "content/public/browser/geolocation_delegate.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_dispatcher_host.h" @@ -53,6 +54,19 @@ bool g_suppress_renderer_process_restart = false; // Custom schemes to be registered to handle service worker. std::string g_custom_service_worker_schemes = ""; +// A provider of Geolocation services to override AccessTokenStore. +class AtomGeolocationDelegate : public content::GeolocationDelegate { + public: + AtomGeolocationDelegate() = default; + + content::AccessTokenStore* CreateAccessTokenStore() final { + return new AtomAccessTokenStore(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate); +}; + void Noop(scoped_refptr) { } @@ -99,8 +113,9 @@ content::SpeechRecognitionManagerDelegate* return new AtomSpeechRecognitionManagerDelegate; } -content::AccessTokenStore* AtomBrowserClient::CreateAccessTokenStore() { - return new AtomAccessTokenStore; +content::GeolocationDelegate* +AtomBrowserClient::CreateGeolocationDelegate() { + return new AtomGeolocationDelegate(); } void AtomBrowserClient::OverrideWebkitPrefs( diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index e5ccb7961c3..5a43dbad30b 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -49,7 +49,7 @@ class AtomBrowserClient : public brightray::BrowserClient, void RenderProcessWillLaunch(content::RenderProcessHost* host) override; content::SpeechRecognitionManagerDelegate* CreateSpeechRecognitionManagerDelegate() override; - content::AccessTokenStore* CreateAccessTokenStore() override; + content::GeolocationDelegate* CreateGeolocationDelegate() override; void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, content::WebPreferences* prefs) override; std::string GetApplicationLocale() override; diff --git a/atom/browser/atom_resource_dispatcher_host_delegate.cc b/atom/browser/atom_resource_dispatcher_host_delegate.cc index c64a21d26dd..95175d364ed 100644 --- a/atom/browser/atom_resource_dispatcher_host_delegate.cc +++ b/atom/browser/atom_resource_dispatcher_host_delegate.cc @@ -10,8 +10,17 @@ #include "base/strings/utf_string_conversions.h" #include "content/public/browser/browser_thread.h" #include "net/base/escape.h" +#include "net/ssl/client_cert_store.h" #include "url/gurl.h" +#if defined(USE_NSS_CERTS) +#include "net/ssl/client_cert_store_nss.h" +#elif defined(OS_WIN) +#include "net/ssl/client_cert_store_win.h" +#elif defined(OS_MACOSX) +#include "net/ssl/client_cert_store_mac.h" +#endif + using content::BrowserThread; namespace atom { @@ -59,7 +68,8 @@ bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol( const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, bool is_main_frame, ui::PageTransition transition, - bool has_user_gesture) { + bool has_user_gesture, + content::ResourceContext* resource_context) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&HandleExternalProtocolInUI, url, @@ -75,4 +85,19 @@ AtomResourceDispatcherHostDelegate::CreateLoginDelegate( return new LoginHandler(auth_info, request); } +std::unique_ptr +AtomResourceDispatcherHostDelegate::CreateClientCertStore( + content::ResourceContext* resource_context) { + #if defined(USE_NSS_CERTS) + return std::unique_ptr(new net::ClientCertStoreNSS( + net::ClientCertStoreNSS::PasswordDelegateFactory())); + #elif defined(OS_WIN) + return std::unique_ptr(new net::ClientCertStoreWin()); + #elif defined(OS_MACOSX) + return std::unique_ptr(new net::ClientCertStoreMac()); + #elif defined(USE_OPENSSL) + return std::unique_ptr(); + #endif +} + } // namespace atom diff --git a/atom/browser/atom_resource_dispatcher_host_delegate.h b/atom/browser/atom_resource_dispatcher_host_delegate.h index 408b83c92d9..1f55492c4ce 100644 --- a/atom/browser/atom_resource_dispatcher_host_delegate.h +++ b/atom/browser/atom_resource_dispatcher_host_delegate.h @@ -21,10 +21,13 @@ class AtomResourceDispatcherHostDelegate const content::ResourceRequestInfo::WebContentsGetter&, bool is_main_frame, ui::PageTransition transition, - bool has_user_gesture) override; + bool has_user_gesture, + content::ResourceContext* resource_context) override; content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( net::AuthChallengeInfo* auth_info, net::URLRequest* request) override; + std::unique_ptr CreateClientCertStore( + content::ResourceContext* resource_context) override; }; } // namespace atom diff --git a/atom/browser/bridge_task_runner.cc b/atom/browser/bridge_task_runner.cc index 36c8d17359e..2c2f98be703 100644 --- a/atom/browser/bridge_task_runner.cc +++ b/atom/browser/bridge_task_runner.cc @@ -27,7 +27,7 @@ bool BridgeTaskRunner::PostDelayedTask( base::TimeDelta delay) { auto message_loop = base::MessageLoop::current(); if (!message_loop) { - tasks_.push_back(base::MakeTuple(from_here, task, delay)); + tasks_.push_back(std::make_tuple(from_here, task, delay)); return true; } @@ -48,7 +48,7 @@ bool BridgeTaskRunner::PostNonNestableDelayedTask( base::TimeDelta delay) { auto message_loop = base::MessageLoop::current(); if (!message_loop) { - non_nestable_tasks_.push_back(base::MakeTuple(from_here, task, delay)); + non_nestable_tasks_.push_back(std::make_tuple(from_here, task, delay)); return true; } diff --git a/atom/browser/bridge_task_runner.h b/atom/browser/bridge_task_runner.h index b69b33b2951..ab124123161 100644 --- a/atom/browser/bridge_task_runner.h +++ b/atom/browser/bridge_task_runner.h @@ -5,6 +5,7 @@ #ifndef ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_ #define ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_ +#include #include #include "base/single_thread_task_runner.h" @@ -33,7 +34,7 @@ class BridgeTaskRunner : public base::SingleThreadTaskRunner { base::TimeDelta delay) override; private: - using TaskPair = base::Tuple< + using TaskPair = std::tuple< tracked_objects::Location, base::Closure, base::TimeDelta>; std::vector tasks_; std::vector non_nestable_tasks_; diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index 50e7217fddc..43bf1c31669 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -252,11 +252,11 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser( } void CommonWebContentsDelegate::RunFileChooser( - content::WebContents* guest, + content::RenderFrameHost* render_frame_host, const content::FileChooserParams& params) { if (!web_dialog_helper_) web_dialog_helper_.reset(new WebDialogHelper(owner_window())); - web_dialog_helper_->RunFileChooser(guest, params); + web_dialog_helper_->RunFileChooser(render_frame_host, params); } void CommonWebContentsDelegate::EnumerateDirectory(content::WebContents* guest, diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h index c369f89862f..67d4d6f0376 100644 --- a/atom/browser/common_web_contents_delegate.h +++ b/atom/browser/common_web_contents_delegate.h @@ -71,7 +71,7 @@ class CommonWebContentsDelegate content::WebContents* web_contents, SkColor color, const std::vector& suggestions) override; - void RunFileChooser(content::WebContents* web_contents, + void RunFileChooser(content::RenderFrameHost* render_frame_host, const content::FileChooserParams& params) override; void EnumerateDirectory(content::WebContents* web_contents, int request_id, diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 3b836d9cc69..8dbed6d33df 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -33,6 +33,7 @@ #include "content/public/common/content_switches.h" #include "ipc/ipc_message_macros.h" #include "native_mate/dictionary.h" +#include "third_party/skia/include/core/SkRegion.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 4365796a1d2..c22d0687e5f 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -22,6 +22,7 @@ #include "content/public/browser/render_widget_host_view.h" #include "native_mate/dictionary.h" #include "skia/ext/skia_utils_mac.h" +#include "third_party/skia/include/core/SkRegion.h" #include "ui/gfx/skia_util.h" namespace { @@ -1009,8 +1010,8 @@ bool NativeWindowMac::IsKiosk() { void NativeWindowMac::SetBackgroundColor(const std::string& color_name) { SkColor color = ParseHexColor(color_name); - base::ScopedCFTypeRef cgcolor = - skia::CGColorCreateFromSkColor(color); + base::ScopedCFTypeRef cgcolor( + skia::CGColorCreateFromSkColor(color)); [[[window_ contentView] layer] setBackgroundColor:cgcolor]; const auto view = web_contents()->GetRenderWidgetHostView(); diff --git a/atom/browser/net/atom_cert_verifier.cc b/atom/browser/net/atom_cert_verifier.cc index dd588b9501c..7fb2ce72297 100644 --- a/atom/browser/net/atom_cert_verifier.cc +++ b/atom/browser/net/atom_cert_verifier.cc @@ -40,10 +40,7 @@ void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) { } int AtomCertVerifier::Verify( - net::X509Certificate* cert, - const std::string& hostname, - const std::string& ocsp_response, - int flags, + const RequestParams& params, net::CRLSet* crl_set, net::CertVerifyResult* verify_result, const net::CompletionCallback& callback, @@ -53,12 +50,11 @@ int AtomCertVerifier::Verify( if (verify_proc_.is_null()) return default_cert_verifier_->Verify( - cert, hostname, ocsp_response, flags, crl_set, verify_result, callback, - out_req, net_log); + params, crl_set, verify_result, callback, out_req, net_log); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(verify_proc_, hostname, make_scoped_refptr(cert), + base::Bind(verify_proc_, params.hostname(), params.certificate(), base::Bind(OnResult, verify_result, callback))); return net::ERR_IO_PENDING; } diff --git a/atom/browser/net/atom_cert_verifier.h b/atom/browser/net/atom_cert_verifier.h index c8b4bf9290b..74b8f2784c1 100644 --- a/atom/browser/net/atom_cert_verifier.h +++ b/atom/browser/net/atom_cert_verifier.h @@ -26,10 +26,7 @@ class AtomCertVerifier : public net::CertVerifier { protected: // net::CertVerifier: - int Verify(net::X509Certificate* cert, - const std::string& hostname, - const std::string& ocsp_response, - int flags, + int Verify(const RequestParams& params, net::CRLSet* crl_set, net::CertVerifyResult* verify_result, const net::CompletionCallback& callback, diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index df7ad6a56fa..0da43fa5a3d 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -239,7 +239,7 @@ int AtomNetworkDelegate::OnBeforeURLRequest( return HandleResponseEvent(kOnBeforeRequest, request, callback, new_url); } -int AtomNetworkDelegate::OnBeforeSendHeaders( +int AtomNetworkDelegate::OnBeforeStartTransaction( net::URLRequest* request, const net::CompletionCallback& callback, net::HttpRequestHeaders* headers) { @@ -254,18 +254,18 @@ int AtomNetworkDelegate::OnBeforeSendHeaders( DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId, client_id); if (!ContainsKey(response_listeners_, kOnBeforeSendHeaders)) - return brightray::NetworkDelegate::OnBeforeSendHeaders( + return brightray::NetworkDelegate::OnBeforeStartTransaction( request, callback, headers); return HandleResponseEvent( kOnBeforeSendHeaders, request, callback, headers, *headers); } -void AtomNetworkDelegate::OnSendHeaders( +void AtomNetworkDelegate::OnStartTransaction( net::URLRequest* request, const net::HttpRequestHeaders& headers) { if (!ContainsKey(simple_listeners_, kOnSendHeaders)) { - brightray::NetworkDelegate::OnSendHeaders(request, headers); + brightray::NetworkDelegate::OnStartTransaction(request, headers); return; } diff --git a/atom/browser/net/atom_network_delegate.h b/atom/browser/net/atom_network_delegate.h index 3f1bff81cb4..b931a480d98 100644 --- a/atom/browser/net/atom_network_delegate.h +++ b/atom/browser/net/atom_network_delegate.h @@ -77,11 +77,11 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate { int OnBeforeURLRequest(net::URLRequest* request, const net::CompletionCallback& callback, GURL* new_url) override; - int OnBeforeSendHeaders(net::URLRequest* request, - const net::CompletionCallback& callback, - net::HttpRequestHeaders* headers) override; - void OnSendHeaders(net::URLRequest* request, - const net::HttpRequestHeaders& headers) override; + int OnBeforeStartTransaction(net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) override; + void OnStartTransaction(net::URLRequest* request, + const net::HttpRequestHeaders& headers) override; int OnHeadersReceived( net::URLRequest* request, const net::CompletionCallback& callback, diff --git a/atom/browser/osr/osr_render_widget_host_view.cc b/atom/browser/osr/osr_render_widget_host_view.cc index e94e4e8358e..7340e6ed729 100644 --- a/atom/browser/osr/osr_render_widget_host_view.cc +++ b/atom/browser/osr/osr_render_widget_host_view.cc @@ -302,10 +302,9 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient { AtomBeginFrameTimer(int frame_rate_threshold_ms, const base::Closure& callback) : callback_(callback) { - time_source_ = cc::DelayBasedTimeSource::Create( - base::TimeDelta::FromMilliseconds(frame_rate_threshold_ms), + time_source_.reset(new cc::DelayBasedTimeSource( content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::UI).get()); + content::BrowserThread::UI).get())); time_source_->SetClient(this); } @@ -522,21 +521,17 @@ bool OffScreenRenderWidgetHostView::LockMouse() { void OffScreenRenderWidgetHostView::UnlockMouse() { } -bool OffScreenRenderWidgetHostView::GetScreenColorProfile(std::vector*) { - return false; -} - void OffScreenRenderWidgetHostView::OnSwapCompositorFrame( uint32_t output_surface_id, - std::unique_ptr frame) { + cc::CompositorFrame frame) { TRACE_EVENT0("electron", "OffScreenRenderWidgetHostView::OnSwapCompositorFrame"); - if (frame->metadata.root_scroll_offset != last_scroll_offset_) { - last_scroll_offset_ = frame->metadata.root_scroll_offset; + if (frame.metadata.root_scroll_offset != last_scroll_offset_) { + last_scroll_offset_ = frame.metadata.root_scroll_offset; } - if (frame->delegated_frame_data) { + if (frame.delegated_frame_data) { if (software_output_device_) { if (!begin_frame_timer_.get()) { software_output_device_->SetActive(painting_); @@ -551,7 +546,7 @@ void OffScreenRenderWidgetHostView::OnSwapCompositorFrame( } cc::RenderPass* root_pass = - frame->delegated_frame_data->render_pass_list.back().get(); + frame.delegated_frame_data->render_pass_list.back().get(); gfx::Size frame_size = root_pass->output_rect.size(); gfx::Rect damage_rect = gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect)); diff --git a/atom/browser/osr/osr_render_widget_host_view.h b/atom/browser/osr/osr_render_widget_host_view.h index 7c285c4766d..c3f43f5f8a7 100644 --- a/atom/browser/osr/osr_render_widget_host_view.h +++ b/atom/browser/osr/osr_render_widget_host_view.h @@ -36,7 +36,6 @@ #if defined(OS_MACOSX) #include "content/browser/renderer_host/browser_compositor_view_mac.h" -#include "ui/accelerated_widget_mac/accelerated_widget_mac.h" #endif #if defined(OS_MACOSX) @@ -54,11 +53,12 @@ namespace atom { class AtomCopyFrameGenerator; class AtomBeginFrameTimer; +#if defined(OS_MACOSX) +class MacHelper; +#endif + class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase, -#if defined(OS_MACOSX) - public ui::AcceleratedWidgetMacNSView, -#endif public ui::CompositorDelegate, public content::DelegatedFrameHostClient { public: @@ -90,7 +90,6 @@ class OffScreenRenderWidgetHostView void SetBackgroundColor(SkColor color) override; bool LockMouse(void) override; void UnlockMouse(void) override; - bool GetScreenColorProfile(std::vector*) override; #if defined(OS_MACOSX) ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override; void SetActive(bool active) override; @@ -102,7 +101,7 @@ class OffScreenRenderWidgetHostView #endif // defined(OS_MACOSX) // content::RenderWidgetHostViewBase: - void OnSwapCompositorFrame(uint32_t, std::unique_ptr) + void OnSwapCompositorFrame(uint32_t, cc::CompositorFrame) override; void ClearCompositorFrame(void) override; void InitAsPopup(content::RenderWidgetHostView *rwhv, const gfx::Rect& rect) @@ -173,14 +172,6 @@ class OffScreenRenderWidgetHostView bool IsAutoResizeEnabled() const; void OnSetNeedsBeginFrames(bool enabled); -#if defined(OS_MACOSX) - // ui::AcceleratedWidgetMacNSView: - NSView* AcceleratedWidgetGetNSView() const override; - void AcceleratedWidgetGetVSyncParameters( - base::TimeTicks* timebase, base::TimeDelta* interval) const override; - void AcceleratedWidgetSwapCompleted() override; -#endif // defined(OS_MACOSX) - void OnBeginFrameTimerTick(); void SendBeginFrame(base::TimeTicks frame_time, base::TimeDelta vsync_period); @@ -201,6 +192,7 @@ class OffScreenRenderWidgetHostView ui::Compositor* compositor() const { return compositor_.get(); } content::RenderWidgetHostImpl* render_widget_host() const { return render_widget_host_; } + NativeWindow* window() const { return native_window_; } private: void SetupFrameRate(bool force); @@ -233,10 +225,13 @@ class OffScreenRenderWidgetHostView std::unique_ptr begin_frame_timer_; #if defined(OS_MACOSX) - NSWindow* window_; CALayer* background_layer_; std::unique_ptr browser_compositor_; + // Can not be managed by smart pointer because its header can not be included + // in the file that has the destructor. + MacHelper* nsview_; + // Selected text on the renderer. std::string selected_text_; #endif diff --git a/atom/browser/osr/osr_render_widget_host_view_mac.mm b/atom/browser/osr/osr_render_widget_host_view_mac.mm index 06650b7bbb2..88389f8683c 100644 --- a/atom/browser/osr/osr_render_widget_host_view_mac.mm +++ b/atom/browser/osr/osr_render_widget_host_view_mac.mm @@ -7,48 +7,115 @@ #import #include "base/strings/utf_string_conversions.h" +#include "content/common/view_messages.h" +#include "ui/accelerated_widget_mac/accelerated_widget_mac.h" + +namespace atom { + +class MacHelper : + public content::BrowserCompositorMacClient, + public ui::AcceleratedWidgetMacNSView { + public: + explicit MacHelper(OffScreenRenderWidgetHostView* view) : view_(view) {} + virtual ~MacHelper() {} + + // content::BrowserCompositorMacClient: + NSView* BrowserCompositorMacGetNSView() const override { + // Intentionally return nil so that + // BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP uses the layer + // size instead of the NSView size. + return nil; + } + + SkColor BrowserCompositorMacGetGutterColor(SkColor color) const override { + // When making an element on the page fullscreen the element's background + // may not match the page's, so use black as the gutter color to avoid + // flashes of brighter colors during the transition. + if (view_->render_widget_host()->delegate() && + view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) { + return SK_ColorBLACK; + } + return color; + } + + void BrowserCompositorMacSendCompositorSwapAck( + int output_surface_id, + const cc::CompositorFrameAck& ack) override { + view_->render_widget_host()->Send(new ViewMsg_SwapCompositorFrameAck( + view_->render_widget_host()->GetRoutingID(), output_surface_id, ack)); + } + + void BrowserCompositorMacSendReclaimCompositorResources( + int output_surface_id, + const cc::CompositorFrameAck& ack) override { + view_->render_widget_host()->Send(new ViewMsg_ReclaimCompositorResources( + view_->render_widget_host()->GetRoutingID(), output_surface_id, ack)); + } + + void BrowserCompositorMacOnLostCompositorResources() override { + view_->render_widget_host()->ScheduleComposite(); + } + + void BrowserCompositorMacUpdateVSyncParameters( + const base::TimeTicks& timebase, + const base::TimeDelta& interval) override { + view_->render_widget_host()->UpdateVSyncParameters(timebase, interval); + } + + void BrowserCompositorMacSendBeginFrame( + const cc::BeginFrameArgs& args) override { + view_->render_widget_host()->Send( + new ViewMsg_BeginFrame(view_->render_widget_host()->GetRoutingID(), + args)); + } + // ui::AcceleratedWidgetMacNSView: + NSView* AcceleratedWidgetGetNSView() const override { + return [view_->window()->GetNativeWindow() contentView]; + } + + void AcceleratedWidgetGetVSyncParameters( + base::TimeTicks* timebase, base::TimeDelta* interval) const override { + *timebase = base::TimeTicks(); + *interval = base::TimeDelta(); + } + + void AcceleratedWidgetSwapCompleted() override { + } + + private: + OffScreenRenderWidgetHostView* view_; + + DISALLOW_COPY_AND_ASSIGN(MacHelper); +}; ui::AcceleratedWidgetMac* -atom::OffScreenRenderWidgetHostView::GetAcceleratedWidgetMac() const { +OffScreenRenderWidgetHostView::GetAcceleratedWidgetMac() const { if (browser_compositor_) - return browser_compositor_->accelerated_widget_mac(); + return browser_compositor_->GetAcceleratedWidgetMac(); return nullptr; } -NSView* atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetNSView() const { - return [native_window_->GetNativeWindow() contentView]; +void OffScreenRenderWidgetHostView::SetActive(bool active) { } -void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetVSyncParameters( - base::TimeTicks* timebase, base::TimeDelta* interval) const { - *timebase = base::TimeTicks(); - *interval = base::TimeDelta(); +void OffScreenRenderWidgetHostView::ShowDefinitionForSelection() { } -void atom::OffScreenRenderWidgetHostView::AcceleratedWidgetSwapCompleted() { -} - -void atom::OffScreenRenderWidgetHostView::SetActive(bool active) { -} - -void atom::OffScreenRenderWidgetHostView::ShowDefinitionForSelection() { -} - -bool atom::OffScreenRenderWidgetHostView::SupportsSpeech() const { +bool OffScreenRenderWidgetHostView::SupportsSpeech() const { return false; } -void atom::OffScreenRenderWidgetHostView::SpeakSelection() { +void OffScreenRenderWidgetHostView::SpeakSelection() { } -bool atom::OffScreenRenderWidgetHostView::IsSpeaking() const { +bool OffScreenRenderWidgetHostView::IsSpeaking() const { return false; } -void atom::OffScreenRenderWidgetHostView::StopSpeaking() { +void OffScreenRenderWidgetHostView::StopSpeaking() { } -void atom::OffScreenRenderWidgetHostView::SelectionChanged( +void OffScreenRenderWidgetHostView::SelectionChanged( const base::string16& text, size_t offset, const gfx::Range& range) { @@ -69,24 +136,15 @@ void atom::OffScreenRenderWidgetHostView::SelectionChanged( RenderWidgetHostViewBase::SelectionChanged(text, offset, range); } -void atom::OffScreenRenderWidgetHostView::CreatePlatformWidget() { - browser_compositor_ = content::BrowserCompositorMac::Create(); - - compositor_.reset(browser_compositor_->compositor()); - compositor_->SetRootLayer(root_layer_.get()); - browser_compositor_->accelerated_widget_mac()->SetNSView(this); - browser_compositor_->compositor()->SetVisible(true); - - compositor_->SetLocksWillTimeOut(true); - browser_compositor_->Unsuspend(); +void OffScreenRenderWidgetHostView::CreatePlatformWidget() { + nsview_ = new MacHelper(this); + browser_compositor_.reset(new content::BrowserCompositorMac( + nsview_, nsview_, render_widget_host_->is_hidden(), true)); } -void atom::OffScreenRenderWidgetHostView::DestroyPlatformWidget() { - ui::Compositor* compositor = compositor_.release(); - ALLOW_UNUSED_LOCAL(compositor); - - browser_compositor_->accelerated_widget_mac()->ResetNSView(); - browser_compositor_->compositor()->SetVisible(false); - browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0)); - browser_compositor_->compositor()->SetRootLayer(NULL); +void OffScreenRenderWidgetHostView::DestroyPlatformWidget() { + browser_compositor_.reset(); + delete nsview_; } + +} // namespace diff --git a/atom/browser/osr/osr_web_contents_view_mac.mm b/atom/browser/osr/osr_web_contents_view_mac.mm index ba99c0cb959..66838ab5901 100644 --- a/atom/browser/osr/osr_web_contents_view_mac.mm +++ b/atom/browser/osr/osr_web_contents_view_mac.mm @@ -4,6 +4,8 @@ #include "atom/browser/osr/osr_web_contents_view.h" +#import + @interface OffScreenView : NSView @end diff --git a/atom/browser/web_dialog_helper.cc b/atom/browser/web_dialog_helper.cc index fae1aa650d8..e3942f1f717 100644 --- a/atom/browser/web_dialog_helper.cc +++ b/atom/browser/web_dialog_helper.cc @@ -16,9 +16,11 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/file_chooser_file_info.h" +#include "content/public/common/file_chooser_params.h" #include "net/base/mime_util.h" #include "ui/shell_dialogs/selected_file_info.h" @@ -75,8 +77,9 @@ WebDialogHelper::~WebDialogHelper() { } -void WebDialogHelper::RunFileChooser(content::WebContents* web_contents, - const content::FileChooserParams& params) { +void WebDialogHelper::RunFileChooser( + content::RenderFrameHost* render_frame_host, + const content::FileChooserParams& params) { std::vector result; file_dialog::Filters filters = GetFileTypesFromAcceptType( params.accept_types); @@ -133,8 +136,7 @@ void WebDialogHelper::RunFileChooser(content::WebContents* web_contents, } } - web_contents->GetRenderViewHost()->FilesSelectedInChooser( - result, params.mode); + render_frame_host->FilesSelectedInChooser(result, params.mode); } void WebDialogHelper::EnumerateDirectory(content::WebContents* web_contents, diff --git a/atom/browser/web_dialog_helper.h b/atom/browser/web_dialog_helper.h index a3472da4acb..67fe68031cd 100644 --- a/atom/browser/web_dialog_helper.h +++ b/atom/browser/web_dialog_helper.h @@ -13,6 +13,7 @@ class FilePath; namespace content { struct FileChooserParams; +class RenderFrameHost; class WebContents; } @@ -25,7 +26,7 @@ class WebDialogHelper { explicit WebDialogHelper(NativeWindow* window); ~WebDialogHelper(); - void RunFileChooser(content::WebContents* web_contents, + void RunFileChooser(content::RenderFrameHost* render_frame_host, const content::FileChooserParams& params); void EnumerateDirectory(content::WebContents* web_contents, int request_id, diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index d19b57b2837..0146efa711f 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -11,7 +11,6 @@ #include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/gfx_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h" -#include "atom/common/node_includes.h" #include "base/base64.h" #include "base/files/file_util.h" #include "base/strings/pattern.h" @@ -33,6 +32,8 @@ #include "ui/gfx/icon_util.h" #endif +#include "atom/common/node_includes.h" + namespace atom { namespace api { diff --git a/atom/common/api/object_life_monitor.cc b/atom/common/api/object_life_monitor.cc index ffcc0d71842..cd5537e8874 100644 --- a/atom/common/api/object_life_monitor.cc +++ b/atom/common/api/object_life_monitor.cc @@ -12,8 +12,7 @@ namespace atom { ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate, v8::Local target) - : isolate_(isolate), - context_(isolate, isolate->GetCurrentContext()), + : context_(isolate, isolate->GetCurrentContext()), target_(isolate, target), weak_ptr_factory_(this) { target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter); diff --git a/atom/common/api/object_life_monitor.h b/atom/common/api/object_life_monitor.h index 59d5fdb5cff..73030864b93 100644 --- a/atom/common/api/object_life_monitor.h +++ b/atom/common/api/object_life_monitor.h @@ -22,7 +22,6 @@ class ObjectLifeMonitor { static void OnObjectGC(const v8::WeakCallbackInfo& data); static void Free(const v8::WeakCallbackInfo& data); - v8::Isolate* isolate_; v8::Global context_; v8::Global target_; diff --git a/atom/common/native_mate_converters/blink_converter.cc b/atom/common/native_mate_converters/blink_converter.cc index 7a72219416e..b91bdf2df07 100644 --- a/atom/common/native_mate_converters/blink_converter.cc +++ b/atom/common/native_mate_converters/blink_converter.cc @@ -238,7 +238,6 @@ bool Converter::FromV8( dict.Get("accelerationRatioX", &out->accelerationRatioX); dict.Get("accelerationRatioY", &out->accelerationRatioY); dict.Get("hasPreciseScrollingDeltas", &out->hasPreciseScrollingDeltas); - dict.Get("canScroll", &out->canScroll); return true; } diff --git a/atom/common/native_mate_converters/net_converter.cc b/atom/common/native_mate_converters/net_converter.cc index ff97cd63e30..3106eb0a78d 100644 --- a/atom/common/native_mate_converters/net_converter.cc +++ b/atom/common/native_mate_converters/net_converter.cc @@ -9,7 +9,6 @@ #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/value_converter.h" -#include "atom/common/node_includes.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "native_mate/dictionary.h" @@ -21,6 +20,8 @@ #include "net/http/http_response_headers.h" #include "net/url_request/url_request.h" +#include "atom/common/node_includes.h" + namespace mate { // static diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index 343b4a013b5..046e6ef8f36 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/atom/common/native_mate_converters/v8_value_converter.cc @@ -375,7 +375,7 @@ base::Value* V8ValueConverter::FromNodeBuffer( FromV8ValueState* state, v8::Isolate* isolate) const { return base::BinaryValue::CreateWithCopiedBuffer( - node::Buffer::Data(value), node::Buffer::Length(value)); + node::Buffer::Data(value), node::Buffer::Length(value)).release(); } base::Value* V8ValueConverter::FromV8Object( diff --git a/atom/renderer/atom_render_view_observer.cc b/atom/renderer/atom_render_view_observer.cc index 37f408f74f5..0db68e14dc4 100644 --- a/atom/renderer/atom_render_view_observer.cc +++ b/atom/renderer/atom_render_view_observer.cc @@ -103,7 +103,6 @@ AtomRenderViewObserver::AtomRenderViewObserver( content::RenderView* render_view, AtomRendererClient* renderer_client) : content::RenderViewObserver(render_view), - renderer_client_(renderer_client), document_created_(false) { // Initialise resource for directory listing. net::NetModule::SetResourceProvider(NetResourceProvider); @@ -151,6 +150,10 @@ bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) { return handled; } +void AtomRenderViewObserver::OnDestruct() { + delete this; +} + void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all, const base::string16& channel, const base::ListValue& args) { diff --git a/atom/renderer/atom_render_view_observer.h b/atom/renderer/atom_render_view_observer.h index 376138f0849..76b05cd19ec 100644 --- a/atom/renderer/atom_render_view_observer.h +++ b/atom/renderer/atom_render_view_observer.h @@ -29,14 +29,12 @@ class AtomRenderViewObserver : public content::RenderViewObserver { void DidCreateDocumentElement(blink::WebLocalFrame* frame) override; void DraggableRegionsChanged(blink::WebFrame* frame) override; bool OnMessageReceived(const IPC::Message& message) override; + void OnDestruct() override; void OnBrowserMessage(bool send_to_all, const base::string16& channel, const base::ListValue& args); - // Weak reference to renderer client. - AtomRendererClient* renderer_client_; - // Whether the document object has been created. bool document_created_; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 02b374abe94..4e16e3c8454 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -13,7 +13,6 @@ #include "atom/common/color_util.h" #include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/node_bindings.h" -#include "atom/common/node_includes.h" #include "atom/common/options_switches.h" #include "atom/renderer/atom_render_view_observer.h" #include "atom/renderer/guest_view_container.h" @@ -51,6 +50,8 @@ #include #endif +#include "atom/common/node_includes.h" + namespace atom { namespace { @@ -85,6 +86,10 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver { renderer_client_->WillReleaseScriptContext(context, render_frame_); } + void OnDestruct() override { + delete this; + } + private: content::RenderFrame* render_frame_; int world_id_; diff --git a/atom/renderer/guest_view_container.cc b/atom/renderer/guest_view_container.cc index f50c3f78685..5a22e3f1215 100644 --- a/atom/renderer/guest_view_container.cc +++ b/atom/renderer/guest_view_container.cc @@ -22,8 +22,7 @@ static base::LazyInstance g_guest_view_container_map = } // namespace GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame) - : render_frame_(render_frame), - weak_ptr_factory_(this) { + : weak_ptr_factory_(this) { } GuestViewContainer::~GuestViewContainer() { diff --git a/atom/renderer/guest_view_container.h b/atom/renderer/guest_view_container.h index 3771c7adc4e..eefec7bf74b 100644 --- a/atom/renderer/guest_view_container.h +++ b/atom/renderer/guest_view_container.h @@ -32,7 +32,6 @@ class GuestViewContainer : public content::BrowserPluginDelegate { private: int element_instance_id_; - content::RenderFrame* render_frame_; ResizeCallback element_resize_callback_; diff --git a/chromium_src/chrome/browser/media/native_desktop_media_list.cc b/chromium_src/chrome/browser/media/native_desktop_media_list.cc index 76170a473d8..2652c27f01b 100644 --- a/chromium_src/chrome/browser/media/native_desktop_media_list.cc +++ b/chromium_src/chrome/browser/media/native_desktop_media_list.cc @@ -97,7 +97,8 @@ class NativeDesktopMediaList::Worker typedef std::map ImageHashesMap; // webrtc::DesktopCapturer::Callback interface. - void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; + void OnCaptureResult(webrtc::DesktopCapturer::Result result, + std::unique_ptr frame) override; base::WeakPtr media_list_; @@ -217,9 +218,10 @@ void NativeDesktopMediaList::Worker::Refresh( base::Bind(&NativeDesktopMediaList::OnRefreshFinished, media_list_)); } -void NativeDesktopMediaList::Worker::OnCaptureCompleted( - webrtc::DesktopFrame* frame) { - current_frame_.reset(frame); +void NativeDesktopMediaList::Worker::OnCaptureResult( + webrtc::DesktopCapturer::Result result, + std::unique_ptr frame) { + current_frame_ = std::move(frame); } NativeDesktopMediaList::NativeDesktopMediaList( diff --git a/chromium_src/chrome/browser/printing/print_view_manager_base.cc b/chromium_src/chrome/browser/printing/print_view_manager_base.cc index f771f6963d4..71c5d9ce494 100644 --- a/chromium_src/chrome/browser/printing/print_view_manager_base.cc +++ b/chromium_src/chrome/browser/printing/print_view_manager_base.cc @@ -133,7 +133,8 @@ void PrintViewManagerBase::OnDidPrintPage( } } - std::unique_ptr metafile(new PdfMetafileSkia); + std::unique_ptr metafile( + new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE)); if (metafile_must_be_valid) { if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) { NOTREACHED() << "Invalid metafile header"; diff --git a/chromium_src/chrome/common/chrome_paths.cc b/chromium_src/chrome/common/chrome_paths.cc index 293ea2638ae..079b10c4383 100644 --- a/chromium_src/chrome/common/chrome_paths.cc +++ b/chromium_src/chrome/common/chrome_paths.cc @@ -17,6 +17,7 @@ #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/widevine_cdm_constants.h" #include "third_party/widevine/cdm/stub/widevine_cdm_version.h" +#include "third_party/widevine/cdm/widevine_cdm_common.h" #if defined(OS_ANDROID) #include "base/android/path_utils.h" diff --git a/chromium_src/chrome/common/widevine_cdm_constants.cc b/chromium_src/chrome/common/widevine_cdm_constants.cc index 587966a9c36..c8655f8d4f4 100644 --- a/chromium_src/chrome/common/widevine_cdm_constants.cc +++ b/chromium_src/chrome/common/widevine_cdm_constants.cc @@ -7,9 +7,6 @@ #include "build/build_config.h" #include "ppapi/shared_impl/ppapi_permissions.h" -const base::FilePath::CharType kWidevineCdmBaseDirectory[] = - FILE_PATH_LITERAL("WidevineCDM"); - const char kWidevineCdmPluginExtension[] = ""; const int32_t kWidevineCdmPluginPermissions = ppapi::PERMISSION_DEV | diff --git a/chromium_src/chrome/common/widevine_cdm_constants.h b/chromium_src/chrome/common/widevine_cdm_constants.h index 9597b1cb41f..020601d236d 100644 --- a/chromium_src/chrome/common/widevine_cdm_constants.h +++ b/chromium_src/chrome/common/widevine_cdm_constants.h @@ -8,9 +8,6 @@ #include "base/macros.h" #include "base/files/file_path.h" -// The Widevine CDM adapter and Widevine CDM are in this directory. -extern const base::FilePath::CharType kWidevineCdmBaseDirectory[]; - extern const char kWidevineCdmPluginExtension[]; // Permission bits for Widevine CDM plugin. diff --git a/chromium_src/chrome/renderer/media/chrome_key_systems.cc b/chromium_src/chrome/renderer/media/chrome_key_systems.cc index 79e1333a746..ef3ab52e59a 100644 --- a/chromium_src/chrome/renderer/media/chrome_key_systems.cc +++ b/chromium_src/chrome/renderer/media/chrome_key_systems.cc @@ -241,6 +241,7 @@ static void AddPepperBasedWidevine( #endif // defined(USE_PROPRIETARY_CODECS) } + using Robustness = cdm::WidevineKeySystemProperties::Robustness; concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( supported_codecs, #if defined(OS_CHROMEOS) @@ -253,8 +254,8 @@ static void AddPepperBasedWidevine( media::EmeFeatureSupport::REQUESTABLE, // Persistent state. media::EmeFeatureSupport::REQUESTABLE)); // Distinctive identifier. #else // (Desktop) - media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness. - media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness. + Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness. + Robustness::SW_SECURE_DECODE, // Maximum video robustness. media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. media::EmeSessionTypeSupport:: NOT_SUPPORTED, // persistent-release-message. diff --git a/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc b/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc index 59046b328bf..5e41c5b8a65 100644 --- a/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc +++ b/chromium_src/chrome/renderer/pepper/pepper_flash_renderer_host.cc @@ -205,8 +205,8 @@ int32_t PepperFlashRendererHost::OnDrawGlyphs( style |= SkTypeface::kBold; if (params.font_desc.italic) style |= SkTypeface::kItalic; - sk_sp typeface(SkTypeface::CreateFromName( - params.font_desc.face.c_str(), static_cast(style))); + sk_sp typeface(SkTypeface::MakeFromName( + params.font_desc.face.c_str(), SkFontStyle::FromOldStyle(style))); if (!typeface) return PP_ERROR_FAILED; diff --git a/chromium_src/chrome/renderer/pepper/pepper_helper.cc b/chromium_src/chrome/renderer/pepper/pepper_helper.cc index c9700c99713..eef18560f9e 100644 --- a/chromium_src/chrome/renderer/pepper/pepper_helper.cc +++ b/chromium_src/chrome/renderer/pepper/pepper_helper.cc @@ -24,3 +24,7 @@ void PepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) { std::unique_ptr( new PepperSharedMemoryMessageFilter(host))); } + +void PepperHelper::OnDestruct() { + delete this; +} diff --git a/chromium_src/chrome/renderer/pepper/pepper_helper.h b/chromium_src/chrome/renderer/pepper/pepper_helper.h index b3e850b2481..6157d2c7948 100644 --- a/chromium_src/chrome/renderer/pepper/pepper_helper.h +++ b/chromium_src/chrome/renderer/pepper/pepper_helper.h @@ -17,6 +17,7 @@ class PepperHelper : public content::RenderFrameObserver { // RenderFrameObserver. void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; + void OnDestruct() override; private: DISALLOW_COPY_AND_ASSIGN(PepperHelper); diff --git a/chromium_src/chrome/renderer/printing/print_web_view_helper.cc b/chromium_src/chrome/renderer/printing/print_web_view_helper.cc index 7ff3471f953..3c2bf680d05 100644 --- a/chromium_src/chrome/renderer/printing/print_web_view_helper.cc +++ b/chromium_src/chrome/renderer/printing/print_web_view_helper.cc @@ -545,7 +545,8 @@ void PrepareFrameAndViewForPrint::CopySelection( WebPreferences prefs = preferences; prefs.javascript_enabled = false; - blink::WebView* web_view = blink::WebView::create(this); + blink::WebView* web_view = + blink::WebView::create(this, blink::WebPageVisibilityStateVisible); owns_web_view_ = true; content::RenderView::ApplyWebPreferences(prefs, web_view); web_view->setMainFrame( @@ -662,6 +663,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { return handled; } +void PrintWebViewHelper::OnDestruct() { + delete this; +} + bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) { DCHECK(frame); blink::WebView* webView = render_view()->GetWebView(); @@ -1266,7 +1271,7 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument( return false; } - metafile_.reset(new PdfMetafileSkia); + metafile_.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE)); CHECK(metafile_->Init()); current_page_index_ = 0; diff --git a/chromium_src/chrome/renderer/printing/print_web_view_helper.h b/chromium_src/chrome/renderer/printing/print_web_view_helper.h index 0a00f2ebb1a..b748a6b6fb0 100644 --- a/chromium_src/chrome/renderer/printing/print_web_view_helper.h +++ b/chromium_src/chrome/renderer/printing/print_web_view_helper.h @@ -92,9 +92,9 @@ class PrintWebViewHelper }; // RenderViewObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) override; - virtual void PrintPage(blink::WebLocalFrame* frame, - bool user_initiated) override; + bool OnMessageReceived(const IPC::Message& message) override; + void PrintPage(blink::WebLocalFrame* frame, bool user_initiated) override; + void OnDestruct() override; // Message handlers --------------------------------------------------------- #if !defined(DISABLE_BASIC_PRINTING) diff --git a/chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm b/chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm index 36ba4a597cd..9425bf2e4b2 100644 --- a/chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm +++ b/chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm @@ -23,7 +23,7 @@ using blink::WebFrame; void PrintWebViewHelper::PrintPageInternal( const PrintMsg_PrintPage_Params& params, WebFrame* frame) { - PdfMetafileSkia metafile; + PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); CHECK(metafile.Init()); int page_number = params.page_number; @@ -61,7 +61,7 @@ bool PrintWebViewHelper::RenderPreviewPage( is_print_ready_metafile_sent_; if (render_to_draft) { - draft_metafile.reset(new PdfMetafileSkia()); + draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE)); CHECK(draft_metafile->Init()); initial_render_metafile = draft_metafile.get(); } @@ -80,7 +80,8 @@ bool PrintWebViewHelper::RenderPreviewPage( print_preview_context_.generate_draft_pages()) { DCHECK(!draft_metafile.get()); draft_metafile = - print_preview_context_.metafile()->GetMetafileForCurrentPage(); + print_preview_context_.metafile()->GetMetafileForCurrentPage( + PDF_SKIA_DOCUMENT_TYPE); } } return PreviewPageRendered(page_number, draft_metafile.get()); diff --git a/common.gypi b/common.gypi index 52eba31d0ae..f12687634b1 100644 --- a/common.gypi +++ b/common.gypi @@ -228,6 +228,17 @@ }], # OS=="win" ], }], + ['_target_name.startswith("crashpad")', { + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-Wno-unused-private-field', + ], + }, + }], # OS=="mac" + ], + }], ['_target_name.startswith("breakpad") or _target_name in ["crash_report_sender", "dump_syms"]', { 'conditions': [ ['OS=="mac"', {