Update files for Chrome 54 API changes

This commit is contained in:
Cheng Zhao 2016-11-30 16:30:03 +09:00 committed by Birunthan Mohanathas
parent bdc334d797
commit 497f5a1199
52 changed files with 275 additions and 298 deletions

View file

@ -312,8 +312,21 @@ struct Converter<Browser::LoginItemSettings> {
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 {
@ -573,8 +586,8 @@ void App::AllowCertificateError(
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* request) {
const base::Callback<void(content::CertificateRequestResultType)>&
callback) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
bool prevent_default = Emit("certificate-error",
@ -586,7 +599,7 @@ void App::AllowCertificateError(
// Deny the certificate by default.
if (!prevent_default)
*request = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
}
void App::SelectClientCertificate(

View file

@ -98,8 +98,8 @@ class App : public AtomBrowserClient::Delegate,
bool overridable,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* request) override;
const base::Callback<void(content::CertificateRequestResultType)>&
callback) override;
void SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,

View file

@ -10,8 +10,8 @@
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "native_mate/dictionary.h"
#include "net/base/filename_util.h"
@ -80,7 +80,8 @@ void DownloadItem::OnDownloadUpdated(content::DownloadItem* item) {
Emit("done", item->GetState());
// Destroy the item once item is downloaded.
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, GetDestroyClosure());
} else {
Emit("updated", item->GetState());
}

View file

@ -11,6 +11,8 @@
#include "atom/common/node_includes.h"
using content::BrowserThread;
namespace mate {
template<>
@ -76,10 +78,8 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() {
new_blocker_type,
device::PowerSaveBlocker::kReasonOther,
ATOM_PRODUCT_NAME,
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI),
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::FILE)));
BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)));
power_save_blocker_.swap(new_blocker);
current_blocker_type_ = new_blocker_type;
}

View file

@ -254,8 +254,8 @@ class ResolveProxyHelper {
// Start the request.
int result = proxy_service->ResolveProxy(
url, "GET", net::LOAD_NORMAL, &proxy_info_, completion_callback,
&pac_req_, nullptr, net::BoundNetLog());
url, "GET", &proxy_info_, completion_callback, &pac_req_, nullptr,
net::BoundNetLog());
// Completed synchronously.
if (result != net::ERR_IO_PENDING)

View file

@ -13,6 +13,7 @@
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/node_includes.h"
#include "base/threading/thread_task_runner_handle.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
#include "ui/gfx/image/image.h"
@ -71,7 +72,8 @@ Tray::Tray(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
Tray::~Tray() {
// Destroy the native tray in next tick.
base::MessageLoop::current()->DeleteSoon(FROM_HERE, tray_icon_.release());
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(
FROM_HERE, tray_icon_.release());
}
// static

View file

@ -40,6 +40,7 @@
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/options_switches.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
@ -830,7 +831,8 @@ void WebContents::WebContentsDestroyed() {
Emit("destroyed");
// Destroy the native class in next tick.
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, GetDestroyClosure());
}
void WebContents::NavigationEntryCommitted(
@ -976,7 +978,7 @@ std::string WebContents::GetUserAgent() {
}
void WebContents::InsertCSS(const std::string& css) {
web_contents()->InsertCSS(css);
// FIXME(zcbenz): Redirect this method to webFrame.
}
bool WebContents::SavePage(const base::FilePath& full_file_path,
@ -1066,7 +1068,8 @@ void WebContents::InspectElement(int x, int y) {
OpenDevTools(nullptr);
scoped_refptr<content::DevToolsAgentHost> agent(
content::DevToolsAgentHost::GetOrCreateFor(web_contents()));
agent->InspectElement(x, y);
// FIXME(zcbenz): Figure out how to implement this for Chrome 54.
agent->InspectElement(nullptr, x, y);
}
void WebContents::InspectServiceWorker() {

View file

@ -17,6 +17,7 @@
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h"
#include "native_mate/constructor.h"
@ -152,7 +153,7 @@ Window::~Window() {
// Destroy the native window in next tick because the native code might be
// iterating all windows.
base::MessageLoop::current()->DeleteSoon(FROM_HERE, window_.release());
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, window_.release());
}
void Window::WillCloseWindow(bool* prevent_default) {
@ -185,7 +186,8 @@ void Window::OnWindowClosed() {
RemoveFromParentChildWindows();
// Destroy the native class when window is closed.
base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure());
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, GetDestroyClosure());
}
void Window::OnWindowBlur() {