diff --git a/atom/app/node_main.cc b/atom/app/node_main.cc index fb44ba73e9e4..e8487bf1dd5c 100644 --- a/atom/app/node_main.cc +++ b/atom/app/node_main.cc @@ -55,7 +55,7 @@ int NodeMain(int argc, char *argv[]) { // Start our custom debugger implementation. NodeDebugger node_debugger(gin_env.isolate()); if (node_debugger.IsRunning()) - env->AssignToContext(v8::Debug::GetDebugContext()); + env->AssignToContext(v8::Debug::GetDebugContext(gin_env.isolate())); #if defined(OS_WIN) mate::Dictionary process(gin_env.isolate(), env->process_object()); diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 9624301abec2..e0c5f7e92b61 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -312,8 +312,21 @@ struct Converter { return dict.GetHandle(); } }; -} // namespace mate +template<> +struct Converter { + static bool FromV8(v8::Isolate* isolate, v8::Local val, + content::CertificateRequestResultType* out) { + bool b; + if (!ConvertFromV8(isolate, val, &b)) + return false; + *out = b ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE : + content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; + return true; + } +}; + +} // namespace mate namespace atom { @@ -573,8 +586,8 @@ void App::AllowCertificateError( bool overridable, bool strict_enforcement, bool expired_previous_decision, - const base::Callback& callback, - content::CertificateRequestResultType* request) { + const base::Callback& + callback) { v8::Locker locker(isolate()); v8::HandleScope handle_scope(isolate()); bool prevent_default = Emit("certificate-error", @@ -586,7 +599,7 @@ void App::AllowCertificateError( // Deny the certificate by default. if (!prevent_default) - *request = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; + callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY); } void App::SelectClientCertificate( diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index f3b662f3c17b..c72d3c1998ed 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -98,8 +98,8 @@ class App : public AtomBrowserClient::Delegate, bool overridable, bool strict_enforcement, bool expired_previous_decision, - const base::Callback& callback, - content::CertificateRequestResultType* request) override; + const base::Callback& + callback) override; void SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, diff --git a/atom/browser/api/atom_api_download_item.cc b/atom/browser/api/atom_api_download_item.cc index 818e18ae58e2..ccb99b6f60d9 100644 --- a/atom/browser/api/atom_api_download_item.cc +++ b/atom/browser/api/atom_api_download_item.cc @@ -10,8 +10,8 @@ #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h" -#include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/threading/thread_task_runner_handle.h" #include "native_mate/dictionary.h" #include "net/base/filename_util.h" @@ -80,7 +80,8 @@ void DownloadItem::OnDownloadUpdated(content::DownloadItem* item) { Emit("done", item->GetState()); // Destroy the item once item is downloaded. - base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, GetDestroyClosure()); } else { Emit("updated", item->GetState()); } diff --git a/atom/browser/api/atom_api_power_save_blocker.cc b/atom/browser/api/atom_api_power_save_blocker.cc index e40722509405..f430e28c3bac 100644 --- a/atom/browser/api/atom_api_power_save_blocker.cc +++ b/atom/browser/api/atom_api_power_save_blocker.cc @@ -11,6 +11,8 @@ #include "atom/common/node_includes.h" +using content::BrowserThread; + namespace mate { template<> @@ -76,10 +78,8 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() { new_blocker_type, device::PowerSaveBlocker::kReasonOther, ATOM_PRODUCT_NAME, - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::UI), - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::FILE))); + BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), + BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); power_save_blocker_.swap(new_blocker); current_blocker_type_ = new_blocker_type; } diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index d4ef984085e2..5786dd2221e5 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -254,8 +254,8 @@ class ResolveProxyHelper { // Start the request. int result = proxy_service->ResolveProxy( - url, "GET", net::LOAD_NORMAL, &proxy_info_, completion_callback, - &pac_req_, nullptr, net::BoundNetLog()); + url, "GET", &proxy_info_, completion_callback, &pac_req_, nullptr, + net::BoundNetLog()); // Completed synchronously. if (result != net::ERR_IO_PENDING) diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 3f0386ab70ab..4e9b86dbb2d0 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -13,6 +13,7 @@ #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 "base/threading/thread_task_runner_handle.h" #include "native_mate/constructor.h" #include "native_mate/dictionary.h" #include "ui/gfx/image/image.h" @@ -71,7 +72,8 @@ Tray::Tray(v8::Isolate* isolate, v8::Local wrapper, Tray::~Tray() { // Destroy the native tray in next tick. - base::MessageLoop::current()->DeleteSoon(FROM_HERE, tray_icon_.release()); + base::ThreadTaskRunnerHandle::Get()->DeleteSoon( + FROM_HERE, tray_icon_.release()); } // static diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index af64d9017c4a..17fe83afe0a4 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -40,6 +40,7 @@ #include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/options_switches.h" #include "base/strings/utf_string_conversions.h" +#include "base/threading/thread_task_runner_handle.h" #include "brightray/browser/inspectable_web_contents.h" #include "brightray/browser/inspectable_web_contents_view.h" #include "chrome/browser/printing/print_preview_message_handler.h" @@ -830,7 +831,8 @@ void WebContents::WebContentsDestroyed() { Emit("destroyed"); // Destroy the native class in next tick. - base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, GetDestroyClosure()); } void WebContents::NavigationEntryCommitted( @@ -976,7 +978,7 @@ std::string WebContents::GetUserAgent() { } void WebContents::InsertCSS(const std::string& css) { - web_contents()->InsertCSS(css); + // FIXME(zcbenz): Redirect this method to webFrame. } bool WebContents::SavePage(const base::FilePath& full_file_path, @@ -1066,7 +1068,8 @@ void WebContents::InspectElement(int x, int y) { OpenDevTools(nullptr); scoped_refptr agent( content::DevToolsAgentHost::GetOrCreateFor(web_contents())); - agent->InspectElement(x, y); + // FIXME(zcbenz): Figure out how to implement this for Chrome 54. + agent->InspectElement(nullptr, x, y); } void WebContents::InspectServiceWorker() { diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 49ebe464c3e9..efbd31bc6502 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -17,6 +17,7 @@ #include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/options_switches.h" #include "base/command_line.h" +#include "base/threading/thread_task_runner_handle.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_switches.h" #include "native_mate/constructor.h" @@ -152,7 +153,7 @@ Window::~Window() { // Destroy the native window in next tick because the native code might be // iterating all windows. - base::MessageLoop::current()->DeleteSoon(FROM_HERE, window_.release()); + base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, window_.release()); } void Window::WillCloseWindow(bool* prevent_default) { @@ -185,7 +186,8 @@ void Window::OnWindowClosed() { RemoveFromParentChildWindows(); // Destroy the native class when window is closed. - base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, GetDestroyClosure()); } void Window::OnWindowBlur() { diff --git a/atom/browser/atom_blob_reader.cc b/atom/browser/atom_blob_reader.cc index 676386bc6af7..fd251c70d3d6 100644 --- a/atom/browser/atom_blob_reader.cc +++ b/atom/browser/atom_blob_reader.cc @@ -73,7 +73,7 @@ void AtomBlobReader::StartReading( auto blob_reader = blob_data_handle->CreateReader( file_system_context_.get(), - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get()); + BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()); BlobReadHelper* blob_read_helper = new BlobReadHelper(std::move(blob_reader), callback); blob_read_helper->Read(); diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 6734bbfa101e..97a13fe6d6b0 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -10,7 +10,6 @@ #include "atom/browser/api/atom_api_app.h" #include "atom/browser/api/atom_api_protocol.h" -#include "atom/browser/atom_access_token_store.h" #include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/atom_quota_permission_context.h" @@ -33,7 +32,6 @@ #include "content/common/resource_request_body_impl.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" @@ -56,19 +54,6 @@ 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) { } @@ -93,7 +78,7 @@ AtomBrowserClient::~AtomBrowserClient() { content::WebContents* AtomBrowserClient::GetWebContentsFromProcessID( int process_id) { // If the process is a pending process, we should use the old one. - if (ContainsKey(pending_processes_, process_id)) + if (base::ContainsKey(pending_processes_, process_id)) process_id = pending_processes_[process_id]; // Certain render process will be created with no associated render view, @@ -160,11 +145,6 @@ content::SpeechRecognitionManagerDelegate* return new AtomSpeechRecognitionManagerDelegate; } -content::GeolocationDelegate* -AtomBrowserClient::CreateGeolocationDelegate() { - return new AtomGeolocationDelegate(); -} - void AtomBrowserClient::OverrideWebkitPrefs( content::RenderViewHost* host, content::WebPreferences* prefs) { prefs->javascript_enabled = true; @@ -283,13 +263,13 @@ void AtomBrowserClient::AllowCertificateError( bool overridable, bool strict_enforcement, bool expired_previous_decision, - const base::Callback& callback, - content::CertificateRequestResultType* request) { + const base::Callback& + callback) { if (delegate_) { delegate_->AllowCertificateError( web_contents, cert_error, ssl_info, request_url, resource_type, overridable, strict_enforcement, - expired_previous_decision, callback, request); + expired_previous_decision, callback); } } @@ -315,9 +295,9 @@ bool AtomBrowserClient::CanCreateWindow( const GURL& opener_top_level_frame_url, const GURL& source_origin, WindowContainerType container_type, - const std::string& frame_name, const GURL& target_url, const content::Referrer& referrer, + const std::string& frame_name, WindowOpenDisposition disposition, const blink::WebWindowFeatures& features, const std::vector& additional_features, diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index fe986c1ad13a..0956158717b2 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -50,7 +50,6 @@ class AtomBrowserClient : public brightray::BrowserClient, void RenderProcessWillLaunch(content::RenderProcessHost* host) override; content::SpeechRecognitionManagerDelegate* CreateSpeechRecognitionManagerDelegate() override; - device::GeolocationDelegate* CreateGeolocationDelegate() override; void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, content::WebPreferences* prefs) override; std::string GetApplicationLocale() override; @@ -72,8 +71,8 @@ class AtomBrowserClient : public brightray::BrowserClient, bool overridable, bool strict_enforcement, bool expired_previous_decision, - const base::Callback& callback, - content::CertificateRequestResultType* request) override; + const base::Callback& + callback) override; void SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, @@ -84,9 +83,9 @@ class AtomBrowserClient : public brightray::BrowserClient, const GURL& opener_top_level_frame_url, const GURL& source_origin, WindowContainerType container_type, - const std::string& frame_name, const GURL& target_url, const content::Referrer& referrer, + const std::string& frame_name, WindowOpenDisposition disposition, const blink::WebWindowFeatures& features, const std::vector& additional_features, diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index 4af06a426bd4..1507a976fdb9 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -5,6 +5,7 @@ #include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/api/trackable_object.h" +#include "atom/browser/atom_access_token_store.h" #include "atom/browser/atom_browser_client.h" #include "atom/browser/atom_browser_context.h" #include "atom/browser/bridge_task_runner.h" @@ -18,6 +19,8 @@ #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/browser_process.h" #include "content/public/browser/child_process_security_policy.h" +#include "device/geolocation/geolocation_delegate.h" +#include "device/geolocation/geolocation_provider.h" #include "v8/include/v8-debug.h" #if defined(USE_X11) @@ -27,11 +30,28 @@ namespace atom { +namespace { + +// A provider of Geolocation services to override AccessTokenStore. +class AtomGeolocationDelegate : public device::GeolocationDelegate { + public: + AtomGeolocationDelegate() = default; + + scoped_refptr CreateAccessTokenStore() final { + return new AtomAccessTokenStore(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate); +}; + template void Erase(T* container, typename T::iterator iter) { container->erase(iter); } +} // namespace + // static AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr; @@ -115,7 +135,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() { // Make sure node can get correct environment when debugging. if (node_debugger_->IsRunning()) - env->AssignToContext(v8::Debug::GetDebugContext()); + env->AssignToContext(v8::Debug::GetDebugContext(js_env_->isolate())); // Add Electron extended APIs. atom_bindings_->BindTo(js_env_->isolate(), env->process_object()); @@ -171,6 +191,8 @@ void AtomBrowserMainParts::PostMainMessageLoopStart() { #if defined(OS_POSIX) HandleShutdownSignals(); #endif + device::GeolocationProvider::SetGeolocationDelegate( + new AtomGeolocationDelegate()); } void AtomBrowserMainParts::PostMainMessageLoopRun() { diff --git a/atom/browser/atom_permission_manager.cc b/atom/browser/atom_permission_manager.cc index 7fc5fa0d0378..c0cc0d8483da 100644 --- a/atom/browser/atom_permission_manager.cc +++ b/atom/browser/atom_permission_manager.cc @@ -51,6 +51,7 @@ int AtomPermissionManager::RequestPermission( content::PermissionType permission, content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, + bool user_gesture, const ResponseCallback& response_callback) { int process_id = render_frame_host->GetProcess()->GetID(); @@ -81,8 +82,9 @@ int AtomPermissionManager::RequestPermissions( const std::vector& permissions, content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, + bool user_gesture, const base::Callback&)>& callback) { + const std::vector&)>& callback) { // FIXME(zcbenz): Just ignore multiple permissions request for now. std::vector permissionStatuses; for (auto permission : permissions) { diff --git a/atom/browser/atom_permission_manager.h b/atom/browser/atom_permission_manager.h index d0fcdc60768f..39072614a3f9 100644 --- a/atom/browser/atom_permission_manager.h +++ b/atom/browser/atom_permission_manager.h @@ -37,13 +37,17 @@ class AtomPermissionManager : public content::PermissionManager { content::PermissionType permission, content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, - const ResponseCallback& callback) override; + 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; + const std::vector&)>& callback) + override; protected: void OnPermissionResponse(int request_id, diff --git a/atom/browser/atom_security_state_model_client.cc b/atom/browser/atom_security_state_model_client.cc index 610d30ff014a..e69db91eab72 100644 --- a/atom/browser/atom_security_state_model_client.cc +++ b/atom/browser/atom_security_state_model_client.cc @@ -91,14 +91,9 @@ void AtomSecurityStateModelClient::GetVisibleSecurityState( state->connection_status = ssl.connection_status; state->security_bits = ssl.security_bits; state->sct_verify_statuses.clear(); - state->sct_verify_statuses.insert(state->sct_verify_statuses.end(), - ssl.num_unknown_scts, - net::ct::SCT_STATUS_LOG_UNKNOWN); - state->sct_verify_statuses.insert(state->sct_verify_statuses.end(), - ssl.num_invalid_scts, - net::ct::SCT_STATUS_INVALID); - state->sct_verify_statuses.insert(state->sct_verify_statuses.end(), - ssl.num_valid_scts, net::ct::SCT_STATUS_OK); + state->sct_verify_statuses.insert(state->sct_verify_statuses.begin(), + ssl.sct_statuses.begin(), + ssl.sct_statuses.end()); state->displayed_mixed_content = (ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT) ? true diff --git a/atom/browser/browser.cc b/atom/browser/browser.cc index b227b6b81590..31e354c7d409 100644 --- a/atom/browser/browser.cc +++ b/atom/browser/browser.cc @@ -10,8 +10,8 @@ #include "atom/browser/native_window.h" #include "atom/browser/window_list.h" #include "base/files/file_util.h" -#include "base/message_loop/message_loop.h" #include "base/path_service.h" +#include "base/threading/thread_task_runner_handle.h" #include "brightray/browser/brightray_paths.h" namespace atom { @@ -85,7 +85,7 @@ void Browser::Shutdown() { FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit()); if (base::MessageLoop::current()) { - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } else { // There is no message loop available so we are in early stage. diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index 43bf1c31669e..bc01bda1efec 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -331,14 +331,14 @@ content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle( explanations->ran_insecure_content = security_info.mixed_content_status == - SecurityStateModel::RAN_MIXED_CONTENT || + security_state::SecurityStateModel::CONTENT_STATUS_RAN || security_info.mixed_content_status == - SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT; + security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; explanations->displayed_insecure_content = security_info.mixed_content_status == - SecurityStateModel::DISPLAYED_MIXED_CONTENT || + security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED || security_info.mixed_content_status == - SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT; + security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; if (net::IsCertStatusError(security_info.cert_status)) { std::string error_string = net::ErrorToString( @@ -364,13 +364,6 @@ content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle( } } - if (security_info.is_secure_protocol_and_ciphersuite) { - explanations->secure_explanations.push_back( - content::SecurityStyleExplanation( - kSecureProtocol, - kSecureProtocolDescription)); - } - return security_style; } diff --git a/atom/browser/lib/bluetooth_chooser.cc b/atom/browser/lib/bluetooth_chooser.cc index 2ed21bd333fd..cf9a24447518 100644 --- a/atom/browser/lib/bluetooth_chooser.cc +++ b/atom/browser/lib/bluetooth_chooser.cc @@ -89,8 +89,12 @@ void BluetoothChooser::ShowDiscoveryState(DiscoveryState state) { } } -void BluetoothChooser::AddDevice(const std::string& device_id, - const base::string16& device_name) { +void BluetoothChooser::AddOrUpdateDevice(const std::string& device_id, + bool should_update_name, + const base::string16& device_name, + bool is_gatt_connected, + bool is_paired, + int signal_strength_level) { DeviceInfo info = {device_id, device_name}; device_list_.push_back(info); } diff --git a/atom/browser/lib/bluetooth_chooser.h b/atom/browser/lib/bluetooth_chooser.h index 615dfcb8c663..fbc97c981519 100644 --- a/atom/browser/lib/bluetooth_chooser.h +++ b/atom/browser/lib/bluetooth_chooser.h @@ -27,8 +27,12 @@ class BluetoothChooser : public content::BluetoothChooser { // content::BluetoothChooser: void SetAdapterPresence(AdapterPresence presence) override; void ShowDiscoveryState(DiscoveryState state) override; - void AddDevice(const std::string& device_id, - const base::string16& device_name) override; + void AddOrUpdateDevice(const std::string& device_id, + bool should_update_name, + const base::string16& device_name, + bool is_gatt_connected, + bool is_paired, + int signal_strength_level) override; void RemoveDevice(const std::string& device_id) override; private: diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index a7a2f80cf5ed..ccd9b619c213 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -20,6 +20,7 @@ #include "base/json/json_writer.h" #include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/threading/thread_task_runner_handle.h" #include "brightray/browser/inspectable_web_contents.h" #include "brightray/browser/inspectable_web_contents_view.h" #include "components/prefs/pref_service.h" @@ -604,7 +605,7 @@ void NativeWindow::DidFirstVisuallyNonEmptyPaint() { view->SetSize(GetContentSize()); // Emit the ReadyToShow event in next tick in case of pending drawing work. - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr())); } @@ -635,7 +636,7 @@ void NativeWindow::ScheduleUnresponsiveEvent(int ms) { window_unresposive_closure_.Reset( base::Bind(&NativeWindow::NotifyWindowUnresponsive, weak_factory_.GetWeakPtr())); - base::MessageLoop::current()->PostDelayedTask( + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, window_unresposive_closure_.callback(), base::TimeDelta::FromMilliseconds(ms)); diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index 0da43fa5a3dd..2ba3f8e35781 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -232,7 +232,7 @@ int AtomNetworkDelegate::OnBeforeURLRequest( net::URLRequest* request, const net::CompletionCallback& callback, GURL* new_url) { - if (!ContainsKey(response_listeners_, kOnBeforeRequest)) + if (!base::ContainsKey(response_listeners_, kOnBeforeRequest)) return brightray::NetworkDelegate::OnBeforeURLRequest( request, callback, new_url); @@ -253,7 +253,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction( headers->SetHeader( DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId, client_id); - if (!ContainsKey(response_listeners_, kOnBeforeSendHeaders)) + if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders)) return brightray::NetworkDelegate::OnBeforeStartTransaction( request, callback, headers); @@ -264,7 +264,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction( void AtomNetworkDelegate::OnStartTransaction( net::URLRequest* request, const net::HttpRequestHeaders& headers) { - if (!ContainsKey(simple_listeners_, kOnSendHeaders)) { + if (!base::ContainsKey(simple_listeners_, kOnSendHeaders)) { brightray::NetworkDelegate::OnStartTransaction(request, headers); return; } @@ -278,7 +278,7 @@ int AtomNetworkDelegate::OnHeadersReceived( const net::HttpResponseHeaders* original, scoped_refptr* override, GURL* allowed) { - if (!ContainsKey(response_listeners_, kOnHeadersReceived)) + if (!base::ContainsKey(response_listeners_, kOnHeadersReceived)) return brightray::NetworkDelegate::OnHeadersReceived( request, callback, original, override, allowed); @@ -289,7 +289,7 @@ int AtomNetworkDelegate::OnHeadersReceived( void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) { - if (!ContainsKey(simple_listeners_, kOnBeforeRedirect)) { + if (!base::ContainsKey(simple_listeners_, kOnBeforeRedirect)) { brightray::NetworkDelegate::OnBeforeRedirect(request, new_location); return; } @@ -300,7 +300,7 @@ void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, } void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) { - if (!ContainsKey(simple_listeners_, kOnResponseStarted)) { + if (!base::ContainsKey(simple_listeners_, kOnResponseStarted)) { brightray::NetworkDelegate::OnResponseStarted(request); return; } @@ -329,7 +329,7 @@ void AtomNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) { return; } - if (!ContainsKey(simple_listeners_, kOnCompleted)) { + if (!base::ContainsKey(simple_listeners_, kOnCompleted)) { brightray::NetworkDelegate::OnCompleted(request, started); return; } @@ -344,7 +344,7 @@ void AtomNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) { void AtomNetworkDelegate::OnErrorOccurred( net::URLRequest* request, bool started) { - if (!ContainsKey(simple_listeners_, kOnErrorOccurred)) { + if (!base::ContainsKey(simple_listeners_, kOnErrorOccurred)) { brightray::NetworkDelegate::OnCompleted(request, started); return; } @@ -399,7 +399,7 @@ template void AtomNetworkDelegate::OnListenerResultInIO( uint64_t id, T out, std::unique_ptr response) { // The request has been destroyed. - if (!ContainsKey(callbacks_, id)) + if (!base::ContainsKey(callbacks_, id)) return; ReadFromResponseObject(*response.get(), out); diff --git a/atom/browser/net/atom_url_request_job_factory.cc b/atom/browser/net/atom_url_request_job_factory.cc index 7e2eb95149ca..92c4eb40a975 100644 --- a/atom/browser/net/atom_url_request_job_factory.cc +++ b/atom/browser/net/atom_url_request_job_factory.cc @@ -36,7 +36,7 @@ bool AtomURLRequestJobFactory::SetProtocolHandler( return true; } - if (ContainsKey(protocol_handler_map_, scheme)) + if (base::ContainsKey(protocol_handler_map_, scheme)) return false; protocol_handler_map_[scheme] = protocol_handler.release(); return true; @@ -45,8 +45,8 @@ bool AtomURLRequestJobFactory::SetProtocolHandler( bool AtomURLRequestJobFactory::InterceptProtocol( const std::string& scheme, std::unique_ptr protocol_handler) { - if (!ContainsKey(protocol_handler_map_, scheme) || - ContainsKey(original_protocols_, scheme)) + if (!base::ContainsKey(protocol_handler_map_, scheme) || + base::ContainsKey(original_protocols_, scheme)) return false; ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme]; protocol_handler_map_[scheme] = protocol_handler.release(); @@ -74,11 +74,11 @@ ProtocolHandler* AtomURLRequestJobFactory::GetProtocolHandler( bool AtomURLRequestJobFactory::HasProtocolHandler( const std::string& scheme) const { - return ContainsKey(protocol_handler_map_, scheme); + return base::ContainsKey(protocol_handler_map_, scheme); } void AtomURLRequestJobFactory::Clear() { - STLDeleteValues(&protocol_handler_map_); + base::STLDeleteValues(&protocol_handler_map_); } net::URLRequestJob* AtomURLRequestJobFactory::MaybeCreateJobWithProtocolHandler( diff --git a/atom/browser/node_debugger.cc b/atom/browser/node_debugger.cc index 55025dd69f72..e95369fba190 100644 --- a/atom/browser/node_debugger.cc +++ b/atom/browser/node_debugger.cc @@ -51,8 +51,9 @@ NodeDebugger::NodeDebugger(v8::Isolate* isolate) base::StringToInt(port_str, &port); isolate_->SetData(kIsolateSlot, this); - v8::Debug::SetMessageHandler(DebugMessageHandler); + v8::Debug::SetMessageHandler(isolate_, DebugMessageHandler); + weak_up_ui_handle_.data = this; uv_async_init(uv_default_loop(), &weak_up_ui_handle_, ProcessMessageInUI); // Start a new IO thread. @@ -64,7 +65,7 @@ NodeDebugger::NodeDebugger(v8::Isolate* isolate) } // Start the server in new IO thread. - thread_.message_loop()->PostTask( + thread_.task_runner()->PostTask( FROM_HERE, base::Bind(&NodeDebugger::StartServer, weak_factory_.GetWeakPtr(), port)); @@ -126,7 +127,8 @@ void NodeDebugger::SendConnectMessage() { // static void NodeDebugger::ProcessMessageInUI(uv_async_t* handle) { - v8::Debug::ProcessDebugMessages(); + NodeDebugger* self = static_cast(handle->data); + v8::Debug::ProcessDebugMessages(self->isolate_); } // static @@ -136,7 +138,7 @@ void NodeDebugger::DebugMessageHandler(const v8::Debug::Message& message) { if (self) { std::string message8(*v8::String::Utf8Value(message.GetJSON())); - self->thread_.message_loop()->PostTask( + self->thread_.task_runner()->PostTask( FROM_HERE, base::Bind(&NodeDebugger::SendMessage, self->weak_factory_.GetWeakPtr(), message8)); diff --git a/atom/browser/osr/osr_render_widget_host_view.cc b/atom/browser/osr/osr_render_widget_host_view.cc index 24e647c95b23..84a14910793b 100644 --- a/atom/browser/osr/osr_render_widget_host_view.cc +++ b/atom/browser/osr/osr_render_widget_host_view.cc @@ -302,8 +302,8 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient { const base::Closure& callback) : callback_(callback) { time_source_.reset(new cc::DelayBasedTimeSource( - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::UI).get())); + content::BrowserThread::GetTaskRunnerForThread( + content::BrowserThread::UI).get())); time_source_->SetClient(this); } @@ -548,6 +548,10 @@ bool OffScreenRenderWidgetHostView::LockMouse() { void OffScreenRenderWidgetHostView::UnlockMouse() { } +void OffScreenRenderWidgetHostView::SetNeedsBeginFrames( + bool needs_begin_frames) { +} + void OffScreenRenderWidgetHostView::OnSwapCompositorFrame( uint32_t output_surface_id, cc::CompositorFrame frame) { @@ -678,22 +682,6 @@ bool OffScreenRenderWidgetHostView::HasAcceleratedSurface(const gfx::Size &) { return false; } -void OffScreenRenderWidgetHostView::GetScreenInfo( - blink::WebScreenInfo* results) { - results->rect = gfx::Rect(size_); - results->availableRect = gfx::Rect(size_); - results->depth = 24; - results->depthPerComponent = 8; - results->deviceScaleFactor = scale_factor_; - results->orientationAngle = 0; - results->orientationType = blink::WebScreenOrientationLandscapePrimary; -} - -bool OffScreenRenderWidgetHostView::GetScreenColorProfile( - blink::WebVector*) { - return false; -} - gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() { return gfx::Rect(size_); } @@ -716,12 +704,7 @@ gfx::Size OffScreenRenderWidgetHostView::GetRequestedRendererSize() const { return size_; } -int OffScreenRenderWidgetHostView:: - DelegatedFrameHostGetGpuMemoryBufferClientId() - const { - return render_widget_host_->GetProcess()->GetID(); -} - +#if !defined(OS_MACOSX) ui::Layer* OffScreenRenderWidgetHostView::DelegatedFrameHostGetLayer() const { return const_cast(root_layer_.get()); } @@ -754,19 +737,14 @@ void OffScreenRenderWidgetHostView::DelegatedFrameHostResizeLockWasReleased() { return render_widget_host_->WasResized(); } -void OffScreenRenderWidgetHostView::DelegatedFrameHostSendCompositorSwapAck( - int output_surface_id, const cc::CompositorFrameAck& ack) { - render_widget_host_->Send(new ViewMsg_SwapCompositorFrameAck( - render_widget_host_->GetRoutingID(), - output_surface_id, ack)); -} - -void OffScreenRenderWidgetHostView:: - DelegatedFrameHostSendReclaimCompositorResources( - int output_surface_id, const cc::CompositorFrameAck& ack) { +void +OffScreenRenderWidgetHostView::DelegatedFrameHostSendReclaimCompositorResources( + int output_surface_id, + bool is_swap_ack, + const cc::ReturnedResourceArray& resources) { render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources( - render_widget_host_->GetRoutingID(), - output_surface_id, ack)); + render_widget_host_->GetRoutingID(), output_surface_id, is_swap_ack, + resources)); } void OffScreenRenderWidgetHostView:: @@ -783,6 +761,12 @@ void OffScreenRenderWidgetHostView::SetBeginFrameSource( cc::BeginFrameSource* source) { } +bool OffScreenRenderWidgetHostView::IsAutoResizeEnabled() const { + return render_widget_host_->auto_resize_enabled(); +} + +#endif // !defined(OS_MACOSX) + std::unique_ptr OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice( ui::Compositor* compositor) { diff --git a/atom/browser/osr/osr_render_widget_host_view.h b/atom/browser/osr/osr_render_widget_host_view.h index edd1ce990c57..86c62d071256 100644 --- a/atom/browser/osr/osr_render_widget_host_view.h +++ b/atom/browser/osr/osr_render_widget_host_view.h @@ -61,7 +61,9 @@ class MacHelper; class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase, public ui::CompositorDelegate, +#if !defined(OS_MACOSX) public content::DelegatedFrameHostClient, +#endif public NativeWindowObserver { public: OffScreenRenderWidgetHostView(bool transparent, @@ -92,6 +94,7 @@ class OffScreenRenderWidgetHostView void SetBackgroundColor(SkColor color) override; bool LockMouse(void) override; void UnlockMouse(void) override; + void SetNeedsBeginFrames(bool needs_begin_frames) override; #if defined(OS_MACOSX) ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override; void SetActive(bool active) override; @@ -137,8 +140,6 @@ class OffScreenRenderWidgetHostView std::unique_ptr) override; void EndFrameSubscription() override; bool HasAcceleratedSurface(const gfx::Size &) override; - void GetScreenInfo(blink::WebScreenInfo *) override; - bool GetScreenColorProfile(blink::WebVector*); gfx::Rect GetBoundsInRootWindow(void) override; void LockCompositingSurface(void) override; void UnlockCompositingSurface(void) override; @@ -147,6 +148,7 @@ class OffScreenRenderWidgetHostView gfx::Size GetPhysicalBackingSize() const override; gfx::Size GetRequestedRendererSize() const override; +#if !defined(OS_MACOSX) // content::DelegatedFrameHostClient: int DelegatedFrameHostGetGpuMemoryBufferClientId(void) const; ui::Layer *DelegatedFrameHostGetLayer(void) const override; @@ -157,14 +159,15 @@ class OffScreenRenderWidgetHostView std::unique_ptr DelegatedFrameHostCreateResizeLock( bool defer_compositor_lock) override; void DelegatedFrameHostResizeLockWasReleased(void) override; - void DelegatedFrameHostSendCompositorSwapAck( - int, const cc::CompositorFrameAck &) override; void DelegatedFrameHostSendReclaimCompositorResources( - int, const cc::CompositorFrameAck &) override; + int output_surface_id, + bool is_swap_ack, + const cc::ReturnedResourceArray& resources) override; void DelegatedFrameHostOnLostCompositorResources(void) override; void DelegatedFrameHostUpdateVSyncParameters( const base::TimeTicks &, const base::TimeDelta &) override; void SetBeginFrameSource(cc::BeginFrameSource* source) override; +#endif // !defined(OS_MACOSX) // ui::CompositorDelegate: std::unique_ptr CreateSoftwareOutputDevice( 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 505243b8a9ff..527a39df02f9 100644 --- a/atom/browser/osr/osr_render_widget_host_view_mac.mm +++ b/atom/browser/osr/osr_render_widget_host_view_mac.mm @@ -38,18 +38,13 @@ class MacHelper : 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 { + bool is_swap_ack, + const cc::ReturnedResourceArray& resources) override { view_->render_widget_host()->Send(new ViewMsg_ReclaimCompositorResources( - view_->render_widget_host()->GetRoutingID(), output_surface_id, ack)); + view_->render_widget_host()->GetRoutingID(), output_surface_id, + is_swap_ack, resources)); } void BrowserCompositorMacOnLostCompositorResources() override { diff --git a/atom/browser/osr/osr_web_contents_view.cc b/atom/browser/osr/osr_web_contents_view.cc index 35aa7dcc3a7a..b07c9603223d 100644 --- a/atom/browser/osr/osr_web_contents_view.cc +++ b/atom/browser/osr/osr_web_contents_view.cc @@ -106,6 +106,10 @@ void OffScreenWebContentsView::RenderViewSwappedIn( void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) { } +void OffScreenWebContentsView::GetScreenInfo( + blink::WebScreenInfo* web_screen_info) const { +} + #if defined(OS_MACOSX) void OffScreenWebContentsView::SetAllowOtherViews(bool allow) { } diff --git a/atom/browser/osr/osr_web_contents_view.h b/atom/browser/osr/osr_web_contents_view.h index d47f71b1e90a..08e1d731e354 100644 --- a/atom/browser/osr/osr_web_contents_view.h +++ b/atom/browser/osr/osr_web_contents_view.h @@ -51,6 +51,7 @@ class OffScreenWebContentsView : public content::WebContentsView, void RenderViewCreated(content::RenderViewHost* host) override; void RenderViewSwappedIn(content::RenderViewHost* host) override; void SetOverscrollControllerEnabled(bool enabled) override; + void GetScreenInfo(blink::WebScreenInfo* web_screen_info) const override; #if defined(OS_MACOSX) void SetAllowOtherViews(bool allow) override; diff --git a/atom/browser/ui/accelerator_util.cc b/atom/browser/ui/accelerator_util.cc index b71ba1310b35..9ebc4e108496 100644 --- a/atom/browser/ui/accelerator_util.cc +++ b/atom/browser/ui/accelerator_util.cc @@ -88,7 +88,7 @@ void GenerateAcceleratorTable(AcceleratorTable* table, bool TriggerAcceleratorTableCommand(AcceleratorTable* table, const ui::Accelerator& accelerator) { - if (ContainsKey(*table, accelerator)) { + if (base::ContainsKey(*table, accelerator)) { const accelerator_util::MenuItem& item = (*table)[accelerator]; if (item.model->IsEnabledAt(item.position)) { item.model->ActivatedAt(item.position); diff --git a/atom/browser/ui/atom_menu_model.h b/atom/browser/ui/atom_menu_model.h index 887f6123bcca..e7d6fc92c00e 100644 --- a/atom/browser/ui/atom_menu_model.h +++ b/atom/browser/ui/atom_menu_model.h @@ -26,7 +26,7 @@ class AtomMenuModel : public ui::SimpleMenuModel { private: // ui::SimpleMenuModel::Delegate: bool GetAcceleratorForCommandId(int command_id, - ui::Accelerator* accelerator) { + ui::Accelerator* accelerator) const { return GetAcceleratorForCommandIdWithParams( command_id, false, accelerator); } diff --git a/atom/browser/web_contents_permission_helper.cc b/atom/browser/web_contents_permission_helper.cc index 73405b571934..2c79270591b8 100644 --- a/atom/browser/web_contents_permission_helper.cc +++ b/atom/browser/web_contents_permission_helper.cc @@ -60,7 +60,7 @@ void WebContentsPermissionHelper::RequestPermission( web_contents_->GetBrowserContext()->GetPermissionManager()); auto origin = web_contents_->GetLastCommittedURL(); permission_manager->RequestPermission( - permission, rfh, origin, + permission, rfh, origin, false, base::Bind(&OnPermissionResponse, callback)); } diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 23f834e8e39a..05ee1e3ffc91 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -198,12 +198,6 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( if (!visible) // Default state is visible. command_line->AppendSwitch(switches::kHiddenPage); } - - // Use frame scheduling for offscreen renderers. - // TODO(zcbenz): Remove this after Chrome 54, on which it becomes default. - bool offscreen; - if (web_preferences.GetBoolean("offscreen", &offscreen) && offscreen) - command_line->AppendSwitch(cc::switches::kEnableBeginFrameScheduling); } bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) { diff --git a/atom/browser/web_view_manager.cc b/atom/browser/web_view_manager.cc index 815e60a166ca..96201b994ce8 100644 --- a/atom/browser/web_view_manager.cc +++ b/atom/browser/web_view_manager.cc @@ -29,7 +29,7 @@ void WebViewManager::AddGuest(int guest_instance_id, } void WebViewManager::RemoveGuest(int guest_instance_id) { - if (!ContainsKey(web_contents_embedder_map_, guest_instance_id)) + if (!base::ContainsKey(web_contents_embedder_map_, guest_instance_id)) return; web_contents_embedder_map_.erase(guest_instance_id); @@ -43,7 +43,7 @@ void WebViewManager::RemoveGuest(int guest_instance_id) { } content::WebContents* WebViewManager::GetEmbedder(int guest_instance_id) { - if (ContainsKey(web_contents_embedder_map_, guest_instance_id)) + if (base::ContainsKey(web_contents_embedder_map_, guest_instance_id)) return web_contents_embedder_map_[guest_instance_id].embedder; else return nullptr; @@ -53,11 +53,11 @@ content::WebContents* WebViewManager::GetGuestByInstanceID( int owner_process_id, int element_instance_id) { ElementInstanceKey key(owner_process_id, element_instance_id); - if (!ContainsKey(element_instance_id_to_guest_map_, key)) + if (!base::ContainsKey(element_instance_id_to_guest_map_, key)) return nullptr; int guest_instance_id = element_instance_id_to_guest_map_[key]; - if (ContainsKey(web_contents_embedder_map_, guest_instance_id)) + if (base::ContainsKey(web_contents_embedder_map_, guest_instance_id)) return web_contents_embedder_map_[guest_instance_id].web_contents; else return nullptr; diff --git a/atom/common/native_mate_converters/blink_converter.cc b/atom/common/native_mate_converters/blink_converter.cc index 950b4f5f0a91..0021e8738380 100644 --- a/atom/common/native_mate_converters/blink_converter.cc +++ b/atom/common/native_mate_converters/blink_converter.cc @@ -90,11 +90,11 @@ struct Converter { blink::WebMouseEvent::Button* out) { std::string button = base::ToLowerASCII(V8ToString(val)); if (button == "left") - *out = blink::WebMouseEvent::Button::ButtonLeft; + *out = blink::WebMouseEvent::Button::Left; else if (button == "middle") - *out = blink::WebMouseEvent::Button::ButtonMiddle; + *out = blink::WebMouseEvent::Button::Middle; else if (button == "right") - *out = blink::WebMouseEvent::Button::ButtonRight; + *out = blink::WebMouseEvent::Button::Right; else return false; return true; @@ -176,7 +176,6 @@ bool Converter::FromV8( out->windowsKeyCode = keyCode; if (shifted) out->modifiers |= blink::WebInputEvent::ShiftKey; - out->setKeyIdentifierFromWindowsKeyCode(); ui::DomCode domCode = ui::UsLayoutKeyboardCodeToDomCode(keyCode); out->domCode = static_cast(domCode); @@ -246,7 +245,7 @@ bool Converter::FromV8( if (!dict.Get("x", &out->x) || !dict.Get("y", &out->y)) return false; if (!dict.Get("button", &out->button)) - out->button = blink::WebMouseEvent::Button::ButtonLeft; + out->button = blink::WebMouseEvent::Button::Left; dict.Get("globalX", &out->globalX); dict.Get("globalY", &out->globalY); dict.Get("movementX", &out->movementX); diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index ca9931fd9fec..40f53520e8b1 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -15,8 +15,9 @@ #include "base/command_line.h" #include "base/environment.h" #include "base/files/file_path.h" -#include "base/message_loop/message_loop.h" #include "base/path_service.h" +#include "base/run_loop.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/trace_event.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_paths.h" @@ -99,7 +100,6 @@ base::FilePath GetResourcesPath(bool is_browser) { NodeBindings::NodeBindings(bool is_browser) : is_browser_(is_browser), - message_loop_(nullptr), uv_loop_(uv_default_loop()), embed_closed_(false), uv_env_(nullptr), @@ -210,7 +210,7 @@ void NodeBindings::RunMessageLoop() { DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI)); // The MessageLoop should have been created, remember the one in main thread. - message_loop_ = base::MessageLoop::current(); + task_runner_ = base::ThreadTaskRunnerHandle::Get(); // Run uv loop for once to give the uv__io_poll a chance to add all events. UvRunOnce(); @@ -242,16 +242,16 @@ void NodeBindings::UvRunOnce() { TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); if (r == 0) - message_loop_->QuitWhenIdle(); // Quit from uv. + base::RunLoop().QuitWhenIdle(); // Quit from uv. // Tell the worker thread to continue polling. uv_sem_post(&embed_sem_); } void NodeBindings::WakeupMainThread() { - DCHECK(message_loop_); - message_loop_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce, - weak_factory_.GetWeakPtr())); + DCHECK(task_runner_); + task_runner_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce, + weak_factory_.GetWeakPtr())); } void NodeBindings::WakeupEmbedThread() { diff --git a/atom/common/node_bindings.h b/atom/common/node_bindings.h index 16d512d3bed0..4866ba25f060 100644 --- a/atom/common/node_bindings.h +++ b/atom/common/node_bindings.h @@ -64,7 +64,7 @@ class NodeBindings { bool is_browser_; // Main thread's MessageLoop. - base::MessageLoop* message_loop_; + scoped_refptr task_runner_; // Main thread's libuv loop. uv_loop_t* uv_loop_; diff --git a/atom/renderer/api/atom_api_spell_check_client.cc b/atom/renderer/api/atom_api_spell_check_client.cc index 08f36efce581..9a07cbf6eaa4 100644 --- a/atom/renderer/api/atom_api_spell_check_client.cc +++ b/atom/renderer/api/atom_api_spell_check_client.cc @@ -64,19 +64,6 @@ void SpellCheckClient::spellCheck( } } -void SpellCheckClient::checkTextOfParagraph( - const blink::WebString& text, - blink::WebTextCheckingTypeMask mask, - blink::WebVector* results) { - if (!results) - return; - - if (!(mask & blink::WebTextCheckingTypeSpelling)) - return; - - NOTREACHED() << "checkTextOfParagraph should never be called"; -} - void SpellCheckClient::requestCheckingOfText( const blink::WebString& textToCheck, const blink::WebVector& markersInText, diff --git a/atom/renderer/api/atom_api_spell_check_client.h b/atom/renderer/api/atom_api_spell_check_client.h index af72756e2ec1..aa6abb0f56b2 100644 --- a/atom/renderer/api/atom_api_spell_check_client.h +++ b/atom/renderer/api/atom_api_spell_check_client.h @@ -32,10 +32,6 @@ class SpellCheckClient : public blink::WebSpellCheckClient { int& misspelledOffset, int& misspelledLength, blink::WebVector* optionalSuggestions) override; - void checkTextOfParagraph( - const blink::WebString&, - blink::WebTextCheckingTypeMask mask, - blink::WebVector* results) override; void requestCheckingOfText( const blink::WebString& textToCheck, const blink::WebVector& markersInText, diff --git a/atom/renderer/guest_view_container.cc b/atom/renderer/guest_view_container.cc index 5a22e3f1215e..82bcc8625635 100644 --- a/atom/renderer/guest_view_container.cc +++ b/atom/renderer/guest_view_container.cc @@ -8,7 +8,7 @@ #include "base/bind.h" #include "base/lazy_instance.h" -#include "base/message_loop/message_loop.h" +#include "base/threading/thread_task_runner_handle.h" #include "ui/gfx/geometry/size.h" namespace atom { @@ -53,7 +53,7 @@ void GuestViewContainer::DidResizeElement(const gfx::Size& new_size) { if (element_resize_callback_.is_null()) return; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(element_resize_callback_, new_size)); } diff --git a/atom/utility/atom_content_utility_client.cc b/atom/utility/atom_content_utility_client.cc index 8d4ccf628933..4be5a5f3fd7d 100644 --- a/atom/utility/atom_content_utility_client.cc +++ b/atom/utility/atom_content_utility_client.cc @@ -49,7 +49,8 @@ void AtomContentUtilityClient::UtilityThreadStarted() { bool AtomContentUtilityClient::OnMessageReceived( const IPC::Message& message) { - if (filter_messages_ && !ContainsKey(message_id_whitelist_, message.type())) + if (filter_messages_ && + !base::ContainsKey(message_id_whitelist_, message.type())) return false; bool handled = true; diff --git a/chromium_src/chrome/browser/printing/print_job.cc b/chromium_src/chrome/browser/printing/print_job.cc index 87971055e68f..1707a6f684a7 100644 --- a/chromium_src/chrome/browser/printing/print_job.cc +++ b/chromium_src/chrome/browser/printing/print_job.cc @@ -7,7 +7,9 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/message_loop/message_loop.h" +#include "base/run_loop.h" #include "base/threading/thread_restrictions.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/threading/worker_pool.h" #include "base/timer/timer.h" #include "chrome/browser/chrome_notification_types.h" @@ -196,12 +198,13 @@ bool PrintJob::FlushJob(base::TimeDelta timeout) { // Make sure the object outlive this message loop. scoped_refptr handle(this); - base::MessageLoop::current()->PostDelayedTask(FROM_HERE, - base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()), timeout); + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()), + timeout); base::MessageLoop::ScopedNestableTaskAllower allow( base::MessageLoop::current()); - base::MessageLoop::current()->Run(); + base::RunLoop().Run(); return true; } @@ -362,7 +365,7 @@ void PrintJob::OnNotifyPrintJobEvent(const JobEventDetails& event_details) { } case JobEventDetails::DOC_DONE: { // This will call Stop() and broadcast a JOB_DONE message. - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&PrintJob::OnDocumentDone, this)); break; } diff --git a/chromium_src/chrome/browser/printing/print_job_worker.cc b/chromium_src/chrome/browser/printing/print_job_worker.cc index 7a88a8570c42..4a39272c9900 100644 --- a/chromium_src/chrome/browser/printing/print_job_worker.cc +++ b/chromium_src/chrome/browser/printing/print_job_worker.cc @@ -9,6 +9,7 @@ #include "base/callback.h" #include "base/compiler_specific.h" #include "base/message_loop/message_loop.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" @@ -278,7 +279,7 @@ void PrintJobWorker::OnNewPage() { scoped_refptr page = document_->GetPage(page_number_.ToInt()); if (!page.get()) { // We need to wait for the page to be available. - base::MessageLoop::current()->PostDelayedTask( + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&PrintJobWorker::OnNewPage, weak_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(500)); 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 0638bd5c4d44..e61cc10d5364 100644 --- a/chromium_src/chrome/browser/printing/print_view_manager_base.cc +++ b/chromium_src/chrome/browser/printing/print_view_manager_base.cc @@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/memory/ref_counted_memory.h" +#include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/timer/timer.h" #include "components/prefs/pref_service.h" @@ -424,7 +425,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { { base::MessageLoop::ScopedNestableTaskAllower allow( base::MessageLoop::current()); - base::MessageLoop::current()->Run(); + base::RunLoop().Run(); } bool success = true; diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc index c77c8f00f807..d40ad53dd17d 100644 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc +++ b/chromium_src/chrome/browser/renderer_host/pepper/pepper_broker_message_filter.cc @@ -32,7 +32,7 @@ PepperBrokerMessageFilter::~PepperBrokerMessageFilter() {} scoped_refptr PepperBrokerMessageFilter::OverrideTaskRunnerForMessage( const IPC::Message& message) { - return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); + return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); } int32_t PepperBrokerMessageFilter::OnResourceMessageReceived( diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc index 4e66d772ec38..20f4957a3b5f 100644 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc +++ b/chromium_src/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc @@ -110,16 +110,16 @@ PepperFlashClipboardMessageFilter::OverrideTaskRunnerForMessage( // restrictions of various platform APIs. In general, the clipboard is not // thread-safe, so all clipboard calls should be serviced from the UI thread. if (msg.type() == PpapiHostMsg_FlashClipboard_WriteData::ID) - return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); + return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); // Windows needs clipboard reads to be serviced from the IO thread because // these are sync IPCs which can result in deadlocks with plugins if serviced // from the UI thread. Note that Windows clipboard calls ARE thread-safe so it // is ok for reads and writes to be serviced from different threads. #if !defined(OS_WIN) - return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); + return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); #else - return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); + return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); #endif } diff --git a/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc b/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc index 10c07906af9b..c6173e113667 100644 --- a/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc +++ b/chromium_src/chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc @@ -54,7 +54,7 @@ PepperIsolatedFileSystemMessageFilter::OverrideTaskRunnerForMessage( const IPC::Message& msg) { // In order to reach ExtensionSystem, we need to get ProfileManager first. // ProfileManager lives in UI thread, so we need to do this in UI thread. - return content::BrowserThread::GetMessageLoopProxyForThread( + return content::BrowserThread::GetTaskRunnerForThread( content::BrowserThread::UI); } 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 3c2bf680d051..6fd28f6bb3af 100644 --- a/chromium_src/chrome/renderer/printing/print_web_view_helper.cc +++ b/chromium_src/chrome/renderer/printing/print_web_view_helper.cc @@ -24,6 +24,7 @@ #include "net/base/escape.h" #include "printing/pdf_metafile_skia.h" #include "printing/units.h" +#include "third_party/WebKit/public/platform/WebDoubleSize.h" #include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" #include "third_party/WebKit/public/web/WebConsoleMessage.h" @@ -69,15 +70,15 @@ bool PrintMsg_Print_Params_IsValid(const PrintMsg_Print_Params& params) { } PrintMsg_Print_Params GetCssPrintParams( - blink::WebFrame* frame, + blink::WebLocalFrame* frame, int page_index, const PrintMsg_Print_Params& page_params) { PrintMsg_Print_Params page_css_params = page_params; int dpi = GetDPI(&page_params); - blink::WebSize page_size_in_pixels( - ConvertUnit(page_params.page_size.width(), dpi, kPixelsPerInch), - ConvertUnit(page_params.page_size.height(), dpi, kPixelsPerInch)); + blink::WebDoubleSize page_size_in_pixels( + ConvertUnitDouble(page_params.page_size.width(), dpi, kPixelsPerInch), + ConvertUnitDouble(page_params.page_size.height(), dpi, kPixelsPerInch)); int margin_top_in_pixels = ConvertUnit(page_params.margin_top, dpi, kPixelsPerInch); int margin_right_in_pixels = ConvertUnit( @@ -92,8 +93,6 @@ PrintMsg_Print_Params GetCssPrintParams( page_params.margin_left, dpi, kPixelsPerInch); - blink::WebSize original_page_size_in_pixels = page_size_in_pixels; - if (frame) { frame->pageSizeAndMarginsInPixels(page_index, page_size_in_pixels, @@ -103,9 +102,9 @@ PrintMsg_Print_Params GetCssPrintParams( margin_left_in_pixels); } - int new_content_width = page_size_in_pixels.width - + double new_content_width = page_size_in_pixels.width() - margin_left_in_pixels - margin_right_in_pixels; - int new_content_height = page_size_in_pixels.height - + double new_content_height = page_size_in_pixels.height() - margin_top_in_pixels - margin_bottom_in_pixels; // Invalid page size and/or margins. We just use the default setting. @@ -115,20 +114,12 @@ PrintMsg_Print_Params GetCssPrintParams( return page_css_params; } - page_css_params.content_size = gfx::Size( - ConvertUnit(new_content_width, kPixelsPerInch, dpi), - ConvertUnit(new_content_height, kPixelsPerInch, dpi)); - - if (original_page_size_in_pixels != page_size_in_pixels) { - page_css_params.page_size = gfx::Size( - ConvertUnit(page_size_in_pixels.width, kPixelsPerInch, dpi), - ConvertUnit(page_size_in_pixels.height, kPixelsPerInch, dpi)); - } else { - // Printing frame doesn't have any page size css. Pixels to dpi conversion - // causes rounding off errors. Therefore use the default page size values - // directly. - page_css_params.page_size = page_params.page_size; - } + page_css_params.page_size = + gfx::Size(ConvertUnit(page_size_in_pixels.width(), kPixelsPerInch, dpi), + ConvertUnit(page_size_in_pixels.height(), kPixelsPerInch, dpi)); + page_css_params.content_size = + gfx::Size(ConvertUnit(new_content_width, kPixelsPerInch, dpi), + ConvertUnit(new_content_height, kPixelsPerInch, dpi)); page_css_params.margin_top = ConvertUnit(margin_top_in_pixels, kPixelsPerInch, dpi); @@ -274,7 +265,7 @@ MarginType GetMarginsForPdf(blink::WebFrame* frame, } PrintMsg_Print_Params CalculatePrintParamsForCss( - blink::WebFrame* frame, + blink::WebLocalFrame* frame, int page_index, const PrintMsg_Print_Params& page_params, bool ignore_css_margins, @@ -429,7 +420,6 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient, const blink::WebString& unique_name, blink::WebSandboxFlags sandbox_flags, const blink::WebFrameOwnerProperties& frame_owner_properties) override; - void frameDetached(blink::WebFrame* frame, DetachType type) override; private: void CallOnReady(); @@ -567,10 +557,9 @@ void PrepareFrameAndViewForPrint::didStopLoading() { DCHECK(!on_ready_.is_null()); // Don't call callback here, because it can delete |this| and WebView that is // called didStopLoading. - base::MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, - weak_ptr_factory_.GetWeakPtr())); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, + weak_ptr_factory_.GetWeakPtr())); } blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( @@ -585,14 +574,6 @@ blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( return frame; } -void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame, - DetachType type) { - DCHECK(type == DetachType::Remove); - if (frame->parent()) - frame->parent()->removeChild(frame); - frame->close(); -} - void PrepareFrameAndViewForPrint::CallOnReady() { return on_ready_.Run(); // Can delete |this|. } @@ -640,6 +621,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view) print_node_in_progress_(false), is_loading_(false), is_scripted_preview_delayed_(false), + ipc_nesting_level_(0), weak_ptr_factory_(this) { } @@ -653,6 +635,15 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame, } bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { + // The class is not designed to handle recursive messages. This is not + // expected during regular flow. However, during rendering of content for + // printing, lower level code may run nested message loop. E.g. PDF may has + // script to show message box http://crbug.com/502562. In that moment browser + // may receive updated printer capabilities and decide to restart print + // preview generation. When this happened message handling function may + // choose to ignore message or safely crash process. + ++ipc_nesting_level_; + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message) IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) @@ -660,6 +651,8 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + + --ipc_nesting_level_; return handled; } @@ -667,28 +660,14 @@ void PrintWebViewHelper::OnDestruct() { delete this; } -bool PrintWebViewHelper::GetPrintFrame(blink::WebLocalFrame** frame) { - DCHECK(frame); - blink::WebView* webView = render_view()->GetWebView(); - DCHECK(webView); - if (!webView) - return false; - - // If the user has selected text in the currently focused frame we print - // only that frame (this makes print selection work for multiple frames). - blink::WebLocalFrame* focusedFrame = - webView->focusedFrame()->toWebLocalFrame(); - *frame = focusedFrame->hasSelection() - ? focusedFrame - : webView->mainFrame()->toWebLocalFrame(); - return true; -} - #if !defined(DISABLE_BASIC_PRINTING) void PrintWebViewHelper::OnPrintPages(bool silent, bool print_background) { - blink::WebLocalFrame* frame; - if (GetPrintFrame(&frame)) - Print(frame, blink::WebNode(), silent, print_background); + if (ipc_nesting_level_> 1) + return; + + blink::WebLocalFrame* frame = + render_view()->GetMainRenderFrame()->GetWebFrame(); + Print(frame, blink::WebNode(), silent, print_background); } #endif // !DISABLE_BASIC_PRINTING @@ -725,22 +704,25 @@ void PrintWebViewHelper::OnPrintingDone(bool success) { } void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) { - blink::WebLocalFrame* frame; - if (GetPrintFrame(&frame)) { - print_preview_context_.InitWithFrame(frame); - if (!print_preview_context_.source_frame()) { - DidFinishPrinting(FAIL_PREVIEW); - return; - } + if (ipc_nesting_level_ > 1) + return; - if (!UpdatePrintSettings(print_preview_context_.source_frame(), - print_preview_context_.source_node(), settings)) { - DidFinishPrinting(FAIL_PREVIEW); - return; - } - is_print_ready_metafile_sent_ = false; - PrepareFrameForPreviewDocument(); + blink::WebLocalFrame* frame = + render_view()->GetMainRenderFrame()->GetWebFrame(); + + print_preview_context_.InitWithFrame(frame); + if (!print_preview_context_.source_frame()) { + DidFinishPrinting(FAIL_PREVIEW); + return; } + + if (!UpdatePrintSettings(print_preview_context_.source_frame(), + print_preview_context_.source_node(), settings)) { + DidFinishPrinting(FAIL_PREVIEW); + return; + } + is_print_ready_metafile_sent_ = false; + PrepareFrameForPreviewDocument(); } void PrintWebViewHelper::PrepareFrameForPreviewDocument() { @@ -972,7 +954,7 @@ void PrintWebViewHelper::FinishFramePrinting() { } #if defined(OS_MACOSX) -bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, +bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame, int page_count) { const PrintMsg_PrintPages_Params& params = *print_pages_params_; const PrintMsg_Print_Params& print_params = params.params; @@ -999,7 +981,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, // static - Not anonymous so that platform implementations can use it. void PrintWebViewHelper::ComputePageLayoutInPointsForCss( - blink::WebFrame* frame, + blink::WebLocalFrame* frame, int page_index, const PrintMsg_Print_Params& page_params, bool ignore_css_margins, @@ -1120,7 +1102,7 @@ bool PrintWebViewHelper::UpdatePrintSettings( } -bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebFrame* frame, +bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame, const blink::WebNode& node, int expected_pages_count) { PrintHostMsg_ScriptedPrint_Params params; 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 b748a6b6fb00..f91f7f3cb809 100644 --- a/chromium_src/chrome/renderer/printing/print_web_view_helper.h +++ b/chromium_src/chrome/renderer/printing/print_web_view_helper.h @@ -163,7 +163,7 @@ class PrintWebViewHelper // Get final print settings from the user. // Return false if the user cancels or on error. - bool GetPrintSettingsFromUser(blink::WebFrame* frame, + bool GetPrintSettingsFromUser(blink::WebLocalFrame* frame, const blink::WebNode& node, int expected_pages_count); @@ -171,23 +171,23 @@ class PrintWebViewHelper void OnFramePreparedForPrintPages(); void PrintPages(); - bool PrintPagesNative(blink::WebFrame* frame, int page_count); + bool PrintPagesNative(blink::WebLocalFrame* frame, int page_count); void FinishFramePrinting(); // Prints the page listed in |params|. #if defined(OS_LINUX) || defined(OS_ANDROID) void PrintPageInternal(const PrintMsg_PrintPage_Params& params, - blink::WebFrame* frame, + blink::WebLocalFrame* frame, PdfMetafileSkia* metafile); #elif defined(OS_WIN) void PrintPageInternal(const PrintMsg_PrintPage_Params& params, - blink::WebFrame* frame, + blink::WebLocalFrame* frame, PdfMetafileSkia* metafile, gfx::Size* page_size_in_dpi, gfx::Rect* content_area_in_dpi); #else void PrintPageInternal(const PrintMsg_PrintPage_Params& params, - blink::WebFrame* frame); + blink::WebLocalFrame* frame); #endif // Render the frame for printing. @@ -198,7 +198,7 @@ class PrintWebViewHelper #if defined(OS_MACOSX) void RenderPage(const PrintMsg_Print_Params& params, int page_number, - blink::WebFrame* frame, + blink::WebLocalFrame* frame, bool is_preview, PdfMetafileSkia* metafile, gfx::Size* page_size, @@ -223,15 +223,13 @@ class PrintWebViewHelper // Helper method to get page layout in points and fit to page if needed. static void ComputePageLayoutInPointsForCss( - blink::WebFrame* frame, + blink::WebLocalFrame* frame, int page_index, const PrintMsg_Print_Params& default_params, bool ignore_css_margins, double* scale_factor, PageSizeMargins* page_layout_in_points); - bool GetPrintFrame(blink::WebLocalFrame** frame); - // Script Initiated Printing ------------------------------------------------ // Notifies the browser a print preview page has been rendered. @@ -373,6 +371,7 @@ class PrintWebViewHelper bool print_node_in_progress_; bool is_loading_; bool is_scripted_preview_delayed_; + int ipc_nesting_level_; PrintPreviewContext print_preview_context_; diff --git a/chromium_src/chrome/renderer/printing/print_web_view_helper_linux.cc b/chromium_src/chrome/renderer/printing/print_web_view_helper_linux.cc index 4df052561afe..197baedc2f12 100644 --- a/chromium_src/chrome/renderer/printing/print_web_view_helper_linux.cc +++ b/chromium_src/chrome/renderer/printing/print_web_view_helper_linux.cc @@ -22,7 +22,7 @@ namespace printing { -using blink::WebFrame; +using blink::WebLocalFrame; bool PrintWebViewHelper::RenderPreviewPage( int page_number, @@ -56,7 +56,7 @@ bool PrintWebViewHelper::RenderPreviewPage( return PreviewPageRendered(page_number, draft_metafile.get()); } -bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, +bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame, int page_count) { PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); if (!metafile.Init()) @@ -113,7 +113,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, void PrintWebViewHelper::PrintPageInternal( const PrintMsg_PrintPage_Params& params, - WebFrame* frame, + WebLocalFrame* frame, PdfMetafileSkia* metafile) { PageSizeMargins page_layout_in_points; double scale_factor = 1.0f; 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 9425bf2e4b23..341b89717be4 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 @@ -18,11 +18,11 @@ namespace printing { -using blink::WebFrame; +using blink::WebLocalFrame; void PrintWebViewHelper::PrintPageInternal( const PrintMsg_PrintPage_Params& params, - WebFrame* frame) { + WebLocalFrame* frame) { PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); CHECK(metafile.Init()); @@ -89,7 +89,7 @@ bool PrintWebViewHelper::RenderPreviewPage( void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, int page_number, - WebFrame* frame, + WebLocalFrame* frame, bool is_preview, PdfMetafileSkia* metafile, gfx::Size* page_size, diff --git a/chromium_src/chrome/renderer/printing/print_web_view_helper_pdf_win.cc b/chromium_src/chrome/renderer/printing/print_web_view_helper_pdf_win.cc index 6c31313f0d60..e96a2b8339a5 100644 --- a/chromium_src/chrome/renderer/printing/print_web_view_helper_pdf_win.cc +++ b/chromium_src/chrome/renderer/printing/print_web_view_helper_pdf_win.cc @@ -20,7 +20,7 @@ namespace printing { -using blink::WebFrame; +using blink::WebLocalFrame; bool PrintWebViewHelper::RenderPreviewPage( int page_number, @@ -55,7 +55,7 @@ bool PrintWebViewHelper::RenderPreviewPage( return PreviewPageRendered(page_number, draft_metafile.get()); } -bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, +bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame, int page_count) { PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE); if (!metafile.Init()) @@ -122,7 +122,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, void PrintWebViewHelper::PrintPageInternal( const PrintMsg_PrintPage_Params& params, - WebFrame* frame, + WebLocalFrame* frame, PdfMetafileSkia* metafile, gfx::Size* page_size_in_dpi, gfx::Rect* content_area_in_dpi) {