Update files for Chrome 54 API changes
This commit is contained in:
parent
bdc334d797
commit
497f5a1199
52 changed files with 275 additions and 298 deletions
|
@ -55,7 +55,7 @@ int NodeMain(int argc, char *argv[]) {
|
||||||
// Start our custom debugger implementation.
|
// Start our custom debugger implementation.
|
||||||
NodeDebugger node_debugger(gin_env.isolate());
|
NodeDebugger node_debugger(gin_env.isolate());
|
||||||
if (node_debugger.IsRunning())
|
if (node_debugger.IsRunning())
|
||||||
env->AssignToContext(v8::Debug::GetDebugContext());
|
env->AssignToContext(v8::Debug::GetDebugContext(gin_env.isolate()));
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
mate::Dictionary process(gin_env.isolate(), env->process_object());
|
mate::Dictionary process(gin_env.isolate(), env->process_object());
|
||||||
|
|
|
@ -312,8 +312,21 @@ struct Converter<Browser::LoginItemSettings> {
|
||||||
return dict.GetHandle();
|
return dict.GetHandle();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace mate
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct Converter<content::CertificateRequestResultType> {
|
||||||
|
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> 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 {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -573,8 +586,8 @@ void App::AllowCertificateError(
|
||||||
bool overridable,
|
bool overridable,
|
||||||
bool strict_enforcement,
|
bool strict_enforcement,
|
||||||
bool expired_previous_decision,
|
bool expired_previous_decision,
|
||||||
const base::Callback<void(bool)>& callback,
|
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||||
content::CertificateRequestResultType* request) {
|
callback) {
|
||||||
v8::Locker locker(isolate());
|
v8::Locker locker(isolate());
|
||||||
v8::HandleScope handle_scope(isolate());
|
v8::HandleScope handle_scope(isolate());
|
||||||
bool prevent_default = Emit("certificate-error",
|
bool prevent_default = Emit("certificate-error",
|
||||||
|
@ -586,7 +599,7 @@ void App::AllowCertificateError(
|
||||||
|
|
||||||
// Deny the certificate by default.
|
// Deny the certificate by default.
|
||||||
if (!prevent_default)
|
if (!prevent_default)
|
||||||
*request = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
|
callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::SelectClientCertificate(
|
void App::SelectClientCertificate(
|
||||||
|
|
|
@ -98,8 +98,8 @@ class App : public AtomBrowserClient::Delegate,
|
||||||
bool overridable,
|
bool overridable,
|
||||||
bool strict_enforcement,
|
bool strict_enforcement,
|
||||||
bool expired_previous_decision,
|
bool expired_previous_decision,
|
||||||
const base::Callback<void(bool)>& callback,
|
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||||
content::CertificateRequestResultType* request) override;
|
callback) override;
|
||||||
void SelectClientCertificate(
|
void SelectClientCertificate(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
net::SSLCertRequestInfo* cert_request_info,
|
net::SSLCertRequestInfo* cert_request_info,
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
#include "atom/common/native_mate_converters/callback.h"
|
#include "atom/common/native_mate_converters/callback.h"
|
||||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||||
#include "atom/common/native_mate_converters/gurl_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/strings/utf_string_conversions.h"
|
||||||
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "net/base/filename_util.h"
|
#include "net/base/filename_util.h"
|
||||||
|
|
||||||
|
@ -80,7 +80,8 @@ void DownloadItem::OnDownloadUpdated(content::DownloadItem* item) {
|
||||||
Emit("done", item->GetState());
|
Emit("done", item->GetState());
|
||||||
|
|
||||||
// Destroy the item once item is downloaded.
|
// Destroy the item once item is downloaded.
|
||||||
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
|
FROM_HERE, GetDestroyClosure());
|
||||||
} else {
|
} else {
|
||||||
Emit("updated", item->GetState());
|
Emit("updated", item->GetState());
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
|
|
||||||
|
using content::BrowserThread;
|
||||||
|
|
||||||
namespace mate {
|
namespace mate {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
@ -76,10 +78,8 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() {
|
||||||
new_blocker_type,
|
new_blocker_type,
|
||||||
device::PowerSaveBlocker::kReasonOther,
|
device::PowerSaveBlocker::kReasonOther,
|
||||||
ATOM_PRODUCT_NAME,
|
ATOM_PRODUCT_NAME,
|
||||||
content::BrowserThread::GetMessageLoopProxyForThread(
|
BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
|
||||||
content::BrowserThread::UI),
|
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)));
|
||||||
content::BrowserThread::GetMessageLoopProxyForThread(
|
|
||||||
content::BrowserThread::FILE)));
|
|
||||||
power_save_blocker_.swap(new_blocker);
|
power_save_blocker_.swap(new_blocker);
|
||||||
current_blocker_type_ = new_blocker_type;
|
current_blocker_type_ = new_blocker_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,8 +254,8 @@ class ResolveProxyHelper {
|
||||||
|
|
||||||
// Start the request.
|
// Start the request.
|
||||||
int result = proxy_service->ResolveProxy(
|
int result = proxy_service->ResolveProxy(
|
||||||
url, "GET", net::LOAD_NORMAL, &proxy_info_, completion_callback,
|
url, "GET", &proxy_info_, completion_callback, &pac_req_, nullptr,
|
||||||
&pac_req_, nullptr, net::BoundNetLog());
|
net::BoundNetLog());
|
||||||
|
|
||||||
// Completed synchronously.
|
// Completed synchronously.
|
||||||
if (result != net::ERR_IO_PENDING)
|
if (result != net::ERR_IO_PENDING)
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "atom/common/native_mate_converters/image_converter.h"
|
#include "atom/common/native_mate_converters/image_converter.h"
|
||||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "native_mate/constructor.h"
|
#include "native_mate/constructor.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "ui/gfx/image/image.h"
|
#include "ui/gfx/image/image.h"
|
||||||
|
@ -71,7 +72,8 @@ Tray::Tray(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
|
||||||
|
|
||||||
Tray::~Tray() {
|
Tray::~Tray() {
|
||||||
// Destroy the native tray in next tick.
|
// 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
|
// static
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "atom/common/native_mate_converters/value_converter.h"
|
#include "atom/common/native_mate_converters/value_converter.h"
|
||||||
#include "atom/common/options_switches.h"
|
#include "atom/common/options_switches.h"
|
||||||
#include "base/strings/utf_string_conversions.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.h"
|
||||||
#include "brightray/browser/inspectable_web_contents_view.h"
|
#include "brightray/browser/inspectable_web_contents_view.h"
|
||||||
#include "chrome/browser/printing/print_preview_message_handler.h"
|
#include "chrome/browser/printing/print_preview_message_handler.h"
|
||||||
|
@ -830,7 +831,8 @@ void WebContents::WebContentsDestroyed() {
|
||||||
Emit("destroyed");
|
Emit("destroyed");
|
||||||
|
|
||||||
// Destroy the native class in next tick.
|
// Destroy the native class in next tick.
|
||||||
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
|
FROM_HERE, GetDestroyClosure());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::NavigationEntryCommitted(
|
void WebContents::NavigationEntryCommitted(
|
||||||
|
@ -976,7 +978,7 @@ std::string WebContents::GetUserAgent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::InsertCSS(const std::string& css) {
|
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,
|
bool WebContents::SavePage(const base::FilePath& full_file_path,
|
||||||
|
@ -1066,7 +1068,8 @@ void WebContents::InspectElement(int x, int y) {
|
||||||
OpenDevTools(nullptr);
|
OpenDevTools(nullptr);
|
||||||
scoped_refptr<content::DevToolsAgentHost> agent(
|
scoped_refptr<content::DevToolsAgentHost> agent(
|
||||||
content::DevToolsAgentHost::GetOrCreateFor(web_contents()));
|
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() {
|
void WebContents::InspectServiceWorker() {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||||
#include "atom/common/options_switches.h"
|
#include "atom/common/options_switches.h"
|
||||||
#include "base/command_line.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/browser/render_process_host.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "native_mate/constructor.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
|
// Destroy the native window in next tick because the native code might be
|
||||||
// iterating all windows.
|
// 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) {
|
void Window::WillCloseWindow(bool* prevent_default) {
|
||||||
|
@ -185,7 +186,8 @@ void Window::OnWindowClosed() {
|
||||||
RemoveFromParentChildWindows();
|
RemoveFromParentChildWindows();
|
||||||
|
|
||||||
// Destroy the native class when window is closed.
|
// 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() {
|
void Window::OnWindowBlur() {
|
||||||
|
|
|
@ -73,7 +73,7 @@ void AtomBlobReader::StartReading(
|
||||||
|
|
||||||
auto blob_reader = blob_data_handle->CreateReader(
|
auto blob_reader = blob_data_handle->CreateReader(
|
||||||
file_system_context_.get(),
|
file_system_context_.get(),
|
||||||
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get());
|
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get());
|
||||||
BlobReadHelper* blob_read_helper =
|
BlobReadHelper* blob_read_helper =
|
||||||
new BlobReadHelper(std::move(blob_reader), callback);
|
new BlobReadHelper(std::move(blob_reader), callback);
|
||||||
blob_read_helper->Read();
|
blob_read_helper->Read();
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include "atom/browser/api/atom_api_app.h"
|
#include "atom/browser/api/atom_api_app.h"
|
||||||
#include "atom/browser/api/atom_api_protocol.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_context.h"
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
#include "atom/browser/atom_quota_permission_context.h"
|
#include "atom/browser/atom_quota_permission_context.h"
|
||||||
|
@ -33,7 +32,6 @@
|
||||||
#include "content/common/resource_request_body_impl.h"
|
#include "content/common/resource_request_body_impl.h"
|
||||||
#include "content/public/browser/browser_ppapi_host.h"
|
#include "content/public/browser/browser_ppapi_host.h"
|
||||||
#include "content/public/browser/client_certificate_delegate.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_process_host.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/browser/resource_dispatcher_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.
|
// Custom schemes to be registered to handle service worker.
|
||||||
std::string g_custom_service_worker_schemes = "";
|
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<content::SiteInstance>) {
|
void Noop(scoped_refptr<content::SiteInstance>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +78,7 @@ AtomBrowserClient::~AtomBrowserClient() {
|
||||||
content::WebContents* AtomBrowserClient::GetWebContentsFromProcessID(
|
content::WebContents* AtomBrowserClient::GetWebContentsFromProcessID(
|
||||||
int process_id) {
|
int process_id) {
|
||||||
// If the process is a pending process, we should use the old one.
|
// 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];
|
process_id = pending_processes_[process_id];
|
||||||
|
|
||||||
// Certain render process will be created with no associated render view,
|
// Certain render process will be created with no associated render view,
|
||||||
|
@ -160,11 +145,6 @@ content::SpeechRecognitionManagerDelegate*
|
||||||
return new AtomSpeechRecognitionManagerDelegate;
|
return new AtomSpeechRecognitionManagerDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::GeolocationDelegate*
|
|
||||||
AtomBrowserClient::CreateGeolocationDelegate() {
|
|
||||||
return new AtomGeolocationDelegate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AtomBrowserClient::OverrideWebkitPrefs(
|
void AtomBrowserClient::OverrideWebkitPrefs(
|
||||||
content::RenderViewHost* host, content::WebPreferences* prefs) {
|
content::RenderViewHost* host, content::WebPreferences* prefs) {
|
||||||
prefs->javascript_enabled = true;
|
prefs->javascript_enabled = true;
|
||||||
|
@ -283,13 +263,13 @@ void AtomBrowserClient::AllowCertificateError(
|
||||||
bool overridable,
|
bool overridable,
|
||||||
bool strict_enforcement,
|
bool strict_enforcement,
|
||||||
bool expired_previous_decision,
|
bool expired_previous_decision,
|
||||||
const base::Callback<void(bool)>& callback,
|
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||||
content::CertificateRequestResultType* request) {
|
callback) {
|
||||||
if (delegate_) {
|
if (delegate_) {
|
||||||
delegate_->AllowCertificateError(
|
delegate_->AllowCertificateError(
|
||||||
web_contents, cert_error, ssl_info, request_url,
|
web_contents, cert_error, ssl_info, request_url,
|
||||||
resource_type, overridable, strict_enforcement,
|
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& opener_top_level_frame_url,
|
||||||
const GURL& source_origin,
|
const GURL& source_origin,
|
||||||
WindowContainerType container_type,
|
WindowContainerType container_type,
|
||||||
const std::string& frame_name,
|
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
|
const std::string& frame_name,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const blink::WebWindowFeatures& features,
|
const blink::WebWindowFeatures& features,
|
||||||
const std::vector<base::string16>& additional_features,
|
const std::vector<base::string16>& additional_features,
|
||||||
|
|
|
@ -50,7 +50,6 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
||||||
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
||||||
content::SpeechRecognitionManagerDelegate*
|
content::SpeechRecognitionManagerDelegate*
|
||||||
CreateSpeechRecognitionManagerDelegate() override;
|
CreateSpeechRecognitionManagerDelegate() override;
|
||||||
device::GeolocationDelegate* CreateGeolocationDelegate() override;
|
|
||||||
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
|
void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
|
||||||
content::WebPreferences* prefs) override;
|
content::WebPreferences* prefs) override;
|
||||||
std::string GetApplicationLocale() override;
|
std::string GetApplicationLocale() override;
|
||||||
|
@ -72,8 +71,8 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
||||||
bool overridable,
|
bool overridable,
|
||||||
bool strict_enforcement,
|
bool strict_enforcement,
|
||||||
bool expired_previous_decision,
|
bool expired_previous_decision,
|
||||||
const base::Callback<void(bool)>& callback,
|
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||||
content::CertificateRequestResultType* request) override;
|
callback) override;
|
||||||
void SelectClientCertificate(
|
void SelectClientCertificate(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
net::SSLCertRequestInfo* cert_request_info,
|
net::SSLCertRequestInfo* cert_request_info,
|
||||||
|
@ -84,9 +83,9 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
||||||
const GURL& opener_top_level_frame_url,
|
const GURL& opener_top_level_frame_url,
|
||||||
const GURL& source_origin,
|
const GURL& source_origin,
|
||||||
WindowContainerType container_type,
|
WindowContainerType container_type,
|
||||||
const std::string& frame_name,
|
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
|
const std::string& frame_name,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const blink::WebWindowFeatures& features,
|
const blink::WebWindowFeatures& features,
|
||||||
const std::vector<base::string16>& additional_features,
|
const std::vector<base::string16>& additional_features,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
|
|
||||||
#include "atom/browser/api/trackable_object.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_client.h"
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/bridge_task_runner.h"
|
#include "atom/browser/bridge_task_runner.h"
|
||||||
|
@ -18,6 +19,8 @@
|
||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "content/public/browser/child_process_security_policy.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"
|
#include "v8/include/v8-debug.h"
|
||||||
|
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
|
@ -27,11 +30,28 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// A provider of Geolocation services to override AccessTokenStore.
|
||||||
|
class AtomGeolocationDelegate : public device::GeolocationDelegate {
|
||||||
|
public:
|
||||||
|
AtomGeolocationDelegate() = default;
|
||||||
|
|
||||||
|
scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final {
|
||||||
|
return new AtomAccessTokenStore();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate);
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void Erase(T* container, typename T::iterator iter) {
|
void Erase(T* container, typename T::iterator iter) {
|
||||||
container->erase(iter);
|
container->erase(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
// static
|
// static
|
||||||
AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr;
|
AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr;
|
||||||
|
|
||||||
|
@ -115,7 +135,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
|
||||||
|
|
||||||
// Make sure node can get correct environment when debugging.
|
// Make sure node can get correct environment when debugging.
|
||||||
if (node_debugger_->IsRunning())
|
if (node_debugger_->IsRunning())
|
||||||
env->AssignToContext(v8::Debug::GetDebugContext());
|
env->AssignToContext(v8::Debug::GetDebugContext(js_env_->isolate()));
|
||||||
|
|
||||||
// Add Electron extended APIs.
|
// Add Electron extended APIs.
|
||||||
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
|
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
|
||||||
|
@ -171,6 +191,8 @@ void AtomBrowserMainParts::PostMainMessageLoopStart() {
|
||||||
#if defined(OS_POSIX)
|
#if defined(OS_POSIX)
|
||||||
HandleShutdownSignals();
|
HandleShutdownSignals();
|
||||||
#endif
|
#endif
|
||||||
|
device::GeolocationProvider::SetGeolocationDelegate(
|
||||||
|
new AtomGeolocationDelegate());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomBrowserMainParts::PostMainMessageLoopRun() {
|
void AtomBrowserMainParts::PostMainMessageLoopRun() {
|
||||||
|
|
|
@ -51,6 +51,7 @@ int AtomPermissionManager::RequestPermission(
|
||||||
content::PermissionType permission,
|
content::PermissionType permission,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
|
bool user_gesture,
|
||||||
const ResponseCallback& response_callback) {
|
const ResponseCallback& response_callback) {
|
||||||
int process_id = render_frame_host->GetProcess()->GetID();
|
int process_id = render_frame_host->GetProcess()->GetID();
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ int AtomPermissionManager::RequestPermissions(
|
||||||
const std::vector<content::PermissionType>& permissions,
|
const std::vector<content::PermissionType>& permissions,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
|
bool user_gesture,
|
||||||
const base::Callback<void(
|
const base::Callback<void(
|
||||||
const std::vector<blink::mojom::PermissionStatus>&)>& callback) {
|
const std::vector<blink::mojom::PermissionStatus>&)>& callback) {
|
||||||
// FIXME(zcbenz): Just ignore multiple permissions request for now.
|
// FIXME(zcbenz): Just ignore multiple permissions request for now.
|
||||||
|
|
|
@ -37,13 +37,17 @@ class AtomPermissionManager : public content::PermissionManager {
|
||||||
content::PermissionType permission,
|
content::PermissionType permission,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
const ResponseCallback& callback) override;
|
bool user_gesture,
|
||||||
|
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
|
||||||
|
override;
|
||||||
int RequestPermissions(
|
int RequestPermissions(
|
||||||
const std::vector<content::PermissionType>& permissions,
|
const std::vector<content::PermissionType>& permissions,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
|
bool user_gesture,
|
||||||
const base::Callback<void(
|
const base::Callback<void(
|
||||||
const std::vector<blink::mojom::PermissionStatus>&)>& callback) override;
|
const std::vector<blink::mojom::PermissionStatus>&)>& callback)
|
||||||
|
override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnPermissionResponse(int request_id,
|
void OnPermissionResponse(int request_id,
|
||||||
|
|
|
@ -91,14 +91,9 @@ void AtomSecurityStateModelClient::GetVisibleSecurityState(
|
||||||
state->connection_status = ssl.connection_status;
|
state->connection_status = ssl.connection_status;
|
||||||
state->security_bits = ssl.security_bits;
|
state->security_bits = ssl.security_bits;
|
||||||
state->sct_verify_statuses.clear();
|
state->sct_verify_statuses.clear();
|
||||||
state->sct_verify_statuses.insert(state->sct_verify_statuses.end(),
|
state->sct_verify_statuses.insert(state->sct_verify_statuses.begin(),
|
||||||
ssl.num_unknown_scts,
|
ssl.sct_statuses.begin(),
|
||||||
net::ct::SCT_STATUS_LOG_UNKNOWN);
|
ssl.sct_statuses.end());
|
||||||
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->displayed_mixed_content =
|
state->displayed_mixed_content =
|
||||||
(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT)
|
(ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT)
|
||||||
? true
|
? true
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "atom/browser/window_list.h"
|
#include "atom/browser/window_list.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "brightray/browser/brightray_paths.h"
|
#include "brightray/browser/brightray_paths.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -85,7 +85,7 @@ void Browser::Shutdown() {
|
||||||
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
|
FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit());
|
||||||
|
|
||||||
if (base::MessageLoop::current()) {
|
if (base::MessageLoop::current()) {
|
||||||
base::MessageLoop::current()->PostTask(
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
|
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
|
||||||
} else {
|
} else {
|
||||||
// There is no message loop available so we are in early stage.
|
// There is no message loop available so we are in early stage.
|
||||||
|
|
|
@ -331,14 +331,14 @@ content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
|
||||||
|
|
||||||
explanations->ran_insecure_content =
|
explanations->ran_insecure_content =
|
||||||
security_info.mixed_content_status ==
|
security_info.mixed_content_status ==
|
||||||
SecurityStateModel::RAN_MIXED_CONTENT ||
|
security_state::SecurityStateModel::CONTENT_STATUS_RAN ||
|
||||||
security_info.mixed_content_status ==
|
security_info.mixed_content_status ==
|
||||||
SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT;
|
security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN;
|
||||||
explanations->displayed_insecure_content =
|
explanations->displayed_insecure_content =
|
||||||
security_info.mixed_content_status ==
|
security_info.mixed_content_status ==
|
||||||
SecurityStateModel::DISPLAYED_MIXED_CONTENT ||
|
security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED ||
|
||||||
security_info.mixed_content_status ==
|
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)) {
|
if (net::IsCertStatusError(security_info.cert_status)) {
|
||||||
std::string error_string = net::ErrorToString(
|
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;
|
return security_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,12 @@ void BluetoothChooser::ShowDiscoveryState(DiscoveryState state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothChooser::AddDevice(const std::string& device_id,
|
void BluetoothChooser::AddOrUpdateDevice(const std::string& device_id,
|
||||||
const base::string16& device_name) {
|
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};
|
DeviceInfo info = {device_id, device_name};
|
||||||
device_list_.push_back(info);
|
device_list_.push_back(info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,12 @@ class BluetoothChooser : public content::BluetoothChooser {
|
||||||
// content::BluetoothChooser:
|
// content::BluetoothChooser:
|
||||||
void SetAdapterPresence(AdapterPresence presence) override;
|
void SetAdapterPresence(AdapterPresence presence) override;
|
||||||
void ShowDiscoveryState(DiscoveryState state) override;
|
void ShowDiscoveryState(DiscoveryState state) override;
|
||||||
void AddDevice(const std::string& device_id,
|
void AddOrUpdateDevice(const std::string& device_id,
|
||||||
const base::string16& device_name) override;
|
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;
|
void RemoveDevice(const std::string& device_id) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
#include "base/strings/utf_string_conversions.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.h"
|
||||||
#include "brightray/browser/inspectable_web_contents_view.h"
|
#include "brightray/browser/inspectable_web_contents_view.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
|
@ -604,7 +605,7 @@ void NativeWindow::DidFirstVisuallyNonEmptyPaint() {
|
||||||
view->SetSize(GetContentSize());
|
view->SetSize(GetContentSize());
|
||||||
|
|
||||||
// Emit the ReadyToShow event in next tick in case of pending drawing work.
|
// Emit the ReadyToShow event in next tick in case of pending drawing work.
|
||||||
base::MessageLoop::current()->PostTask(
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr()));
|
base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
@ -635,7 +636,7 @@ void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
|
||||||
window_unresposive_closure_.Reset(
|
window_unresposive_closure_.Reset(
|
||||||
base::Bind(&NativeWindow::NotifyWindowUnresponsive,
|
base::Bind(&NativeWindow::NotifyWindowUnresponsive,
|
||||||
weak_factory_.GetWeakPtr()));
|
weak_factory_.GetWeakPtr()));
|
||||||
base::MessageLoop::current()->PostDelayedTask(
|
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
window_unresposive_closure_.callback(),
|
window_unresposive_closure_.callback(),
|
||||||
base::TimeDelta::FromMilliseconds(ms));
|
base::TimeDelta::FromMilliseconds(ms));
|
||||||
|
|
|
@ -232,7 +232,7 @@ int AtomNetworkDelegate::OnBeforeURLRequest(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
const net::CompletionCallback& callback,
|
||||||
GURL* new_url) {
|
GURL* new_url) {
|
||||||
if (!ContainsKey(response_listeners_, kOnBeforeRequest))
|
if (!base::ContainsKey(response_listeners_, kOnBeforeRequest))
|
||||||
return brightray::NetworkDelegate::OnBeforeURLRequest(
|
return brightray::NetworkDelegate::OnBeforeURLRequest(
|
||||||
request, callback, new_url);
|
request, callback, new_url);
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction(
|
||||||
headers->SetHeader(
|
headers->SetHeader(
|
||||||
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId,
|
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId,
|
||||||
client_id);
|
client_id);
|
||||||
if (!ContainsKey(response_listeners_, kOnBeforeSendHeaders))
|
if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders))
|
||||||
return brightray::NetworkDelegate::OnBeforeStartTransaction(
|
return brightray::NetworkDelegate::OnBeforeStartTransaction(
|
||||||
request, callback, headers);
|
request, callback, headers);
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ int AtomNetworkDelegate::OnBeforeStartTransaction(
|
||||||
void AtomNetworkDelegate::OnStartTransaction(
|
void AtomNetworkDelegate::OnStartTransaction(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::HttpRequestHeaders& headers) {
|
const net::HttpRequestHeaders& headers) {
|
||||||
if (!ContainsKey(simple_listeners_, kOnSendHeaders)) {
|
if (!base::ContainsKey(simple_listeners_, kOnSendHeaders)) {
|
||||||
brightray::NetworkDelegate::OnStartTransaction(request, headers);
|
brightray::NetworkDelegate::OnStartTransaction(request, headers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ int AtomNetworkDelegate::OnHeadersReceived(
|
||||||
const net::HttpResponseHeaders* original,
|
const net::HttpResponseHeaders* original,
|
||||||
scoped_refptr<net::HttpResponseHeaders>* override,
|
scoped_refptr<net::HttpResponseHeaders>* override,
|
||||||
GURL* allowed) {
|
GURL* allowed) {
|
||||||
if (!ContainsKey(response_listeners_, kOnHeadersReceived))
|
if (!base::ContainsKey(response_listeners_, kOnHeadersReceived))
|
||||||
return brightray::NetworkDelegate::OnHeadersReceived(
|
return brightray::NetworkDelegate::OnHeadersReceived(
|
||||||
request, callback, original, override, allowed);
|
request, callback, original, override, allowed);
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ int AtomNetworkDelegate::OnHeadersReceived(
|
||||||
|
|
||||||
void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
|
void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
|
||||||
const GURL& new_location) {
|
const GURL& new_location) {
|
||||||
if (!ContainsKey(simple_listeners_, kOnBeforeRedirect)) {
|
if (!base::ContainsKey(simple_listeners_, kOnBeforeRedirect)) {
|
||||||
brightray::NetworkDelegate::OnBeforeRedirect(request, new_location);
|
brightray::NetworkDelegate::OnBeforeRedirect(request, new_location);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) {
|
void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) {
|
||||||
if (!ContainsKey(simple_listeners_, kOnResponseStarted)) {
|
if (!base::ContainsKey(simple_listeners_, kOnResponseStarted)) {
|
||||||
brightray::NetworkDelegate::OnResponseStarted(request);
|
brightray::NetworkDelegate::OnResponseStarted(request);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ void AtomNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ContainsKey(simple_listeners_, kOnCompleted)) {
|
if (!base::ContainsKey(simple_listeners_, kOnCompleted)) {
|
||||||
brightray::NetworkDelegate::OnCompleted(request, started);
|
brightray::NetworkDelegate::OnCompleted(request, started);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ void AtomNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
|
||||||
|
|
||||||
void AtomNetworkDelegate::OnErrorOccurred(
|
void AtomNetworkDelegate::OnErrorOccurred(
|
||||||
net::URLRequest* request, bool started) {
|
net::URLRequest* request, bool started) {
|
||||||
if (!ContainsKey(simple_listeners_, kOnErrorOccurred)) {
|
if (!base::ContainsKey(simple_listeners_, kOnErrorOccurred)) {
|
||||||
brightray::NetworkDelegate::OnCompleted(request, started);
|
brightray::NetworkDelegate::OnCompleted(request, started);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ template<typename T>
|
||||||
void AtomNetworkDelegate::OnListenerResultInIO(
|
void AtomNetworkDelegate::OnListenerResultInIO(
|
||||||
uint64_t id, T out, std::unique_ptr<base::DictionaryValue> response) {
|
uint64_t id, T out, std::unique_ptr<base::DictionaryValue> response) {
|
||||||
// The request has been destroyed.
|
// The request has been destroyed.
|
||||||
if (!ContainsKey(callbacks_, id))
|
if (!base::ContainsKey(callbacks_, id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ReadFromResponseObject(*response.get(), out);
|
ReadFromResponseObject(*response.get(), out);
|
||||||
|
|
|
@ -36,7 +36,7 @@ bool AtomURLRequestJobFactory::SetProtocolHandler(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ContainsKey(protocol_handler_map_, scheme))
|
if (base::ContainsKey(protocol_handler_map_, scheme))
|
||||||
return false;
|
return false;
|
||||||
protocol_handler_map_[scheme] = protocol_handler.release();
|
protocol_handler_map_[scheme] = protocol_handler.release();
|
||||||
return true;
|
return true;
|
||||||
|
@ -45,8 +45,8 @@ bool AtomURLRequestJobFactory::SetProtocolHandler(
|
||||||
bool AtomURLRequestJobFactory::InterceptProtocol(
|
bool AtomURLRequestJobFactory::InterceptProtocol(
|
||||||
const std::string& scheme,
|
const std::string& scheme,
|
||||||
std::unique_ptr<ProtocolHandler> protocol_handler) {
|
std::unique_ptr<ProtocolHandler> protocol_handler) {
|
||||||
if (!ContainsKey(protocol_handler_map_, scheme) ||
|
if (!base::ContainsKey(protocol_handler_map_, scheme) ||
|
||||||
ContainsKey(original_protocols_, scheme))
|
base::ContainsKey(original_protocols_, scheme))
|
||||||
return false;
|
return false;
|
||||||
ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme];
|
ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme];
|
||||||
protocol_handler_map_[scheme] = protocol_handler.release();
|
protocol_handler_map_[scheme] = protocol_handler.release();
|
||||||
|
@ -74,11 +74,11 @@ ProtocolHandler* AtomURLRequestJobFactory::GetProtocolHandler(
|
||||||
|
|
||||||
bool AtomURLRequestJobFactory::HasProtocolHandler(
|
bool AtomURLRequestJobFactory::HasProtocolHandler(
|
||||||
const std::string& scheme) const {
|
const std::string& scheme) const {
|
||||||
return ContainsKey(protocol_handler_map_, scheme);
|
return base::ContainsKey(protocol_handler_map_, scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomURLRequestJobFactory::Clear() {
|
void AtomURLRequestJobFactory::Clear() {
|
||||||
STLDeleteValues(&protocol_handler_map_);
|
base::STLDeleteValues(&protocol_handler_map_);
|
||||||
}
|
}
|
||||||
|
|
||||||
net::URLRequestJob* AtomURLRequestJobFactory::MaybeCreateJobWithProtocolHandler(
|
net::URLRequestJob* AtomURLRequestJobFactory::MaybeCreateJobWithProtocolHandler(
|
||||||
|
|
|
@ -51,8 +51,9 @@ NodeDebugger::NodeDebugger(v8::Isolate* isolate)
|
||||||
base::StringToInt(port_str, &port);
|
base::StringToInt(port_str, &port);
|
||||||
|
|
||||||
isolate_->SetData(kIsolateSlot, this);
|
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);
|
uv_async_init(uv_default_loop(), &weak_up_ui_handle_, ProcessMessageInUI);
|
||||||
|
|
||||||
// Start a new IO thread.
|
// Start a new IO thread.
|
||||||
|
@ -64,7 +65,7 @@ NodeDebugger::NodeDebugger(v8::Isolate* isolate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the server in new IO thread.
|
// Start the server in new IO thread.
|
||||||
thread_.message_loop()->PostTask(
|
thread_.task_runner()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&NodeDebugger::StartServer, weak_factory_.GetWeakPtr(),
|
base::Bind(&NodeDebugger::StartServer, weak_factory_.GetWeakPtr(),
|
||||||
port));
|
port));
|
||||||
|
@ -126,7 +127,8 @@ void NodeDebugger::SendConnectMessage() {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void NodeDebugger::ProcessMessageInUI(uv_async_t* handle) {
|
void NodeDebugger::ProcessMessageInUI(uv_async_t* handle) {
|
||||||
v8::Debug::ProcessDebugMessages();
|
NodeDebugger* self = static_cast<NodeDebugger*>(handle->data);
|
||||||
|
v8::Debug::ProcessDebugMessages(self->isolate_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@ -136,7 +138,7 @@ void NodeDebugger::DebugMessageHandler(const v8::Debug::Message& message) {
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
std::string message8(*v8::String::Utf8Value(message.GetJSON()));
|
std::string message8(*v8::String::Utf8Value(message.GetJSON()));
|
||||||
self->thread_.message_loop()->PostTask(
|
self->thread_.task_runner()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&NodeDebugger::SendMessage, self->weak_factory_.GetWeakPtr(),
|
base::Bind(&NodeDebugger::SendMessage, self->weak_factory_.GetWeakPtr(),
|
||||||
message8));
|
message8));
|
||||||
|
|
|
@ -302,7 +302,7 @@ class AtomBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
|
||||||
const base::Closure& callback)
|
const base::Closure& callback)
|
||||||
: callback_(callback) {
|
: callback_(callback) {
|
||||||
time_source_.reset(new cc::DelayBasedTimeSource(
|
time_source_.reset(new cc::DelayBasedTimeSource(
|
||||||
content::BrowserThread::GetMessageLoopProxyForThread(
|
content::BrowserThread::GetTaskRunnerForThread(
|
||||||
content::BrowserThread::UI).get()));
|
content::BrowserThread::UI).get()));
|
||||||
time_source_->SetClient(this);
|
time_source_->SetClient(this);
|
||||||
}
|
}
|
||||||
|
@ -548,6 +548,10 @@ bool OffScreenRenderWidgetHostView::LockMouse() {
|
||||||
void OffScreenRenderWidgetHostView::UnlockMouse() {
|
void OffScreenRenderWidgetHostView::UnlockMouse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OffScreenRenderWidgetHostView::SetNeedsBeginFrames(
|
||||||
|
bool needs_begin_frames) {
|
||||||
|
}
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
|
void OffScreenRenderWidgetHostView::OnSwapCompositorFrame(
|
||||||
uint32_t output_surface_id,
|
uint32_t output_surface_id,
|
||||||
cc::CompositorFrame frame) {
|
cc::CompositorFrame frame) {
|
||||||
|
@ -678,22 +682,6 @@ bool OffScreenRenderWidgetHostView::HasAcceleratedSurface(const gfx::Size &) {
|
||||||
return false;
|
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<char>*) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
|
gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
|
||||||
return gfx::Rect(size_);
|
return gfx::Rect(size_);
|
||||||
}
|
}
|
||||||
|
@ -716,12 +704,7 @@ gfx::Size OffScreenRenderWidgetHostView::GetRequestedRendererSize() const {
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int OffScreenRenderWidgetHostView::
|
#if !defined(OS_MACOSX)
|
||||||
DelegatedFrameHostGetGpuMemoryBufferClientId()
|
|
||||||
const {
|
|
||||||
return render_widget_host_->GetProcess()->GetID();
|
|
||||||
}
|
|
||||||
|
|
||||||
ui::Layer* OffScreenRenderWidgetHostView::DelegatedFrameHostGetLayer() const {
|
ui::Layer* OffScreenRenderWidgetHostView::DelegatedFrameHostGetLayer() const {
|
||||||
return const_cast<ui::Layer*>(root_layer_.get());
|
return const_cast<ui::Layer*>(root_layer_.get());
|
||||||
}
|
}
|
||||||
|
@ -754,19 +737,14 @@ void OffScreenRenderWidgetHostView::DelegatedFrameHostResizeLockWasReleased() {
|
||||||
return render_widget_host_->WasResized();
|
return render_widget_host_->WasResized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::DelegatedFrameHostSendCompositorSwapAck(
|
void
|
||||||
int output_surface_id, const cc::CompositorFrameAck& ack) {
|
OffScreenRenderWidgetHostView::DelegatedFrameHostSendReclaimCompositorResources(
|
||||||
render_widget_host_->Send(new ViewMsg_SwapCompositorFrameAck(
|
int output_surface_id,
|
||||||
render_widget_host_->GetRoutingID(),
|
bool is_swap_ack,
|
||||||
output_surface_id, ack));
|
const cc::ReturnedResourceArray& resources) {
|
||||||
}
|
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::
|
|
||||||
DelegatedFrameHostSendReclaimCompositorResources(
|
|
||||||
int output_surface_id, const cc::CompositorFrameAck& ack) {
|
|
||||||
render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources(
|
render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources(
|
||||||
render_widget_host_->GetRoutingID(),
|
render_widget_host_->GetRoutingID(), output_surface_id, is_swap_ack,
|
||||||
output_surface_id, ack));
|
resources));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::
|
void OffScreenRenderWidgetHostView::
|
||||||
|
@ -783,6 +761,12 @@ void OffScreenRenderWidgetHostView::SetBeginFrameSource(
|
||||||
cc::BeginFrameSource* source) {
|
cc::BeginFrameSource* source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OffScreenRenderWidgetHostView::IsAutoResizeEnabled() const {
|
||||||
|
return render_widget_host_->auto_resize_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
std::unique_ptr<cc::SoftwareOutputDevice>
|
std::unique_ptr<cc::SoftwareOutputDevice>
|
||||||
OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice(
|
OffScreenRenderWidgetHostView::CreateSoftwareOutputDevice(
|
||||||
ui::Compositor* compositor) {
|
ui::Compositor* compositor) {
|
||||||
|
|
|
@ -61,7 +61,9 @@ class MacHelper;
|
||||||
class OffScreenRenderWidgetHostView
|
class OffScreenRenderWidgetHostView
|
||||||
: public content::RenderWidgetHostViewBase,
|
: public content::RenderWidgetHostViewBase,
|
||||||
public ui::CompositorDelegate,
|
public ui::CompositorDelegate,
|
||||||
|
#if !defined(OS_MACOSX)
|
||||||
public content::DelegatedFrameHostClient,
|
public content::DelegatedFrameHostClient,
|
||||||
|
#endif
|
||||||
public NativeWindowObserver {
|
public NativeWindowObserver {
|
||||||
public:
|
public:
|
||||||
OffScreenRenderWidgetHostView(bool transparent,
|
OffScreenRenderWidgetHostView(bool transparent,
|
||||||
|
@ -92,6 +94,7 @@ class OffScreenRenderWidgetHostView
|
||||||
void SetBackgroundColor(SkColor color) override;
|
void SetBackgroundColor(SkColor color) override;
|
||||||
bool LockMouse(void) override;
|
bool LockMouse(void) override;
|
||||||
void UnlockMouse(void) override;
|
void UnlockMouse(void) override;
|
||||||
|
void SetNeedsBeginFrames(bool needs_begin_frames) override;
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
|
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
|
||||||
void SetActive(bool active) override;
|
void SetActive(bool active) override;
|
||||||
|
@ -137,8 +140,6 @@ class OffScreenRenderWidgetHostView
|
||||||
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber>) override;
|
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber>) override;
|
||||||
void EndFrameSubscription() override;
|
void EndFrameSubscription() override;
|
||||||
bool HasAcceleratedSurface(const gfx::Size &) override;
|
bool HasAcceleratedSurface(const gfx::Size &) override;
|
||||||
void GetScreenInfo(blink::WebScreenInfo *) override;
|
|
||||||
bool GetScreenColorProfile(blink::WebVector<char>*);
|
|
||||||
gfx::Rect GetBoundsInRootWindow(void) override;
|
gfx::Rect GetBoundsInRootWindow(void) override;
|
||||||
void LockCompositingSurface(void) override;
|
void LockCompositingSurface(void) override;
|
||||||
void UnlockCompositingSurface(void) override;
|
void UnlockCompositingSurface(void) override;
|
||||||
|
@ -147,6 +148,7 @@ class OffScreenRenderWidgetHostView
|
||||||
gfx::Size GetPhysicalBackingSize() const override;
|
gfx::Size GetPhysicalBackingSize() const override;
|
||||||
gfx::Size GetRequestedRendererSize() const override;
|
gfx::Size GetRequestedRendererSize() const override;
|
||||||
|
|
||||||
|
#if !defined(OS_MACOSX)
|
||||||
// content::DelegatedFrameHostClient:
|
// content::DelegatedFrameHostClient:
|
||||||
int DelegatedFrameHostGetGpuMemoryBufferClientId(void) const;
|
int DelegatedFrameHostGetGpuMemoryBufferClientId(void) const;
|
||||||
ui::Layer *DelegatedFrameHostGetLayer(void) const override;
|
ui::Layer *DelegatedFrameHostGetLayer(void) const override;
|
||||||
|
@ -157,14 +159,15 @@ class OffScreenRenderWidgetHostView
|
||||||
std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(
|
std::unique_ptr<content::ResizeLock> DelegatedFrameHostCreateResizeLock(
|
||||||
bool defer_compositor_lock) override;
|
bool defer_compositor_lock) override;
|
||||||
void DelegatedFrameHostResizeLockWasReleased(void) override;
|
void DelegatedFrameHostResizeLockWasReleased(void) override;
|
||||||
void DelegatedFrameHostSendCompositorSwapAck(
|
|
||||||
int, const cc::CompositorFrameAck &) override;
|
|
||||||
void DelegatedFrameHostSendReclaimCompositorResources(
|
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 DelegatedFrameHostOnLostCompositorResources(void) override;
|
||||||
void DelegatedFrameHostUpdateVSyncParameters(
|
void DelegatedFrameHostUpdateVSyncParameters(
|
||||||
const base::TimeTicks &, const base::TimeDelta &) override;
|
const base::TimeTicks &, const base::TimeDelta &) override;
|
||||||
void SetBeginFrameSource(cc::BeginFrameSource* source) override;
|
void SetBeginFrameSource(cc::BeginFrameSource* source) override;
|
||||||
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
// ui::CompositorDelegate:
|
// ui::CompositorDelegate:
|
||||||
std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||||
|
|
|
@ -38,18 +38,13 @@ class MacHelper :
|
||||||
return color;
|
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(
|
void BrowserCompositorMacSendReclaimCompositorResources(
|
||||||
int output_surface_id,
|
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()->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 {
|
void BrowserCompositorMacOnLostCompositorResources() override {
|
||||||
|
|
|
@ -106,6 +106,10 @@ void OffScreenWebContentsView::RenderViewSwappedIn(
|
||||||
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {
|
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OffScreenWebContentsView::GetScreenInfo(
|
||||||
|
blink::WebScreenInfo* web_screen_info) const {
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {
|
void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
||||||
void RenderViewCreated(content::RenderViewHost* host) override;
|
void RenderViewCreated(content::RenderViewHost* host) override;
|
||||||
void RenderViewSwappedIn(content::RenderViewHost* host) override;
|
void RenderViewSwappedIn(content::RenderViewHost* host) override;
|
||||||
void SetOverscrollControllerEnabled(bool enabled) override;
|
void SetOverscrollControllerEnabled(bool enabled) override;
|
||||||
|
void GetScreenInfo(blink::WebScreenInfo* web_screen_info) const override;
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void SetAllowOtherViews(bool allow) override;
|
void SetAllowOtherViews(bool allow) override;
|
||||||
|
|
|
@ -88,7 +88,7 @@ void GenerateAcceleratorTable(AcceleratorTable* table,
|
||||||
|
|
||||||
bool TriggerAcceleratorTableCommand(AcceleratorTable* table,
|
bool TriggerAcceleratorTableCommand(AcceleratorTable* table,
|
||||||
const ui::Accelerator& accelerator) {
|
const ui::Accelerator& accelerator) {
|
||||||
if (ContainsKey(*table, accelerator)) {
|
if (base::ContainsKey(*table, accelerator)) {
|
||||||
const accelerator_util::MenuItem& item = (*table)[accelerator];
|
const accelerator_util::MenuItem& item = (*table)[accelerator];
|
||||||
if (item.model->IsEnabledAt(item.position)) {
|
if (item.model->IsEnabledAt(item.position)) {
|
||||||
item.model->ActivatedAt(item.position);
|
item.model->ActivatedAt(item.position);
|
||||||
|
|
|
@ -26,7 +26,7 @@ class AtomMenuModel : public ui::SimpleMenuModel {
|
||||||
private:
|
private:
|
||||||
// ui::SimpleMenuModel::Delegate:
|
// ui::SimpleMenuModel::Delegate:
|
||||||
bool GetAcceleratorForCommandId(int command_id,
|
bool GetAcceleratorForCommandId(int command_id,
|
||||||
ui::Accelerator* accelerator) {
|
ui::Accelerator* accelerator) const {
|
||||||
return GetAcceleratorForCommandIdWithParams(
|
return GetAcceleratorForCommandIdWithParams(
|
||||||
command_id, false, accelerator);
|
command_id, false, accelerator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ void WebContentsPermissionHelper::RequestPermission(
|
||||||
web_contents_->GetBrowserContext()->GetPermissionManager());
|
web_contents_->GetBrowserContext()->GetPermissionManager());
|
||||||
auto origin = web_contents_->GetLastCommittedURL();
|
auto origin = web_contents_->GetLastCommittedURL();
|
||||||
permission_manager->RequestPermission(
|
permission_manager->RequestPermission(
|
||||||
permission, rfh, origin,
|
permission, rfh, origin, false,
|
||||||
base::Bind(&OnPermissionResponse, callback));
|
base::Bind(&OnPermissionResponse, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,12 +198,6 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
||||||
if (!visible) // Default state is visible.
|
if (!visible) // Default state is visible.
|
||||||
command_line->AppendSwitch(switches::kHiddenPage);
|
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) {
|
bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ void WebViewManager::AddGuest(int guest_instance_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewManager::RemoveGuest(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;
|
return;
|
||||||
|
|
||||||
web_contents_embedder_map_.erase(guest_instance_id);
|
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) {
|
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;
|
return web_contents_embedder_map_[guest_instance_id].embedder;
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -53,11 +53,11 @@ content::WebContents* WebViewManager::GetGuestByInstanceID(
|
||||||
int owner_process_id,
|
int owner_process_id,
|
||||||
int element_instance_id) {
|
int element_instance_id) {
|
||||||
ElementInstanceKey key(owner_process_id, 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;
|
return nullptr;
|
||||||
|
|
||||||
int guest_instance_id = element_instance_id_to_guest_map_[key];
|
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;
|
return web_contents_embedder_map_[guest_instance_id].web_contents;
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -90,11 +90,11 @@ struct Converter<blink::WebMouseEvent::Button> {
|
||||||
blink::WebMouseEvent::Button* out) {
|
blink::WebMouseEvent::Button* out) {
|
||||||
std::string button = base::ToLowerASCII(V8ToString(val));
|
std::string button = base::ToLowerASCII(V8ToString(val));
|
||||||
if (button == "left")
|
if (button == "left")
|
||||||
*out = blink::WebMouseEvent::Button::ButtonLeft;
|
*out = blink::WebMouseEvent::Button::Left;
|
||||||
else if (button == "middle")
|
else if (button == "middle")
|
||||||
*out = blink::WebMouseEvent::Button::ButtonMiddle;
|
*out = blink::WebMouseEvent::Button::Middle;
|
||||||
else if (button == "right")
|
else if (button == "right")
|
||||||
*out = blink::WebMouseEvent::Button::ButtonRight;
|
*out = blink::WebMouseEvent::Button::Right;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -176,7 +176,6 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
|
||||||
out->windowsKeyCode = keyCode;
|
out->windowsKeyCode = keyCode;
|
||||||
if (shifted)
|
if (shifted)
|
||||||
out->modifiers |= blink::WebInputEvent::ShiftKey;
|
out->modifiers |= blink::WebInputEvent::ShiftKey;
|
||||||
out->setKeyIdentifierFromWindowsKeyCode();
|
|
||||||
|
|
||||||
ui::DomCode domCode = ui::UsLayoutKeyboardCodeToDomCode(keyCode);
|
ui::DomCode domCode = ui::UsLayoutKeyboardCodeToDomCode(keyCode);
|
||||||
out->domCode = static_cast<int>(domCode);
|
out->domCode = static_cast<int>(domCode);
|
||||||
|
@ -246,7 +245,7 @@ bool Converter<blink::WebMouseEvent>::FromV8(
|
||||||
if (!dict.Get("x", &out->x) || !dict.Get("y", &out->y))
|
if (!dict.Get("x", &out->x) || !dict.Get("y", &out->y))
|
||||||
return false;
|
return false;
|
||||||
if (!dict.Get("button", &out->button))
|
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("globalX", &out->globalX);
|
||||||
dict.Get("globalY", &out->globalY);
|
dict.Get("globalY", &out->globalY);
|
||||||
dict.Get("movementX", &out->movementX);
|
dict.Get("movementX", &out->movementX);
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
|
||||||
#include "base/path_service.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 "base/trace_event/trace_event.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/common/content_paths.h"
|
#include "content/public/common/content_paths.h"
|
||||||
|
@ -99,7 +100,6 @@ base::FilePath GetResourcesPath(bool is_browser) {
|
||||||
|
|
||||||
NodeBindings::NodeBindings(bool is_browser)
|
NodeBindings::NodeBindings(bool is_browser)
|
||||||
: is_browser_(is_browser),
|
: is_browser_(is_browser),
|
||||||
message_loop_(nullptr),
|
|
||||||
uv_loop_(uv_default_loop()),
|
uv_loop_(uv_default_loop()),
|
||||||
embed_closed_(false),
|
embed_closed_(false),
|
||||||
uv_env_(nullptr),
|
uv_env_(nullptr),
|
||||||
|
@ -210,7 +210,7 @@ void NodeBindings::RunMessageLoop() {
|
||||||
DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
|
|
||||||
// The MessageLoop should have been created, remember the one in main thread.
|
// 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.
|
// Run uv loop for once to give the uv__io_poll a chance to add all events.
|
||||||
UvRunOnce();
|
UvRunOnce();
|
||||||
|
@ -242,15 +242,15 @@ void NodeBindings::UvRunOnce() {
|
||||||
TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
|
TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
|
||||||
|
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
message_loop_->QuitWhenIdle(); // Quit from uv.
|
base::RunLoop().QuitWhenIdle(); // Quit from uv.
|
||||||
|
|
||||||
// Tell the worker thread to continue polling.
|
// Tell the worker thread to continue polling.
|
||||||
uv_sem_post(&embed_sem_);
|
uv_sem_post(&embed_sem_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeBindings::WakeupMainThread() {
|
void NodeBindings::WakeupMainThread() {
|
||||||
DCHECK(message_loop_);
|
DCHECK(task_runner_);
|
||||||
message_loop_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce,
|
task_runner_->PostTask(FROM_HERE, base::Bind(&NodeBindings::UvRunOnce,
|
||||||
weak_factory_.GetWeakPtr()));
|
weak_factory_.GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class NodeBindings {
|
||||||
bool is_browser_;
|
bool is_browser_;
|
||||||
|
|
||||||
// Main thread's MessageLoop.
|
// Main thread's MessageLoop.
|
||||||
base::MessageLoop* message_loop_;
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
||||||
|
|
||||||
// Main thread's libuv loop.
|
// Main thread's libuv loop.
|
||||||
uv_loop_t* uv_loop_;
|
uv_loop_t* uv_loop_;
|
||||||
|
|
|
@ -64,19 +64,6 @@ void SpellCheckClient::spellCheck(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellCheckClient::checkTextOfParagraph(
|
|
||||||
const blink::WebString& text,
|
|
||||||
blink::WebTextCheckingTypeMask mask,
|
|
||||||
blink::WebVector<blink::WebTextCheckingResult>* results) {
|
|
||||||
if (!results)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(mask & blink::WebTextCheckingTypeSpelling))
|
|
||||||
return;
|
|
||||||
|
|
||||||
NOTREACHED() << "checkTextOfParagraph should never be called";
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellCheckClient::requestCheckingOfText(
|
void SpellCheckClient::requestCheckingOfText(
|
||||||
const blink::WebString& textToCheck,
|
const blink::WebString& textToCheck,
|
||||||
const blink::WebVector<uint32_t>& markersInText,
|
const blink::WebVector<uint32_t>& markersInText,
|
||||||
|
|
|
@ -32,10 +32,6 @@ class SpellCheckClient : public blink::WebSpellCheckClient {
|
||||||
int& misspelledOffset,
|
int& misspelledOffset,
|
||||||
int& misspelledLength,
|
int& misspelledLength,
|
||||||
blink::WebVector<blink::WebString>* optionalSuggestions) override;
|
blink::WebVector<blink::WebString>* optionalSuggestions) override;
|
||||||
void checkTextOfParagraph(
|
|
||||||
const blink::WebString&,
|
|
||||||
blink::WebTextCheckingTypeMask mask,
|
|
||||||
blink::WebVector<blink::WebTextCheckingResult>* results) override;
|
|
||||||
void requestCheckingOfText(
|
void requestCheckingOfText(
|
||||||
const blink::WebString& textToCheck,
|
const blink::WebString& textToCheck,
|
||||||
const blink::WebVector<uint32_t>& markersInText,
|
const blink::WebVector<uint32_t>& markersInText,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/lazy_instance.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"
|
#include "ui/gfx/geometry/size.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -53,7 +53,7 @@ void GuestViewContainer::DidResizeElement(const gfx::Size& new_size) {
|
||||||
if (element_resize_callback_.is_null())
|
if (element_resize_callback_.is_null())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
base::MessageLoop::current()->PostTask(
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
FROM_HERE, base::Bind(element_resize_callback_, new_size));
|
FROM_HERE, base::Bind(element_resize_callback_, new_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ void AtomContentUtilityClient::UtilityThreadStarted() {
|
||||||
|
|
||||||
bool AtomContentUtilityClient::OnMessageReceived(
|
bool AtomContentUtilityClient::OnMessageReceived(
|
||||||
const IPC::Message& message) {
|
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;
|
return false;
|
||||||
|
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/bind_helpers.h"
|
#include "base/bind_helpers.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
|
#include "base/run_loop.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "base/threading/worker_pool.h"
|
#include "base/threading/worker_pool.h"
|
||||||
#include "base/timer/timer.h"
|
#include "base/timer/timer.h"
|
||||||
#include "chrome/browser/chrome_notification_types.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.
|
// Make sure the object outlive this message loop.
|
||||||
scoped_refptr<PrintJob> handle(this);
|
scoped_refptr<PrintJob> handle(this);
|
||||||
|
|
||||||
base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
|
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||||
base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()), timeout);
|
FROM_HERE, base::Bind(&PrintJob::Quit, quit_factory_.GetWeakPtr()),
|
||||||
|
timeout);
|
||||||
|
|
||||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||||
base::MessageLoop::current());
|
base::MessageLoop::current());
|
||||||
base::MessageLoop::current()->Run();
|
base::RunLoop().Run();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -362,7 +365,7 @@ void PrintJob::OnNotifyPrintJobEvent(const JobEventDetails& event_details) {
|
||||||
}
|
}
|
||||||
case JobEventDetails::DOC_DONE: {
|
case JobEventDetails::DOC_DONE: {
|
||||||
// This will call Stop() and broadcast a JOB_DONE message.
|
// 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));
|
FROM_HERE, base::Bind(&PrintJob::OnDocumentDone, this));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/chrome_notification_types.h"
|
#include "chrome/browser/chrome_notification_types.h"
|
||||||
|
@ -278,7 +279,7 @@ void PrintJobWorker::OnNewPage() {
|
||||||
scoped_refptr<PrintedPage> page = document_->GetPage(page_number_.ToInt());
|
scoped_refptr<PrintedPage> page = document_->GetPage(page_number_.ToInt());
|
||||||
if (!page.get()) {
|
if (!page.get()) {
|
||||||
// We need to wait for the page to be available.
|
// We need to wait for the page to be available.
|
||||||
base::MessageLoop::current()->PostDelayedTask(
|
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&PrintJobWorker::OnNewPage, weak_factory_.GetWeakPtr()),
|
base::Bind(&PrintJobWorker::OnNewPage, weak_factory_.GetWeakPtr()),
|
||||||
base::TimeDelta::FromMilliseconds(500));
|
base::TimeDelta::FromMilliseconds(500));
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/memory/ref_counted_memory.h"
|
#include "base/memory/ref_counted_memory.h"
|
||||||
|
#include "base/run_loop.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/timer/timer.h"
|
#include "base/timer/timer.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
|
@ -424,7 +425,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
||||||
{
|
{
|
||||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||||
base::MessageLoop::current());
|
base::MessageLoop::current());
|
||||||
base::MessageLoop::current()->Run();
|
base::RunLoop().Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
|
@ -32,7 +32,7 @@ PepperBrokerMessageFilter::~PepperBrokerMessageFilter() {}
|
||||||
scoped_refptr<base::TaskRunner>
|
scoped_refptr<base::TaskRunner>
|
||||||
PepperBrokerMessageFilter::OverrideTaskRunnerForMessage(
|
PepperBrokerMessageFilter::OverrideTaskRunnerForMessage(
|
||||||
const IPC::Message& message) {
|
const IPC::Message& message) {
|
||||||
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
|
return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PepperBrokerMessageFilter::OnResourceMessageReceived(
|
int32_t PepperBrokerMessageFilter::OnResourceMessageReceived(
|
||||||
|
|
|
@ -110,16 +110,16 @@ PepperFlashClipboardMessageFilter::OverrideTaskRunnerForMessage(
|
||||||
// restrictions of various platform APIs. In general, the clipboard is not
|
// restrictions of various platform APIs. In general, the clipboard is not
|
||||||
// thread-safe, so all clipboard calls should be serviced from the UI thread.
|
// thread-safe, so all clipboard calls should be serviced from the UI thread.
|
||||||
if (msg.type() == PpapiHostMsg_FlashClipboard_WriteData::ID)
|
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
|
// 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
|
// 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
|
// 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.
|
// is ok for reads and writes to be serviced from different threads.
|
||||||
#if !defined(OS_WIN)
|
#if !defined(OS_WIN)
|
||||||
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
|
return BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
|
||||||
#else
|
#else
|
||||||
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
|
return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ PepperIsolatedFileSystemMessageFilter::OverrideTaskRunnerForMessage(
|
||||||
const IPC::Message& msg) {
|
const IPC::Message& msg) {
|
||||||
// In order to reach ExtensionSystem, we need to get ProfileManager first.
|
// 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.
|
// 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);
|
content::BrowserThread::UI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "net/base/escape.h"
|
#include "net/base/escape.h"
|
||||||
#include "printing/pdf_metafile_skia.h"
|
#include "printing/pdf_metafile_skia.h"
|
||||||
#include "printing/units.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/WebSize.h"
|
||||||
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
||||||
#include "third_party/WebKit/public/web/WebConsoleMessage.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(
|
PrintMsg_Print_Params GetCssPrintParams(
|
||||||
blink::WebFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
int page_index,
|
int page_index,
|
||||||
const PrintMsg_Print_Params& page_params) {
|
const PrintMsg_Print_Params& page_params) {
|
||||||
PrintMsg_Print_Params page_css_params = page_params;
|
PrintMsg_Print_Params page_css_params = page_params;
|
||||||
int dpi = GetDPI(&page_params);
|
int dpi = GetDPI(&page_params);
|
||||||
|
|
||||||
blink::WebSize page_size_in_pixels(
|
blink::WebDoubleSize page_size_in_pixels(
|
||||||
ConvertUnit(page_params.page_size.width(), dpi, kPixelsPerInch),
|
ConvertUnitDouble(page_params.page_size.width(), dpi, kPixelsPerInch),
|
||||||
ConvertUnit(page_params.page_size.height(), dpi, kPixelsPerInch));
|
ConvertUnitDouble(page_params.page_size.height(), dpi, kPixelsPerInch));
|
||||||
int margin_top_in_pixels =
|
int margin_top_in_pixels =
|
||||||
ConvertUnit(page_params.margin_top, dpi, kPixelsPerInch);
|
ConvertUnit(page_params.margin_top, dpi, kPixelsPerInch);
|
||||||
int margin_right_in_pixels = ConvertUnit(
|
int margin_right_in_pixels = ConvertUnit(
|
||||||
|
@ -92,8 +93,6 @@ PrintMsg_Print_Params GetCssPrintParams(
|
||||||
page_params.margin_left,
|
page_params.margin_left,
|
||||||
dpi, kPixelsPerInch);
|
dpi, kPixelsPerInch);
|
||||||
|
|
||||||
blink::WebSize original_page_size_in_pixels = page_size_in_pixels;
|
|
||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
frame->pageSizeAndMarginsInPixels(page_index,
|
frame->pageSizeAndMarginsInPixels(page_index,
|
||||||
page_size_in_pixels,
|
page_size_in_pixels,
|
||||||
|
@ -103,9 +102,9 @@ PrintMsg_Print_Params GetCssPrintParams(
|
||||||
margin_left_in_pixels);
|
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;
|
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;
|
margin_top_in_pixels - margin_bottom_in_pixels;
|
||||||
|
|
||||||
// Invalid page size and/or margins. We just use the default setting.
|
// Invalid page size and/or margins. We just use the default setting.
|
||||||
|
@ -115,21 +114,13 @@ PrintMsg_Print_Params GetCssPrintParams(
|
||||||
return page_css_params;
|
return page_css_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
page_css_params.content_size = gfx::Size(
|
page_css_params.page_size =
|
||||||
ConvertUnit(new_content_width, kPixelsPerInch, dpi),
|
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));
|
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.margin_top =
|
page_css_params.margin_top =
|
||||||
ConvertUnit(margin_top_in_pixels, kPixelsPerInch, dpi);
|
ConvertUnit(margin_top_in_pixels, kPixelsPerInch, dpi);
|
||||||
page_css_params.margin_left =
|
page_css_params.margin_left =
|
||||||
|
@ -274,7 +265,7 @@ MarginType GetMarginsForPdf(blink::WebFrame* frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintMsg_Print_Params CalculatePrintParamsForCss(
|
PrintMsg_Print_Params CalculatePrintParamsForCss(
|
||||||
blink::WebFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
int page_index,
|
int page_index,
|
||||||
const PrintMsg_Print_Params& page_params,
|
const PrintMsg_Print_Params& page_params,
|
||||||
bool ignore_css_margins,
|
bool ignore_css_margins,
|
||||||
|
@ -429,7 +420,6 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
||||||
const blink::WebString& unique_name,
|
const blink::WebString& unique_name,
|
||||||
blink::WebSandboxFlags sandbox_flags,
|
blink::WebSandboxFlags sandbox_flags,
|
||||||
const blink::WebFrameOwnerProperties& frame_owner_properties) override;
|
const blink::WebFrameOwnerProperties& frame_owner_properties) override;
|
||||||
void frameDetached(blink::WebFrame* frame, DetachType type) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CallOnReady();
|
void CallOnReady();
|
||||||
|
@ -567,9 +557,8 @@ void PrepareFrameAndViewForPrint::didStopLoading() {
|
||||||
DCHECK(!on_ready_.is_null());
|
DCHECK(!on_ready_.is_null());
|
||||||
// Don't call callback here, because it can delete |this| and WebView that is
|
// Don't call callback here, because it can delete |this| and WebView that is
|
||||||
// called didStopLoading.
|
// called didStopLoading.
|
||||||
base::MessageLoop::current()->PostTask(
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
|
||||||
base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
|
|
||||||
weak_ptr_factory_.GetWeakPtr()));
|
weak_ptr_factory_.GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,14 +574,6 @@ blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
|
||||||
return frame;
|
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() {
|
void PrepareFrameAndViewForPrint::CallOnReady() {
|
||||||
return on_ready_.Run(); // Can delete |this|.
|
return on_ready_.Run(); // Can delete |this|.
|
||||||
}
|
}
|
||||||
|
@ -640,6 +621,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view)
|
||||||
print_node_in_progress_(false),
|
print_node_in_progress_(false),
|
||||||
is_loading_(false),
|
is_loading_(false),
|
||||||
is_scripted_preview_delayed_(false),
|
is_scripted_preview_delayed_(false),
|
||||||
|
ipc_nesting_level_(0),
|
||||||
weak_ptr_factory_(this) {
|
weak_ptr_factory_(this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,6 +635,15 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
|
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;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message)
|
IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message)
|
||||||
IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
|
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_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
IPC_END_MESSAGE_MAP()
|
IPC_END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
--ipc_nesting_level_;
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,27 +660,13 @@ void PrintWebViewHelper::OnDestruct() {
|
||||||
delete this;
|
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)
|
#if !defined(DISABLE_BASIC_PRINTING)
|
||||||
void PrintWebViewHelper::OnPrintPages(bool silent, bool print_background) {
|
void PrintWebViewHelper::OnPrintPages(bool silent, bool print_background) {
|
||||||
blink::WebLocalFrame* frame;
|
if (ipc_nesting_level_> 1)
|
||||||
if (GetPrintFrame(&frame))
|
return;
|
||||||
|
|
||||||
|
blink::WebLocalFrame* frame =
|
||||||
|
render_view()->GetMainRenderFrame()->GetWebFrame();
|
||||||
Print(frame, blink::WebNode(), silent, print_background);
|
Print(frame, blink::WebNode(), silent, print_background);
|
||||||
}
|
}
|
||||||
#endif // !DISABLE_BASIC_PRINTING
|
#endif // !DISABLE_BASIC_PRINTING
|
||||||
|
@ -725,8 +704,12 @@ void PrintWebViewHelper::OnPrintingDone(bool success) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
|
void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
|
||||||
blink::WebLocalFrame* frame;
|
if (ipc_nesting_level_ > 1)
|
||||||
if (GetPrintFrame(&frame)) {
|
return;
|
||||||
|
|
||||||
|
blink::WebLocalFrame* frame =
|
||||||
|
render_view()->GetMainRenderFrame()->GetWebFrame();
|
||||||
|
|
||||||
print_preview_context_.InitWithFrame(frame);
|
print_preview_context_.InitWithFrame(frame);
|
||||||
if (!print_preview_context_.source_frame()) {
|
if (!print_preview_context_.source_frame()) {
|
||||||
DidFinishPrinting(FAIL_PREVIEW);
|
DidFinishPrinting(FAIL_PREVIEW);
|
||||||
|
@ -740,7 +723,6 @@ void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
|
||||||
}
|
}
|
||||||
is_print_ready_metafile_sent_ = false;
|
is_print_ready_metafile_sent_ = false;
|
||||||
PrepareFrameForPreviewDocument();
|
PrepareFrameForPreviewDocument();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintWebViewHelper::PrepareFrameForPreviewDocument() {
|
void PrintWebViewHelper::PrepareFrameForPreviewDocument() {
|
||||||
|
@ -972,7 +954,7 @@ void PrintWebViewHelper::FinishFramePrinting() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
|
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
||||||
int page_count) {
|
int page_count) {
|
||||||
const PrintMsg_PrintPages_Params& params = *print_pages_params_;
|
const PrintMsg_PrintPages_Params& params = *print_pages_params_;
|
||||||
const PrintMsg_Print_Params& print_params = params.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.
|
// static - Not anonymous so that platform implementations can use it.
|
||||||
void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
|
void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
|
||||||
blink::WebFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
int page_index,
|
int page_index,
|
||||||
const PrintMsg_Print_Params& page_params,
|
const PrintMsg_Print_Params& page_params,
|
||||||
bool ignore_css_margins,
|
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,
|
const blink::WebNode& node,
|
||||||
int expected_pages_count) {
|
int expected_pages_count) {
|
||||||
PrintHostMsg_ScriptedPrint_Params params;
|
PrintHostMsg_ScriptedPrint_Params params;
|
||||||
|
|
|
@ -163,7 +163,7 @@ class PrintWebViewHelper
|
||||||
|
|
||||||
// Get final print settings from the user.
|
// Get final print settings from the user.
|
||||||
// Return false if the user cancels or on error.
|
// Return false if the user cancels or on error.
|
||||||
bool GetPrintSettingsFromUser(blink::WebFrame* frame,
|
bool GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
|
||||||
const blink::WebNode& node,
|
const blink::WebNode& node,
|
||||||
int expected_pages_count);
|
int expected_pages_count);
|
||||||
|
|
||||||
|
@ -171,23 +171,23 @@ class PrintWebViewHelper
|
||||||
|
|
||||||
void OnFramePreparedForPrintPages();
|
void OnFramePreparedForPrintPages();
|
||||||
void PrintPages();
|
void PrintPages();
|
||||||
bool PrintPagesNative(blink::WebFrame* frame, int page_count);
|
bool PrintPagesNative(blink::WebLocalFrame* frame, int page_count);
|
||||||
void FinishFramePrinting();
|
void FinishFramePrinting();
|
||||||
|
|
||||||
// Prints the page listed in |params|.
|
// Prints the page listed in |params|.
|
||||||
#if defined(OS_LINUX) || defined(OS_ANDROID)
|
#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||||
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
|
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
|
||||||
blink::WebFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
PdfMetafileSkia* metafile);
|
PdfMetafileSkia* metafile);
|
||||||
#elif defined(OS_WIN)
|
#elif defined(OS_WIN)
|
||||||
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
|
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
|
||||||
blink::WebFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
PdfMetafileSkia* metafile,
|
PdfMetafileSkia* metafile,
|
||||||
gfx::Size* page_size_in_dpi,
|
gfx::Size* page_size_in_dpi,
|
||||||
gfx::Rect* content_area_in_dpi);
|
gfx::Rect* content_area_in_dpi);
|
||||||
#else
|
#else
|
||||||
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
|
void PrintPageInternal(const PrintMsg_PrintPage_Params& params,
|
||||||
blink::WebFrame* frame);
|
blink::WebLocalFrame* frame);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Render the frame for printing.
|
// Render the frame for printing.
|
||||||
|
@ -198,7 +198,7 @@ class PrintWebViewHelper
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void RenderPage(const PrintMsg_Print_Params& params,
|
void RenderPage(const PrintMsg_Print_Params& params,
|
||||||
int page_number,
|
int page_number,
|
||||||
blink::WebFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
bool is_preview,
|
bool is_preview,
|
||||||
PdfMetafileSkia* metafile,
|
PdfMetafileSkia* metafile,
|
||||||
gfx::Size* page_size,
|
gfx::Size* page_size,
|
||||||
|
@ -223,15 +223,13 @@ class PrintWebViewHelper
|
||||||
|
|
||||||
// Helper method to get page layout in points and fit to page if needed.
|
// Helper method to get page layout in points and fit to page if needed.
|
||||||
static void ComputePageLayoutInPointsForCss(
|
static void ComputePageLayoutInPointsForCss(
|
||||||
blink::WebFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
int page_index,
|
int page_index,
|
||||||
const PrintMsg_Print_Params& default_params,
|
const PrintMsg_Print_Params& default_params,
|
||||||
bool ignore_css_margins,
|
bool ignore_css_margins,
|
||||||
double* scale_factor,
|
double* scale_factor,
|
||||||
PageSizeMargins* page_layout_in_points);
|
PageSizeMargins* page_layout_in_points);
|
||||||
|
|
||||||
bool GetPrintFrame(blink::WebLocalFrame** frame);
|
|
||||||
|
|
||||||
// Script Initiated Printing ------------------------------------------------
|
// Script Initiated Printing ------------------------------------------------
|
||||||
|
|
||||||
// Notifies the browser a print preview page has been rendered.
|
// Notifies the browser a print preview page has been rendered.
|
||||||
|
@ -373,6 +371,7 @@ class PrintWebViewHelper
|
||||||
bool print_node_in_progress_;
|
bool print_node_in_progress_;
|
||||||
bool is_loading_;
|
bool is_loading_;
|
||||||
bool is_scripted_preview_delayed_;
|
bool is_scripted_preview_delayed_;
|
||||||
|
int ipc_nesting_level_;
|
||||||
|
|
||||||
PrintPreviewContext print_preview_context_;
|
PrintPreviewContext print_preview_context_;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
using blink::WebFrame;
|
using blink::WebLocalFrame;
|
||||||
|
|
||||||
bool PrintWebViewHelper::RenderPreviewPage(
|
bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
int page_number,
|
int page_number,
|
||||||
|
@ -56,7 +56,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
return PreviewPageRendered(page_number, draft_metafile.get());
|
return PreviewPageRendered(page_number, draft_metafile.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
|
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
||||||
int page_count) {
|
int page_count) {
|
||||||
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
||||||
if (!metafile.Init())
|
if (!metafile.Init())
|
||||||
|
@ -113,7 +113,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
|
||||||
|
|
||||||
void PrintWebViewHelper::PrintPageInternal(
|
void PrintWebViewHelper::PrintPageInternal(
|
||||||
const PrintMsg_PrintPage_Params& params,
|
const PrintMsg_PrintPage_Params& params,
|
||||||
WebFrame* frame,
|
WebLocalFrame* frame,
|
||||||
PdfMetafileSkia* metafile) {
|
PdfMetafileSkia* metafile) {
|
||||||
PageSizeMargins page_layout_in_points;
|
PageSizeMargins page_layout_in_points;
|
||||||
double scale_factor = 1.0f;
|
double scale_factor = 1.0f;
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
using blink::WebFrame;
|
using blink::WebLocalFrame;
|
||||||
|
|
||||||
void PrintWebViewHelper::PrintPageInternal(
|
void PrintWebViewHelper::PrintPageInternal(
|
||||||
const PrintMsg_PrintPage_Params& params,
|
const PrintMsg_PrintPage_Params& params,
|
||||||
WebFrame* frame) {
|
WebLocalFrame* frame) {
|
||||||
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
||||||
CHECK(metafile.Init());
|
CHECK(metafile.Init());
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
|
|
||||||
void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
|
void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
|
||||||
int page_number,
|
int page_number,
|
||||||
WebFrame* frame,
|
WebLocalFrame* frame,
|
||||||
bool is_preview,
|
bool is_preview,
|
||||||
PdfMetafileSkia* metafile,
|
PdfMetafileSkia* metafile,
|
||||||
gfx::Size* page_size,
|
gfx::Size* page_size,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
using blink::WebFrame;
|
using blink::WebLocalFrame;
|
||||||
|
|
||||||
bool PrintWebViewHelper::RenderPreviewPage(
|
bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
int page_number,
|
int page_number,
|
||||||
|
@ -55,7 +55,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
return PreviewPageRendered(page_number, draft_metafile.get());
|
return PreviewPageRendered(page_number, draft_metafile.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
|
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
||||||
int page_count) {
|
int page_count) {
|
||||||
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
||||||
if (!metafile.Init())
|
if (!metafile.Init())
|
||||||
|
@ -122,7 +122,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
|
||||||
|
|
||||||
void PrintWebViewHelper::PrintPageInternal(
|
void PrintWebViewHelper::PrintPageInternal(
|
||||||
const PrintMsg_PrintPage_Params& params,
|
const PrintMsg_PrintPage_Params& params,
|
||||||
WebFrame* frame,
|
WebLocalFrame* frame,
|
||||||
PdfMetafileSkia* metafile,
|
PdfMetafileSkia* metafile,
|
||||||
gfx::Size* page_size_in_dpi,
|
gfx::Size* page_size_in_dpi,
|
||||||
gfx::Rect* content_area_in_dpi) {
|
gfx::Rect* content_area_in_dpi) {
|
||||||
|
|
Loading…
Reference in a new issue