feat: Upgrade to Chromium 71.0.3578.98 (#15966)
This commit is contained in:
parent
92ddfd0d4c
commit
52fe92d02e
204 changed files with 2291 additions and 1760 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -56,3 +56,6 @@ spec/.hash
|
||||||
|
|
||||||
# Eslint Cache
|
# Eslint Cache
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
|
# Generated native addon files
|
||||||
|
/spec/fixtures/native-addon/echo/build/
|
||||||
|
|
61
BUILD.gn
61
BUILD.gn
|
@ -54,17 +54,7 @@ config("branding") {
|
||||||
}
|
}
|
||||||
|
|
||||||
npm_action("atom_browserify_sandbox") {
|
npm_action("atom_browserify_sandbox") {
|
||||||
deps = [
|
script = "browserify"
|
||||||
":atom_js2c_copy",
|
|
||||||
]
|
|
||||||
|
|
||||||
sandbox_args = [
|
|
||||||
"lib/sandboxed_renderer/init.js",
|
|
||||||
"-r",
|
|
||||||
"./lib/sandboxed_renderer/api/exports/electron.js:electron",
|
|
||||||
"-t",
|
|
||||||
"aliasify",
|
|
||||||
]
|
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
# FIXME(zcbenz): The dependencies of these files are not listed here, so
|
# FIXME(zcbenz): The dependencies of these files are not listed here, so
|
||||||
|
@ -73,31 +63,35 @@ npm_action("atom_browserify_sandbox") {
|
||||||
"lib/sandboxed_renderer/init.js",
|
"lib/sandboxed_renderer/init.js",
|
||||||
"lib/sandboxed_renderer/api/exports/electron.js",
|
"lib/sandboxed_renderer/api/exports/electron.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
"$target_gen_dir/js2c/preload_bundle.js",
|
"$target_gen_dir/js2c/preload_bundle.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
script = "browserify"
|
args = [
|
||||||
args = sandbox_args + [
|
"lib/sandboxed_renderer/init.js",
|
||||||
|
"-r",
|
||||||
|
"./lib/sandboxed_renderer/api/exports/electron.js:electron",
|
||||||
|
"-t",
|
||||||
|
"aliasify",
|
||||||
"-o",
|
"-o",
|
||||||
rebase_path(outputs[0]),
|
rebase_path(outputs[0]),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
npm_action("atom_browserify_isolated") {
|
npm_action("atom_browserify_isolated") {
|
||||||
deps = [
|
script = "browserify"
|
||||||
":atom_js2c_copy",
|
|
||||||
]
|
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
"lib/isolated_renderer/init.js",
|
"lib/isolated_renderer/init.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
"$target_gen_dir/js2c/isolated_bundle.js",
|
"$target_gen_dir/js2c/isolated_bundle.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
script = "browserify"
|
args = [
|
||||||
args = inputs + [
|
"lib/isolated_renderer/init.js",
|
||||||
"-t",
|
"-t",
|
||||||
"aliasify",
|
"aliasify",
|
||||||
"-o",
|
"-o",
|
||||||
|
@ -122,23 +116,25 @@ action("atom_js2c") {
|
||||||
":atom_js2c_copy",
|
":atom_js2c_copy",
|
||||||
]
|
]
|
||||||
|
|
||||||
js2c_sources = filenames.js2c_sources
|
|
||||||
|
|
||||||
browserify_sources = [
|
browserify_sources = [
|
||||||
"$target_gen_dir/js2c/isolated_bundle.js",
|
"$target_gen_dir/js2c/isolated_bundle.js",
|
||||||
"$target_gen_dir/js2c/preload_bundle.js",
|
"$target_gen_dir/js2c/preload_bundle.js",
|
||||||
]
|
]
|
||||||
|
|
||||||
inputs = js2c_sources + browserify_sources
|
sources = browserify_sources + [
|
||||||
|
"$target_gen_dir/js2c/asar.js",
|
||||||
|
"$target_gen_dir/js2c/asar_init.js",
|
||||||
|
]
|
||||||
|
|
||||||
|
inputs = sources
|
||||||
outputs = [
|
outputs = [
|
||||||
"$target_gen_dir/atom_natives.h",
|
"$root_gen_dir/atom_natives.cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
script = "tools/js2c.py"
|
script = "tools/js2c.py"
|
||||||
args = [ rebase_path("//third_party/electron_node") ] +
|
args = [ rebase_path("//third_party/electron_node") ] +
|
||||||
rebase_path(outputs, root_build_dir) +
|
rebase_path(outputs, root_build_dir) +
|
||||||
[ rebase_path("$target_gen_dir/js2c", root_build_dir) ]
|
rebase_path(sources, root_build_dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
asar("js2asar") {
|
asar("js2asar") {
|
||||||
|
@ -182,18 +178,30 @@ grit("resources") {
|
||||||
"electron_resources.pak",
|
"electron_resources.pak",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Mojo manifest overlays are generated.
|
||||||
|
source_is_generated = true
|
||||||
grit_flags = [
|
grit_flags = [
|
||||||
"-E",
|
"-E",
|
||||||
"target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
|
"target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":copy_shell_devtools_discovery_page",
|
||||||
":electron_content_manifest_overlays",
|
":electron_content_manifest_overlays",
|
||||||
]
|
]
|
||||||
|
|
||||||
output_dir = "$target_gen_dir"
|
output_dir = "$target_gen_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy("copy_shell_devtools_discovery_page") {
|
||||||
|
sources = [
|
||||||
|
"//content/shell/resources/shell_devtools_discovery_page.html",
|
||||||
|
]
|
||||||
|
outputs = [
|
||||||
|
"$target_gen_dir/shell_devtools_discovery_page.html",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
generate_library_loader("libnotify_loader") {
|
generate_library_loader("libnotify_loader") {
|
||||||
name = "LibNotifyLoader"
|
name = "LibNotifyLoader"
|
||||||
|
@ -244,7 +252,6 @@ static_library("electron_lib") {
|
||||||
"//content/public/browser",
|
"//content/public/browser",
|
||||||
"//content/public/child",
|
"//content/public/child",
|
||||||
"//content/public/common:service_names",
|
"//content/public/common:service_names",
|
||||||
"//content/shell:copy_shell_resources",
|
|
||||||
"//gin",
|
"//gin",
|
||||||
"//media/capture/mojom:video_capture",
|
"//media/capture/mojom:video_capture",
|
||||||
"//media/mojo/interfaces",
|
"//media/mojo/interfaces",
|
||||||
|
@ -326,8 +333,6 @@ static_library("electron_lib") {
|
||||||
sources = filenames.lib_sources
|
sources = filenames.lib_sources
|
||||||
set_sources_assignment_filter(sources_assignment_filter)
|
set_sources_assignment_filter(sources_assignment_filter)
|
||||||
|
|
||||||
sources += [ "$target_gen_dir/atom_natives.h" ]
|
|
||||||
|
|
||||||
if (is_component_build) {
|
if (is_component_build) {
|
||||||
defines += [ "NODE_SHARED_MODE" ]
|
defines += [ "NODE_SHARED_MODE" ]
|
||||||
}
|
}
|
||||||
|
@ -576,7 +581,7 @@ if (is_mac) {
|
||||||
}
|
}
|
||||||
info_plist = "atom/common/resources/mac/Info.plist"
|
info_plist = "atom/common/resources/mac/Info.plist"
|
||||||
|
|
||||||
electron_version = read_file("VERSION", "trim string")
|
electron_version = read_file("ELECTRON_VERSION", "trim string")
|
||||||
extra_substitutions = [
|
extra_substitutions = [
|
||||||
"ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",
|
"ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",
|
||||||
"ELECTRON_VERSION=$electron_version",
|
"ELECTRON_VERSION=$electron_version",
|
||||||
|
@ -897,7 +902,7 @@ group("licenses") {
|
||||||
|
|
||||||
copy("electron_version") {
|
copy("electron_version") {
|
||||||
sources = [
|
sources = [
|
||||||
"VERSION",
|
"ELECTRON_VERSION",
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
"$root_build_dir/version",
|
"$root_build_dir/version",
|
||||||
|
|
4
DEPS
4
DEPS
|
@ -10,9 +10,9 @@ gclient_gn_args = [
|
||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
'chromium_version':
|
'chromium_version':
|
||||||
'70.0.3538.110',
|
'71.0.3578.98',
|
||||||
'node_version':
|
'node_version':
|
||||||
'1b192088522d10d126e5bb9316adae2a97add62a',
|
'aeae08cda811ed122918bfd48fd9e56f8204d818',
|
||||||
|
|
||||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||||
'pyyaml_version': '3.12',
|
'pyyaml_version': '3.12',
|
||||||
|
|
|
@ -273,4 +273,8 @@ bool AtomMainDelegate::ShouldLockSchemeRegistry() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AtomMainDelegate::ShouldCreateFeatureList() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -36,6 +36,7 @@ class AtomMainDelegate : public content::ContentMainDelegate {
|
||||||
bool DelaySandboxInitialization(const std::string& process_type) override;
|
bool DelaySandboxInitialization(const std::string& process_type) override;
|
||||||
#endif
|
#endif
|
||||||
bool ShouldLockSchemeRegistry() override;
|
bool ShouldLockSchemeRegistry() override;
|
||||||
|
bool ShouldCreateFeatureList() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
|
|
@ -231,7 +231,7 @@ void BrowserWindow::OnCloseButtonClicked(bool* prevent_default) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (web_contents()->NeedToFireBeforeUnload())
|
if (web_contents()->NeedToFireBeforeUnload())
|
||||||
web_contents()->DispatchBeforeUnload();
|
web_contents()->DispatchBeforeUnload(false /* auto_cancel */);
|
||||||
else
|
else
|
||||||
web_contents()->Close();
|
web_contents()->Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,20 +71,34 @@ void StopRecording(const base::FilePath& path,
|
||||||
GetTraceDataEndpoint(path, callback));
|
GetTraceDataEndpoint(path, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetCategories(
|
||||||
|
const base::RepeatingCallback<void(const std::set<std::string>&)>&
|
||||||
|
callback) {
|
||||||
|
return TracingController::GetInstance()->GetCategories(
|
||||||
|
base::BindOnce(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StartTracing(const base::trace_event::TraceConfig& trace_config,
|
||||||
|
const base::RepeatingCallback<void()>& callback) {
|
||||||
|
return TracingController::GetInstance()->StartTracing(
|
||||||
|
trace_config, base::BindOnce(callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetTraceBufferUsage(
|
||||||
|
const base::RepeatingCallback<void(float, size_t)>& callback) {
|
||||||
|
return TracingController::GetInstance()->GetTraceBufferUsage(
|
||||||
|
base::BindOnce(callback));
|
||||||
|
}
|
||||||
|
|
||||||
void Initialize(v8::Local<v8::Object> exports,
|
void Initialize(v8::Local<v8::Object> exports,
|
||||||
v8::Local<v8::Value> unused,
|
v8::Local<v8::Value> unused,
|
||||||
v8::Local<v8::Context> context,
|
v8::Local<v8::Context> context,
|
||||||
void* priv) {
|
void* priv) {
|
||||||
auto controller = base::Unretained(TracingController::GetInstance());
|
|
||||||
mate::Dictionary dict(context->GetIsolate(), exports);
|
mate::Dictionary dict(context->GetIsolate(), exports);
|
||||||
dict.SetMethod("getCategories",
|
dict.SetMethod("getCategories", &GetCategories);
|
||||||
base::Bind(&TracingController::GetCategories, controller));
|
dict.SetMethod("startRecording", &StartTracing);
|
||||||
dict.SetMethod("startRecording",
|
|
||||||
base::Bind(&TracingController::StartTracing, controller));
|
|
||||||
dict.SetMethod("stopRecording", &StopRecording);
|
dict.SetMethod("stopRecording", &StopRecording);
|
||||||
dict.SetMethod(
|
dict.SetMethod("getTraceBufferUsage", &GetTraceBufferUsage);
|
||||||
"getTraceBufferUsage",
|
|
||||||
base::Bind(&TracingController::GetTraceBufferUsage, controller));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -12,9 +12,11 @@
|
||||||
#include "atom/common/native_mate_converters/callback.h"
|
#include "atom/common/native_mate_converters/callback.h"
|
||||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||||
#include "atom/common/native_mate_converters/value_converter.h"
|
#include "atom/common/native_mate_converters/value_converter.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "native_mate/object_template_builder.h"
|
#include "native_mate/object_template_builder.h"
|
||||||
|
@ -136,7 +138,7 @@ inline net::CookieStore* GetCookieStore(
|
||||||
|
|
||||||
// Run |callback| on UI thread.
|
// Run |callback| on UI thread.
|
||||||
void RunCallbackInUI(const base::Closure& callback) {
|
void RunCallbackInUI(const base::Closure& callback) {
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove cookies from |list| not matching |filter|, and pass it to |callback|.
|
// Remove cookies from |list| not matching |filter|, and pass it to |callback|.
|
||||||
|
@ -270,8 +272,8 @@ void Cookies::Get(const base::DictionaryValue& filter,
|
||||||
auto copy = base::DictionaryValue::From(
|
auto copy = base::DictionaryValue::From(
|
||||||
base::Value::ToUniquePtrValue(filter.Clone()));
|
base::Value::ToUniquePtrValue(filter.Clone()));
|
||||||
auto* getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(GetCookiesOnIO, base::RetainedRef(getter), std::move(copy),
|
base::BindOnce(GetCookiesOnIO, base::RetainedRef(getter), std::move(copy),
|
||||||
callback));
|
callback));
|
||||||
}
|
}
|
||||||
|
@ -280,8 +282,8 @@ void Cookies::Remove(const GURL& url,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const base::Closure& callback) {
|
const base::Closure& callback) {
|
||||||
auto* getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(RemoveCookieOnIOThread, base::RetainedRef(getter), url,
|
base::BindOnce(RemoveCookieOnIOThread, base::RetainedRef(getter), url,
|
||||||
name, callback));
|
name, callback));
|
||||||
}
|
}
|
||||||
|
@ -291,18 +293,17 @@ void Cookies::Set(const base::DictionaryValue& details,
|
||||||
auto copy = base::DictionaryValue::From(
|
auto copy = base::DictionaryValue::From(
|
||||||
base::Value::ToUniquePtrValue(details.Clone()));
|
base::Value::ToUniquePtrValue(details.Clone()));
|
||||||
auto* getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(SetCookieOnIO, base::RetainedRef(getter), std::move(copy),
|
base::BindOnce(SetCookieOnIO, base::RetainedRef(getter), std::move(copy),
|
||||||
callback));
|
callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cookies::FlushStore(const base::Closure& callback) {
|
void Cookies::FlushStore(const base::Closure& callback) {
|
||||||
auto* getter = browser_context_->GetRequestContext();
|
auto* getter = browser_context_->GetRequestContext();
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO},
|
||||||
BrowserThread::IO, FROM_HERE,
|
base::BindOnce(FlushCookieStoreOnIOThread,
|
||||||
base::BindOnce(FlushCookieStoreOnIOThread, base::RetainedRef(getter),
|
base::RetainedRef(getter), callback));
|
||||||
callback));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cookies::OnCookieChanged(const CookieDetails* details) {
|
void Cookies::OnCookieChanged(const CookieDetails* details) {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "base/mac/scoped_sending_event.h"
|
#include "base/mac/scoped_sending_event.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ void MenuMac::PopupAt(TopLevelWindow* window,
|
||||||
auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(),
|
auto popup = base::Bind(&MenuMac::PopupOnUI, weak_factory_.GetWeakPtr(),
|
||||||
native_window->GetWeakPtr(), window->weak_map_id(), x,
|
native_window->GetWeakPtr(), window->weak_map_id(), x,
|
||||||
y, positioning_item, callback);
|
y, positioning_item, callback);
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, popup);
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
|
#include "atom/browser/net/system_network_context_manager.h"
|
||||||
#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 "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
|
@ -27,7 +28,8 @@ NetLog::NetLog(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
||||||
: browser_context_(browser_context) {
|
: browser_context_(browser_context) {
|
||||||
Init(isolate);
|
Init(isolate);
|
||||||
|
|
||||||
net_log_writer_ = g_browser_process->net_log()->net_export_file_writer();
|
net_log_writer_ = g_browser_process->system_network_context_manager()
|
||||||
|
->GetNetExportFileWriter();
|
||||||
net_log_writer_->AddObserver(this);
|
net_log_writer_->AddObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,8 @@ void Protocol::UnregisterProtocol(const std::string& scheme,
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto* getter = static_cast<URLRequestContextGetter*>(
|
auto* getter = static_cast<URLRequestContextGetter*>(
|
||||||
browser_context_->GetRequestContext());
|
browser_context_->GetRequestContext());
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
base::PostTaskWithTraitsAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&Protocol::UnregisterProtocolInIO,
|
base::BindOnce(&Protocol::UnregisterProtocolInIO,
|
||||||
base::RetainedRef(getter), scheme),
|
base::RetainedRef(getter), scheme),
|
||||||
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
||||||
|
@ -107,8 +107,8 @@ void Protocol::IsProtocolHandled(const std::string& scheme,
|
||||||
const BooleanCallback& callback) {
|
const BooleanCallback& callback) {
|
||||||
auto* getter = static_cast<URLRequestContextGetter*>(
|
auto* getter = static_cast<URLRequestContextGetter*>(
|
||||||
browser_context_->GetRequestContext());
|
browser_context_->GetRequestContext());
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
base::PostTaskWithTraitsAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::Bind(&Protocol::IsProtocolHandledInIO, base::RetainedRef(getter),
|
base::Bind(&Protocol::IsProtocolHandledInIO, base::RetainedRef(getter),
|
||||||
scheme),
|
scheme),
|
||||||
callback);
|
callback);
|
||||||
|
@ -127,8 +127,8 @@ void Protocol::UninterceptProtocol(const std::string& scheme,
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto* getter = static_cast<URLRequestContextGetter*>(
|
auto* getter = static_cast<URLRequestContextGetter*>(
|
||||||
browser_context_->GetRequestContext());
|
browser_context_->GetRequestContext());
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
base::PostTaskWithTraitsAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&Protocol::UninterceptProtocolInIO,
|
base::BindOnce(&Protocol::UninterceptProtocolInIO,
|
||||||
base::RetainedRef(getter), scheme),
|
base::RetainedRef(getter), scheme),
|
||||||
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "atom/browser/net/atom_url_request_job_factory.h"
|
#include "atom/browser/net/atom_url_request_job_factory.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "native_mate/arguments.h"
|
#include "native_mate/arguments.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
|
@ -104,8 +106,8 @@ class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto* getter = static_cast<URLRequestContextGetter*>(
|
auto* getter = static_cast<URLRequestContextGetter*>(
|
||||||
browser_context_->GetRequestContext());
|
browser_context_->GetRequestContext());
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
base::PostTaskWithTraitsAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&Protocol::RegisterProtocolInIO<RequestJob>,
|
base::BindOnce(&Protocol::RegisterProtocolInIO<RequestJob>,
|
||||||
base::RetainedRef(getter), isolate(), scheme, handler),
|
base::RetainedRef(getter), isolate(), scheme, handler),
|
||||||
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
||||||
|
@ -149,8 +151,8 @@ class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
auto* getter = static_cast<URLRequestContextGetter*>(
|
auto* getter = static_cast<URLRequestContextGetter*>(
|
||||||
browser_context_->GetRequestContext());
|
browser_context_->GetRequestContext());
|
||||||
content::BrowserThread::PostTaskAndReplyWithResult(
|
base::PostTaskWithTraitsAndReplyWithResult(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&Protocol::InterceptProtocolInIO<RequestJob>,
|
base::BindOnce(&Protocol::InterceptProtocolInIO<RequestJob>,
|
||||||
base::RetainedRef(getter), isolate(), scheme, handler),
|
base::RetainedRef(getter), isolate(), scheme, handler),
|
||||||
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
base::BindOnce(&Protocol::OnIOCompleted, GetWeakPtr(), callback));
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "base/guid.h"
|
#include "base/guid.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "components/download/public/common/download_danger_type.h"
|
#include "components/download/public/common/download_danger_type.h"
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
#include "components/prefs/value_map_pref_store.h"
|
#include "components/prefs/value_map_pref_store.h"
|
||||||
#include "components/proxy_config/proxy_config_dictionary.h"
|
#include "components/proxy_config/proxy_config_dictionary.h"
|
||||||
#include "components/proxy_config/proxy_config_pref_names.h"
|
#include "components/proxy_config/proxy_config_pref_names.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/download_item_utils.h"
|
#include "content/public/browser/download_item_utils.h"
|
||||||
#include "content/public/browser/download_manager_delegate.h"
|
#include "content/public/browser/download_manager_delegate.h"
|
||||||
|
@ -211,11 +213,11 @@ std::map<uint32_t, v8::Global<v8::Object>> g_sessions;
|
||||||
|
|
||||||
// Runs the callback in UI thread.
|
// Runs the callback in UI thread.
|
||||||
void RunCallbackInUI(const base::Callback<void()>& callback) {
|
void RunCallbackInUI(const base::Callback<void()>& callback) {
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, callback);
|
||||||
}
|
}
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
void RunCallbackInUI(const base::Callback<void(T...)>& callback, T... result) {
|
void RunCallbackInUI(const base::Callback<void(T...)>& callback, T... result) {
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(callback, result...));
|
base::BindOnce(callback, result...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,8 +423,8 @@ void Session::ResolveProxy(
|
||||||
|
|
||||||
template <Session::CacheAction action>
|
template <Session::CacheAction action>
|
||||||
void Session::DoCacheAction(const net::CompletionCallback& callback) {
|
void Session::DoCacheAction(const net::CompletionCallback& callback) {
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&DoCacheActionInIO,
|
base::BindOnce(&DoCacheActionInIO,
|
||||||
WrapRefCounted(browser_context_->GetRequestContext()),
|
WrapRefCounted(browser_context_->GetRequestContext()),
|
||||||
action, callback));
|
action, callback));
|
||||||
|
@ -533,8 +535,8 @@ void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&SetCertVerifyProcInIO,
|
base::BindOnce(&SetCertVerifyProcInIO,
|
||||||
WrapRefCounted(browser_context_->GetRequestContext()),
|
WrapRefCounted(browser_context_->GetRequestContext()),
|
||||||
base::Bind(&WrapVerifyProc, proc)));
|
base::Bind(&WrapVerifyProc, proc)));
|
||||||
|
@ -568,8 +570,8 @@ void Session::ClearHostResolverCache(mate::Arguments* args) {
|
||||||
base::Closure callback;
|
base::Closure callback;
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&ClearHostResolverCacheInIO,
|
base::BindOnce(&ClearHostResolverCacheInIO,
|
||||||
WrapRefCounted(browser_context_->GetRequestContext()),
|
WrapRefCounted(browser_context_->GetRequestContext()),
|
||||||
callback));
|
callback));
|
||||||
|
@ -584,16 +586,16 @@ void Session::ClearAuthCache(mate::Arguments* args) {
|
||||||
base::Closure callback;
|
base::Closure callback;
|
||||||
args->GetNext(&callback);
|
args->GetNext(&callback);
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&ClearAuthCacheInIO,
|
base::BindOnce(&ClearAuthCacheInIO,
|
||||||
WrapRefCounted(browser_context_->GetRequestContext()),
|
WrapRefCounted(browser_context_->GetRequestContext()),
|
||||||
options, callback));
|
options, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::AllowNTLMCredentialsForDomains(const std::string& domains) {
|
void Session::AllowNTLMCredentialsForDomains(const std::string& domains) {
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&AllowNTLMCredentialsForDomainsInIO,
|
base::BindOnce(&AllowNTLMCredentialsForDomainsInIO,
|
||||||
WrapRefCounted(browser_context_->GetRequestContext()),
|
WrapRefCounted(browser_context_->GetRequestContext()),
|
||||||
domains));
|
domains));
|
||||||
|
@ -623,8 +625,8 @@ void Session::GetBlobData(const std::string& uuid,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AtomBlobReader* blob_reader = browser_context()->GetBlobReader();
|
AtomBlobReader* blob_reader = browser_context()->GetBlobReader();
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&AtomBlobReader::StartReading,
|
base::BindOnce(&AtomBlobReader::StartReading,
|
||||||
base::Unretained(blob_reader), uuid, callback));
|
base::Unretained(blob_reader), uuid, callback));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "atom/browser/mac/dict_util.h"
|
#include "atom/browser/mac/dict_util.h"
|
||||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||||
#include "atom/common/native_mate_converters/value_converter.h"
|
#include "atom/common/native_mate_converters/value_converter.h"
|
||||||
|
#include "base/mac/sdk_forward_declarations.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "atom/browser/native_window_observer.h"
|
#include "atom/browser/native_window_observer.h"
|
||||||
#include "atom/common/api/atom_api_native_image.h"
|
#include "atom/common/api/atom_api_native_image.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "native_mate/handle.h"
|
#include "native_mate/handle.h"
|
||||||
|
|
||||||
|
@ -230,8 +232,8 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void EmitEventSoon(base::StringPiece eventName) {
|
void EmitEventSoon(base::StringPiece eventName) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(base::IgnoreResult(&TopLevelWindow::Emit<Args...>),
|
base::BindOnce(base::IgnoreResult(&TopLevelWindow::Emit<Args...>),
|
||||||
weak_factory_.GetWeakPtr(), eventName));
|
weak_factory_.GetWeakPtr(), eventName));
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
#include "content/browser/frame_host/render_frame_host_manager.h"
|
#include "content/browser/frame_host/render_frame_host_manager.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||||
#include "content/common/view_messages.h"
|
#include "content/common/widget_messages.h"
|
||||||
#include "content/public/browser/child_process_security_policy.h"
|
#include "content/public/browser/child_process_security_policy.h"
|
||||||
#include "content/public/browser/download_request_utils.h"
|
#include "content/public/browser/download_request_utils.h"
|
||||||
#include "content/public/browser/favicon_status.h"
|
#include "content/public/browser/favicon_status.h"
|
||||||
|
@ -80,8 +80,8 @@
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "native_mate/object_template_builder.h"
|
#include "native_mate/object_template_builder.h"
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
|
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||||
#include "third_party/blink/public/platform/web_input_event.h"
|
#include "third_party/blink/public/platform/web_input_event.h"
|
||||||
#include "third_party/blink/public/web/web_find_options.h"
|
|
||||||
#include "ui/display/screen.h"
|
#include "ui/display/screen.h"
|
||||||
#include "ui/events/base_event_utils.h"
|
#include "ui/events/base_event_utils.h"
|
||||||
|
|
||||||
|
@ -768,7 +768,8 @@ void WebContents::OnAudioStateChanged(bool audible) {
|
||||||
Emit("-audio-state-changed", audible);
|
Emit("-audio-state-changed", audible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
|
void WebContents::BeforeUnloadFired(bool proceed,
|
||||||
|
const base::TimeTicks& proceed_time) {
|
||||||
// Do nothing, we override this method just to avoid compilation error since
|
// Do nothing, we override this method just to avoid compilation error since
|
||||||
// there are two virtual functions named BeforeUnloadFired.
|
// there are two virtual functions named BeforeUnloadFired.
|
||||||
}
|
}
|
||||||
|
@ -1052,7 +1053,7 @@ void WebContents::ShowAutofillPopup(content::RenderFrameHost* frame_host,
|
||||||
bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(WebContents, message)
|
IPC_BEGIN_MESSAGE_MAP(WebContents, message)
|
||||||
IPC_MESSAGE_HANDLER_CODE(ViewHostMsg_SetCursor, OnCursorChange,
|
IPC_MESSAGE_HANDLER_CODE(WidgetHostMsg_SetCursor, OnCursorChange,
|
||||||
handled = false)
|
handled = false)
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
IPC_END_MESSAGE_MAP()
|
IPC_END_MESSAGE_MAP()
|
||||||
|
@ -1372,8 +1373,8 @@ void WebContents::EnableDeviceEmulation(
|
||||||
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
||||||
if (!widget_host)
|
if (!widget_host)
|
||||||
return;
|
return;
|
||||||
widget_host->Send(
|
widget_host->Send(new WidgetMsg_EnableDeviceEmulation(
|
||||||
new ViewMsg_EnableDeviceEmulation(widget_host->GetRoutingID(), params));
|
widget_host->GetRoutingID(), params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1388,7 +1389,7 @@ void WebContents::DisableDeviceEmulation() {
|
||||||
if (!widget_host)
|
if (!widget_host)
|
||||||
return;
|
return;
|
||||||
widget_host->Send(
|
widget_host->Send(
|
||||||
new ViewMsg_DisableDeviceEmulation(widget_host->GetRoutingID()));
|
new WidgetMsg_DisableDeviceEmulation(widget_host->GetRoutingID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1597,17 +1598,22 @@ void WebContents::ReplaceMisspelling(const base::string16& word) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t WebContents::FindInPage(mate::Arguments* args) {
|
uint32_t WebContents::FindInPage(mate::Arguments* args) {
|
||||||
uint32_t request_id = GetNextRequestId();
|
|
||||||
base::string16 search_text;
|
base::string16 search_text;
|
||||||
blink::WebFindOptions options;
|
|
||||||
if (!args->GetNext(&search_text) || search_text.empty()) {
|
if (!args->GetNext(&search_text) || search_text.empty()) {
|
||||||
args->ThrowError("Must provide a non-empty search content");
|
args->ThrowError("Must provide a non-empty search content");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
args->GetNext(&options);
|
uint32_t request_id = GetNextRequestId();
|
||||||
|
mate::Dictionary dict;
|
||||||
|
auto options = blink::mojom::FindOptions::New();
|
||||||
|
if (args->GetNext(&dict)) {
|
||||||
|
dict.Get("forward", &options->forward);
|
||||||
|
dict.Get("matchCase", &options->match_case);
|
||||||
|
dict.Get("findNext", &options->find_next);
|
||||||
|
}
|
||||||
|
|
||||||
web_contents()->Find(request_id, search_text, options);
|
web_contents()->Find(request_id, search_text, std::move(options));
|
||||||
return request_id;
|
return request_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void OnAudioStateChanged(bool audible) override;
|
void OnAudioStateChanged(bool audible) override;
|
||||||
|
|
||||||
// content::WebContentsObserver:
|
// content::WebContentsObserver:
|
||||||
void BeforeUnloadFired(const base::TimeTicks& proceed_time) override;
|
void BeforeUnloadFired(bool proceed,
|
||||||
|
const base::TimeTicks& proceed_time) override;
|
||||||
void RenderViewCreated(content::RenderViewHost*) override;
|
void RenderViewCreated(content::RenderViewHost*) override;
|
||||||
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
||||||
content::RenderViewHost* new_host) override;
|
content::RenderViewHost* new_host) override;
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "atom/common/native_mate_converters/callback.h"
|
#include "atom/common/native_mate_converters/callback.h"
|
||||||
#include "atom/common/native_mate_converters/net_converter.h"
|
#include "atom/common/native_mate_converters/net_converter.h"
|
||||||
#include "atom/common/native_mate_converters/value_converter.h"
|
#include "atom/common/native_mate_converters/value_converter.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "native_mate/object_template_builder.h"
|
#include "native_mate/object_template_builder.h"
|
||||||
|
@ -29,7 +31,7 @@ struct Converter<URLPattern> {
|
||||||
if (!ConvertFromV8(isolate, val, &pattern))
|
if (!ConvertFromV8(isolate, val, &pattern))
|
||||||
return false;
|
return false;
|
||||||
*out = URLPattern(URLPattern::SCHEME_ALL);
|
*out = URLPattern(URLPattern::SCHEME_ALL);
|
||||||
return out->Parse(pattern) == URLPattern::PARSE_SUCCESS;
|
return out->Parse(pattern) == URLPattern::ParseResult::kSuccess;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,8 +99,8 @@ void WebRequest::SetListener(Method method, Event type, mate::Arguments* args) {
|
||||||
browser_context_->GetRequestContext());
|
browser_context_->GetRequestContext());
|
||||||
if (!url_request_context_getter)
|
if (!url_request_context_getter)
|
||||||
return;
|
return;
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&CallNetworkDelegateMethod<Method, Event, Listener>,
|
base::BindOnce(&CallNetworkDelegateMethod<Method, Event, Listener>,
|
||||||
base::RetainedRef(url_request_context_getter), method,
|
base::RetainedRef(url_request_context_getter), method,
|
||||||
type, std::move(patterns), std::move(listener)));
|
type, std::move(patterns), std::move(listener)));
|
||||||
|
|
|
@ -52,7 +52,7 @@ void FrameSubscriber::AttachToHost(content::RenderWidgetHost* host) {
|
||||||
video_capturer_->SetAutoThrottlingEnabled(false);
|
video_capturer_->SetAutoThrottlingEnabled(false);
|
||||||
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
|
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
|
||||||
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB,
|
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB,
|
||||||
media::COLOR_SPACE_UNSPECIFIED);
|
gfx::ColorSpace::CreateREC709());
|
||||||
video_capturer_->SetMinCapturePeriod(base::TimeDelta::FromSeconds(1) /
|
video_capturer_->SetMinCapturePeriod(base::TimeDelta::FromSeconds(1) /
|
||||||
kMaxFrameRate);
|
kMaxFrameRate);
|
||||||
video_capturer_->Start(this);
|
video_capturer_->Start(this);
|
||||||
|
|
|
@ -107,6 +107,18 @@ void GPUInfoEnumerator::EndOverlayCapability() {
|
||||||
value_stack.pop();
|
value_stack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GPUInfoEnumerator::BeginDx12VulkanVersionInfo() {
|
||||||
|
value_stack.push(std::move(current));
|
||||||
|
current = std::make_unique<base::DictionaryValue>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPUInfoEnumerator::EndDx12VulkanVersionInfo() {
|
||||||
|
auto& top_value = value_stack.top();
|
||||||
|
top_value->SetDictionary(kDx12VulkanVersionInfoKey, std::move(current));
|
||||||
|
current = std::move(top_value);
|
||||||
|
value_stack.pop();
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<base::DictionaryValue> GPUInfoEnumerator::GetDictionary() {
|
std::unique_ptr<base::DictionaryValue> GPUInfoEnumerator::GetDictionary() {
|
||||||
return std::move(current);
|
return std::move(current);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
||||||
"videoEncodeAcceleratorSupportedProfile";
|
"videoEncodeAcceleratorSupportedProfile";
|
||||||
const char* kAuxAttributesKey = "auxAttributes";
|
const char* kAuxAttributesKey = "auxAttributes";
|
||||||
const char* kOverlayCapabilityKey = "overlayCapability";
|
const char* kOverlayCapabilityKey = "overlayCapability";
|
||||||
|
const char* kDx12VulkanVersionInfoKey = "dx12VulkanVersionInfo";
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GPUInfoEnumerator();
|
GPUInfoEnumerator();
|
||||||
|
@ -44,6 +45,8 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
||||||
void EndAuxAttributes() override;
|
void EndAuxAttributes() override;
|
||||||
void BeginOverlayCapability() override;
|
void BeginOverlayCapability() override;
|
||||||
void EndOverlayCapability() override;
|
void EndOverlayCapability() override;
|
||||||
|
void BeginDx12VulkanVersionInfo() override;
|
||||||
|
void EndDx12VulkanVersionInfo() override;
|
||||||
std::unique_ptr<base::DictionaryValue> GetDictionary();
|
std::unique_ptr<base::DictionaryValue> GetDictionary();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "atom/browser/net/url_request_stream_job.h"
|
#include "atom/browser/net/url_request_stream_job.h"
|
||||||
#include "atom/common/api/event_emitter_caller.h"
|
#include "atom/common/api/event_emitter_caller.h"
|
||||||
#include "atom/common/native_mate_converters/callback.h"
|
#include "atom/common/native_mate_converters/callback.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
|
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
|
|
||||||
|
@ -76,23 +78,21 @@ void StreamSubscriber::OnData(mate::Arguments* args) {
|
||||||
|
|
||||||
// Pass the data to the URLJob in IO thread.
|
// Pass the data to the URLJob in IO thread.
|
||||||
std::vector<char> buffer(data, data + length);
|
std::vector<char> buffer(data, data + length);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
base::Bind(&atom::URLRequestStreamJob::OnData,
|
||||||
base::Bind(&atom::URLRequestStreamJob::OnData, url_job_,
|
url_job_, base::Passed(&buffer)));
|
||||||
base::Passed(&buffer)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamSubscriber::OnEnd(mate::Arguments* args) {
|
void StreamSubscriber::OnEnd(mate::Arguments* args) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::Bind(&atom::URLRequestStreamJob::OnEnd, url_job_));
|
base::Bind(&atom::URLRequestStreamJob::OnEnd, url_job_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamSubscriber::OnError(mate::Arguments* args) {
|
void StreamSubscriber::OnError(mate::Arguments* args) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
base::Bind(&atom::URLRequestStreamJob::OnError,
|
||||||
base::Bind(&atom::URLRequestStreamJob::OnError, url_job_,
|
url_job_, net::ERR_FAILED));
|
||||||
net::ERR_FAILED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamSubscriber::RemoveAllListeners() {
|
void StreamSubscriber::RemoveAllListeners() {
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
|
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
|
@ -60,7 +62,7 @@ void AtomBlobReader::StartReading(
|
||||||
auto blob_data_handle = blob_context_->context()->GetBlobDataFromUUID(uuid);
|
auto blob_data_handle = blob_context_->context()->GetBlobDataFromUUID(uuid);
|
||||||
auto callback = base::Bind(&RunCallbackInUI, completion_callback);
|
auto callback = base::Bind(&RunCallbackInUI, completion_callback);
|
||||||
if (!blob_data_handle) {
|
if (!blob_data_handle) {
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(callback, nullptr, 0));
|
base::BindOnce(callback, nullptr, 0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +118,7 @@ void AtomBlobReader::BlobReadHelper::DidReadBlobData(
|
||||||
|
|
||||||
char* data = new char[size];
|
char* data = new char[size];
|
||||||
memcpy(data, blob_data->data(), size);
|
memcpy(data, blob_data->data(), size);
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(completion_callback_, data, size));
|
base::BindOnce(completion_callback_, data, size));
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,11 @@
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "components/net_log/chrome_net_log.h"
|
#include "components/net_log/chrome_net_log.h"
|
||||||
#include "content/public/browser/browser_ppapi_host.h"
|
#include "content/public/browser/browser_ppapi_host.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/client_certificate_delegate.h"
|
#include "content/public/browser/client_certificate_delegate.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
|
@ -158,8 +160,8 @@ void AtomBrowserClient::SetApplicationLocale(const std::string& locale) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
|
|
||||||
if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
|
if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
|
||||||
!BrowserThread::PostTask(
|
!base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&SetApplicationLocaleOnIOThread, locale))) {
|
base::BindOnce(&SetApplicationLocaleOnIOThread, locale))) {
|
||||||
g_io_thread_application_locale.Get() = locale;
|
g_io_thread_application_locale.Get() = locale;
|
||||||
}
|
}
|
||||||
|
@ -792,8 +794,8 @@ bool AtomBrowserClient::HandleExternalProtocol(
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
bool has_user_gesture) {
|
bool has_user_gesture) {
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(&HandleExternalProtocolInUI, url, web_contents_getter,
|
base::BindOnce(&HandleExternalProtocolInUI, url, web_contents_getter,
|
||||||
has_user_gesture));
|
has_user_gesture));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -74,7 +74,9 @@
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "ui/base/cursor/cursor_loader_win.h"
|
#include "ui/base/cursor/cursor_loader_win.h"
|
||||||
#include "ui/base/l10n/l10n_util_win.h"
|
#include "ui/base/l10n/l10n_util_win.h"
|
||||||
|
#include "ui/display/win/dpi.h"
|
||||||
#include "ui/gfx/platform_font_win.h"
|
#include "ui/gfx/platform_font_win.h"
|
||||||
|
#include "ui/strings/grit/app_locale_settings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
@ -102,12 +104,17 @@ void Erase(T* container, typename T::iterator iter) {
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// gfx::Font callbacks
|
// gfx::Font callbacks
|
||||||
void AdjustUIFont(LOGFONT* logfont) {
|
void AdjustUIFont(gfx::PlatformFontWin::FontAdjustment* font_adjustment) {
|
||||||
l10n_util::AdjustUIFont(logfont);
|
l10n_util::NeedOverrideDefaultUIFont(&font_adjustment->font_family_override,
|
||||||
|
&font_adjustment->font_scale);
|
||||||
|
font_adjustment->font_scale *= display::win::GetAccessibilityFontScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetMinimumFontSize() {
|
int GetMinimumFontSize() {
|
||||||
return 10;
|
int min_font_size;
|
||||||
|
base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE),
|
||||||
|
&min_font_size);
|
||||||
|
return min_font_size;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -276,10 +283,6 @@ void AtomBrowserMainParts::RegisterDestructionCallback(
|
||||||
destructors_.insert(destructors_.begin(), std::move(callback));
|
destructors_.insert(destructors_.begin(), std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtomBrowserMainParts::ShouldContentCreateFeatureList() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AtomBrowserMainParts::PreEarlyInitialization() {
|
int AtomBrowserMainParts::PreEarlyInitialization() {
|
||||||
InitializeFeatureList();
|
InitializeFeatureList();
|
||||||
OverrideAppLogsPath();
|
OverrideAppLogsPath();
|
||||||
|
@ -393,8 +396,8 @@ void AtomBrowserMainParts::ToolkitInitialized() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont;
|
gfx::PlatformFontWin::SetAdjustFontCallback(&AdjustUIFont);
|
||||||
gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize;
|
gfx::PlatformFontWin::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
|
||||||
|
|
||||||
wchar_t module_name[MAX_PATH] = {0};
|
wchar_t module_name[MAX_PATH] = {0};
|
||||||
if (GetModuleFileName(NULL, module_name, MAX_PATH))
|
if (GetModuleFileName(NULL, module_name, MAX_PATH))
|
||||||
|
|
|
@ -73,7 +73,6 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// content::BrowserMainParts:
|
// content::BrowserMainParts:
|
||||||
bool ShouldContentCreateFeatureList() override;
|
|
||||||
int PreEarlyInitialization() override;
|
int PreEarlyInitialization() override;
|
||||||
void PostEarlyInitialization() override;
|
void PostEarlyInitialization() override;
|
||||||
int PreCreateThreads() override;
|
int PreCreateThreads() override;
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "base/posix/eintr_wrapper.h"
|
#include "base/posix/eintr_wrapper.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
|
@ -137,7 +139,7 @@ void ShutdownDetector::ThreadMain() {
|
||||||
base::Closure task =
|
base::Closure task =
|
||||||
base::Bind(&Browser::Quit, base::Unretained(Browser::Get()));
|
base::Bind(&Browser::Quit, base::Unretained(Browser::Get()));
|
||||||
|
|
||||||
if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) {
|
if (!base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, task)) {
|
||||||
// Without a UI thread to post the exit task to, there aren't many
|
// Without a UI thread to post the exit task to, there aren't many
|
||||||
// options. Raise the signal again. The default handler will pick it up
|
// options. Raise the signal again. The default handler will pick it up
|
||||||
// and cause an ungraceful exit.
|
// and cause an ungraceful exit.
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/web_contents_preferences.h"
|
#include "atom/browser/web_contents_preferences.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/download_manager.h"
|
#include "content/public/browser/download_manager.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
|
@ -90,8 +92,8 @@ bool AtomResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream(
|
||||||
|
|
||||||
if (mime_type == "application/pdf") {
|
if (mime_type == "application/pdf") {
|
||||||
*origin = GURL(kPdfViewerUIOrigin);
|
*origin = GURL(kPdfViewerUIOrigin);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::Bind(&OnPdfResourceIntercepted, request->url(),
|
base::Bind(&OnPdfResourceIntercepted, request->url(),
|
||||||
render_process_host_id, render_frame_id,
|
render_process_host_id, render_frame_id,
|
||||||
info->GetWebContentsGetterForRequest()));
|
info->GetWebContentsGetterForRequest()));
|
||||||
|
|
|
@ -110,7 +110,7 @@ void BrowserProcessImpl::PreCreateThreads(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Initialize net log file exporter.
|
// Initialize net log file exporter.
|
||||||
net_log_->net_export_file_writer()->Initialize();
|
system_network_context_manager_->GetNetExportFileWriter()->Initialize();
|
||||||
|
|
||||||
// Manage global state of net and other IO thread related.
|
// Manage global state of net and other IO thread related.
|
||||||
io_thread_ = std::make_unique<IOThread>(
|
io_thread_ = std::make_unique<IOThread>(
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/child_process_security_policy.h"
|
#include "content/public/browser/child_process_security_policy.h"
|
||||||
|
#include "content/public/browser/file_select_listener.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/render_widget_host.h"
|
#include "content/public/browser/render_widget_host.h"
|
||||||
|
@ -295,18 +296,21 @@ content::ColorChooser* CommonWebContentsDelegate::OpenColorChooser(
|
||||||
|
|
||||||
void CommonWebContentsDelegate::RunFileChooser(
|
void CommonWebContentsDelegate::RunFileChooser(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const content::FileChooserParams& params) {
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
|
const blink::mojom::FileChooserParams& params) {
|
||||||
if (!web_dialog_helper_)
|
if (!web_dialog_helper_)
|
||||||
web_dialog_helper_.reset(new WebDialogHelper(owner_window(), offscreen_));
|
web_dialog_helper_.reset(new WebDialogHelper(owner_window(), offscreen_));
|
||||||
web_dialog_helper_->RunFileChooser(render_frame_host, params);
|
web_dialog_helper_->RunFileChooser(render_frame_host, std::move(listener),
|
||||||
|
params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonWebContentsDelegate::EnumerateDirectory(content::WebContents* guest,
|
void CommonWebContentsDelegate::EnumerateDirectory(
|
||||||
int request_id,
|
content::WebContents* guest,
|
||||||
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
if (!web_dialog_helper_)
|
if (!web_dialog_helper_)
|
||||||
web_dialog_helper_.reset(new WebDialogHelper(owner_window(), offscreen_));
|
web_dialog_helper_.reset(new WebDialogHelper(owner_window(), offscreen_));
|
||||||
web_dialog_helper_->EnumerateDirectory(guest, request_id, path);
|
web_dialog_helper_->EnumerateDirectory(guest, std::move(listener), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonWebContentsDelegate::EnterFullscreenModeForTab(
|
void CommonWebContentsDelegate::EnterFullscreenModeForTab(
|
||||||
|
|
|
@ -84,9 +84,10 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,
|
||||||
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions)
|
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions)
|
||||||
override;
|
override;
|
||||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||||
const content::FileChooserParams& params) override;
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
|
const blink::mojom::FileChooserParams& params) override;
|
||||||
void EnumerateDirectory(content::WebContents* web_contents,
|
void EnumerateDirectory(content::WebContents* web_contents,
|
||||||
int request_id,
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
const base::FilePath& path) override;
|
const base::FilePath& path) override;
|
||||||
void EnterFullscreenModeForTab(
|
void EnterFullscreenModeForTab(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "device/bluetooth/dbus/dbus_thread_manager_linux.h"
|
#include "device/bluetooth/dbus/bluez_dbus_thread_manager.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace atom {
|
||||||
|
|
||||||
PowerObserverLinux::PowerObserverLinux()
|
PowerObserverLinux::PowerObserverLinux()
|
||||||
: lock_owner_name_(get_executable_basename()), weak_ptr_factory_(this) {
|
: lock_owner_name_(get_executable_basename()), weak_ptr_factory_(this) {
|
||||||
auto* bus = bluez::DBusThreadManagerLinux::Get()->GetSystemBus();
|
auto* bus = bluez::BluezDBusThreadManager::Get()->GetSystemBus();
|
||||||
if (!bus) {
|
if (!bus) {
|
||||||
LOG(WARNING) << "Failed to get system bus connection";
|
LOG(WARNING) << "Failed to get system bus connection";
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "atom/common/native_mate_converters/net_converter.h"
|
#include "atom/common/native_mate_converters/net_converter.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "net/base/auth.h"
|
#include "net/base/auth.h"
|
||||||
|
@ -37,8 +39,8 @@ LoginHandler::LoginHandler(
|
||||||
web_contents_getter_ =
|
web_contents_getter_ =
|
||||||
resource_request_info->GetWebContentsGetterForRequest();
|
resource_request_info->GetWebContentsGetterForRequest();
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(&Browser::RequestLogin, base::Unretained(Browser::Get()),
|
base::BindOnce(&Browser::RequestLogin, base::Unretained(Browser::Get()),
|
||||||
base::RetainedRef(this), std::move(request_details)));
|
base::RetainedRef(this), std::move(request_details)));
|
||||||
}
|
}
|
||||||
|
@ -49,8 +51,8 @@ void LoginHandler::Login(const base::string16& username,
|
||||||
const base::string16& password) {
|
const base::string16& password) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&LoginHandler::DoLogin, weak_factory_.GetWeakPtr(),
|
base::BindOnce(&LoginHandler::DoLogin, weak_factory_.GetWeakPtr(),
|
||||||
username, password));
|
username, password));
|
||||||
}
|
}
|
||||||
|
@ -58,8 +60,8 @@ void LoginHandler::Login(const base::string16& username,
|
||||||
void LoginHandler::CancelAuth() {
|
void LoginHandler::CancelAuth() {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&LoginHandler::DoCancelAuth, weak_factory_.GetWeakPtr()));
|
base::BindOnce(&LoginHandler::DoCancelAuth, weak_factory_.GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,13 +82,6 @@ typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) {
|
||||||
NSColor* unemphasizedSelectedTextColor API_AVAILABLE(macosx(10.14));
|
NSColor* unemphasizedSelectedTextColor API_AVAILABLE(macosx(10.14));
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#if !defined(MAC_OS_X_VERSION_10_14) || \
|
|
||||||
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14
|
|
||||||
BASE_EXPORT extern NSString* const NSAppearanceNameDarkAqua;
|
|
||||||
#endif // MAC_OS_X_VERSION_10_14
|
|
||||||
} // extern "C"
|
|
||||||
|
|
||||||
@interface AtomApplication : NSApplication <CrAppProtocol,
|
@interface AtomApplication : NSApplication <CrAppProtocol,
|
||||||
CrAppControlProtocol,
|
CrAppControlProtocol,
|
||||||
NSUserActivityDelegate> {
|
NSUserActivityDelegate> {
|
||||||
|
|
|
@ -11,11 +11,6 @@
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "content/public/browser/browser_accessibility_state.h"
|
#include "content/public/browser/browser_accessibility_state.h"
|
||||||
|
|
||||||
#if !defined(MAC_OS_X_VERSION_10_14) || \
|
|
||||||
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14
|
|
||||||
NSString* const NSAppearanceNameDarkAqua = @"NSAppearanceNameDarkAqua";
|
|
||||||
#endif // MAC_OS_X_VERSION_10_14
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
inline void dispatch_sync_main(dispatch_block_t block) {
|
inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
|
||||||
#import <CommonCrypto/CommonCrypto.h>
|
#import <CommonCrypto/CommonCrypto.h>
|
||||||
|
@ -117,7 +119,7 @@
|
||||||
*/
|
*/
|
||||||
- (void)runCallback:(bool)isProductValid {
|
- (void)runCallback:(bool)isProductValid {
|
||||||
if (callback_) {
|
if (callback_) {
|
||||||
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::Bind(callback_, isProductValid));
|
base::Bind(callback_, isProductValid));
|
||||||
}
|
}
|
||||||
// Release this delegate.
|
// Release this delegate.
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
|
||||||
#import <CommonCrypto/CommonCrypto.h>
|
#import <CommonCrypto/CommonCrypto.h>
|
||||||
|
@ -71,7 +73,7 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the callback to the browser thread.
|
// Send the callback to the browser thread.
|
||||||
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::Bind(callback_, converted));
|
base::Bind(callback_, converted));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
|
||||||
#import <StoreKit/StoreKit.h>
|
#import <StoreKit/StoreKit.h>
|
||||||
|
@ -78,7 +80,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the callback to the browser thread.
|
// Send the callback to the browser thread.
|
||||||
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::Bind(callback_, converted));
|
base::Bind(callback_, converted));
|
||||||
|
|
||||||
[self release];
|
[self release];
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include "ui/gfx/skia_util.h"
|
#include "ui/gfx/skia_util.h"
|
||||||
#include "ui/gl/gpu_switching_manager.h"
|
#include "ui/gl/gpu_switching_manager.h"
|
||||||
#include "ui/views/background.h"
|
#include "ui/views/background.h"
|
||||||
#include "ui/views/cocoa/bridged_native_widget.h"
|
|
||||||
#include "ui/views/widget/widget.h"
|
#include "ui/views/widget/widget.h"
|
||||||
|
#include "ui/views_bridge_mac/bridged_native_widget_impl.h"
|
||||||
|
|
||||||
// This view always takes the size of its superview. It is intended to be used
|
// This view always takes the size of its superview. It is intended to be used
|
||||||
// as a NSWindow's contentView. It is needed because NSWindow's implementation
|
// as a NSWindow's contentView. It is needed because NSWindow's implementation
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include "atom/common/native_mate_converters/net_converter.h"
|
#include "atom/common/native_mate_converters/net_converter.h"
|
||||||
#include "base/containers/linked_list.h"
|
#include "base/containers/linked_list.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/cert/cert_verify_result.h"
|
#include "net/cert/cert_verify_result.h"
|
||||||
|
@ -96,8 +98,8 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
||||||
request->certificate = params_.certificate();
|
request->certificate = params_.certificate();
|
||||||
auto response_callback = base::Bind(&CertVerifierRequest::OnResponseInUI,
|
auto response_callback = base::Bind(&CertVerifierRequest::OnResponseInUI,
|
||||||
weak_ptr_factory_.GetWeakPtr());
|
weak_ptr_factory_.GetWeakPtr());
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(&CertVerifierRequest::OnVerifyRequestInUI,
|
base::BindOnce(&CertVerifierRequest::OnVerifyRequestInUI,
|
||||||
cert_verifier_->verify_proc(), std::move(request),
|
cert_verifier_->verify_proc(), std::move(request),
|
||||||
response_callback));
|
response_callback));
|
||||||
|
@ -112,8 +114,8 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
||||||
|
|
||||||
static void OnResponseInUI(base::WeakPtr<CertVerifierRequest> self,
|
static void OnResponseInUI(base::WeakPtr<CertVerifierRequest> self,
|
||||||
int result) {
|
int result) {
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&CertVerifierRequest::NotifyResponseInIO, self, result));
|
base::BindOnce(&CertVerifierRequest::NotifyResponseInIO, self, result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/stl_util.h"
|
#include "base/stl_util.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/resource_request_info.h"
|
#include "content/public/browser/resource_request_info.h"
|
||||||
|
@ -397,14 +399,16 @@ net::NetworkDelegate::AuthRequiredResponse AtomNetworkDelegate::OnAuthRequired(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtomNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
bool AtomNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
||||||
const net::CookieList& cookie_list) {
|
const net::CookieList& cookie_list,
|
||||||
|
bool allowed_from_caller) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtomNetworkDelegate::OnCanSetCookie(
|
bool AtomNetworkDelegate::OnCanSetCookie(
|
||||||
const net::URLRequest& request,
|
const net::URLRequest& request,
|
||||||
const net::CanonicalCookie& cookie_line,
|
const net::CanonicalCookie& cookie_line,
|
||||||
net::CookieOptions* options) {
|
net::CookieOptions* options,
|
||||||
|
bool allowed_from_caller) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,8 +491,8 @@ int AtomNetworkDelegate::HandleResponseEvent(
|
||||||
ResponseCallback response =
|
ResponseCallback response =
|
||||||
base::Bind(&AtomNetworkDelegate::OnListenerResultInUI<Out>,
|
base::Bind(&AtomNetworkDelegate::OnListenerResultInUI<Out>,
|
||||||
base::Unretained(this), request->identifier(), out);
|
base::Unretained(this), request->identifier(), out);
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(RunResponseListener, info.listener, std::move(details),
|
base::BindOnce(RunResponseListener, info.listener, std::move(details),
|
||||||
render_process_id, render_frame_id, response));
|
render_process_id, render_frame_id, response));
|
||||||
return net::ERR_IO_PENDING;
|
return net::ERR_IO_PENDING;
|
||||||
|
@ -509,8 +513,8 @@ void AtomNetworkDelegate::HandleSimpleEvent(SimpleEvent type,
|
||||||
content::ResourceRequestInfo::GetRenderFrameForRequest(
|
content::ResourceRequestInfo::GetRenderFrameForRequest(
|
||||||
request, &render_process_id, &render_frame_id);
|
request, &render_process_id, &render_frame_id);
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::BindOnce(RunSimpleListener, info.listener, std::move(details),
|
base::BindOnce(RunSimpleListener, info.listener, std::move(details),
|
||||||
render_process_id, render_frame_id));
|
render_process_id, render_frame_id));
|
||||||
}
|
}
|
||||||
|
@ -538,8 +542,8 @@ void AtomNetworkDelegate::OnListenerResultInUI(
|
||||||
const base::DictionaryValue& response) {
|
const base::DictionaryValue& response) {
|
||||||
auto copy = base::DictionaryValue::From(
|
auto copy = base::DictionaryValue::From(
|
||||||
base::Value::ToUniquePtrValue(response.Clone()));
|
base::Value::ToUniquePtrValue(response.Clone()));
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&AtomNetworkDelegate::OnListenerResultInIO<T>,
|
base::BindOnce(&AtomNetworkDelegate::OnListenerResultInIO<T>,
|
||||||
base::Unretained(this), id, out, std::move(copy)));
|
base::Unretained(this), id, out, std::move(copy)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,10 +118,12 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
||||||
AuthCallback callback,
|
AuthCallback callback,
|
||||||
net::AuthCredentials* credentials) override;
|
net::AuthCredentials* credentials) override;
|
||||||
bool OnCanGetCookies(const net::URLRequest& request,
|
bool OnCanGetCookies(const net::URLRequest& request,
|
||||||
const net::CookieList& cookie_list) override;
|
const net::CookieList& cookie_list,
|
||||||
|
bool allowed_from_caller) override;
|
||||||
bool OnCanSetCookie(const net::URLRequest& request,
|
bool OnCanSetCookie(const net::URLRequest& request,
|
||||||
const net::CanonicalCookie& cookie_line,
|
const net::CanonicalCookie& cookie_line,
|
||||||
net::CookieOptions* options) override;
|
net::CookieOptions* options,
|
||||||
|
bool allowed_from_caller) override;
|
||||||
bool OnCanAccessFile(const net::URLRequest& request,
|
bool OnCanAccessFile(const net::URLRequest& request,
|
||||||
const base::FilePath& original_path,
|
const base::FilePath& original_path,
|
||||||
const base::FilePath& absolute_path) const override;
|
const base::FilePath& absolute_path) const override;
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/net/atom_url_request_job_factory.h"
|
#include "atom/browser/net/atom_url_request_job_factory.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "net/base/elements_upload_data_stream.h"
|
#include "net/base/elements_upload_data_stream.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
|
@ -77,8 +79,8 @@ scoped_refptr<AtomURLRequest> AtomURLRequest::Create(
|
||||||
browser_context->GetRequestContext());
|
browser_context->GetRequestContext());
|
||||||
DCHECK(request_context_getter);
|
DCHECK(request_context_getter);
|
||||||
scoped_refptr<AtomURLRequest> atom_url_request(new AtomURLRequest(delegate));
|
scoped_refptr<AtomURLRequest> atom_url_request(new AtomURLRequest(delegate));
|
||||||
if (content::BrowserThread::PostTask(
|
if (base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoInitialize, atom_url_request,
|
base::BindOnce(&AtomURLRequest::DoInitialize, atom_url_request,
|
||||||
request_context_getter, method, url,
|
request_context_getter, method, url,
|
||||||
redirect_policy))) {
|
redirect_policy))) {
|
||||||
|
@ -90,8 +92,7 @@ scoped_refptr<AtomURLRequest> AtomURLRequest::Create(
|
||||||
void AtomURLRequest::Terminate() {
|
void AtomURLRequest::Terminate() {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
delegate_ = nullptr;
|
delegate_ = nullptr;
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
|
||||||
base::BindOnce(&AtomURLRequest::DoTerminate, this));
|
base::BindOnce(&AtomURLRequest::DoTerminate, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,8 +141,8 @@ void AtomURLRequest::DoTerminate() {
|
||||||
bool AtomURLRequest::Write(scoped_refptr<const net::IOBufferWithSize> buffer,
|
bool AtomURLRequest::Write(scoped_refptr<const net::IOBufferWithSize> buffer,
|
||||||
bool is_last) {
|
bool is_last) {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
return content::BrowserThread::PostTask(
|
return base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoWriteBuffer, this, buffer, is_last));
|
base::BindOnce(&AtomURLRequest::DoWriteBuffer, this, buffer, is_last));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,30 +157,29 @@ void AtomURLRequest::SetChunkedUpload(bool is_chunked_upload) {
|
||||||
|
|
||||||
void AtomURLRequest::Cancel() {
|
void AtomURLRequest::Cancel() {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
|
||||||
base::BindOnce(&AtomURLRequest::DoCancel, this));
|
base::BindOnce(&AtomURLRequest::DoCancel, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomURLRequest::FollowRedirect() {
|
void AtomURLRequest::FollowRedirect() {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoFollowRedirect, this));
|
base::BindOnce(&AtomURLRequest::DoFollowRedirect, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomURLRequest::SetExtraHeader(const std::string& name,
|
void AtomURLRequest::SetExtraHeader(const std::string& name,
|
||||||
const std::string& value) const {
|
const std::string& value) const {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoSetExtraHeader, this, name, value));
|
base::BindOnce(&AtomURLRequest::DoSetExtraHeader, this, name, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomURLRequest::RemoveExtraHeader(const std::string& name) const {
|
void AtomURLRequest::RemoveExtraHeader(const std::string& name) const {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoRemoveExtraHeader, this, name));
|
base::BindOnce(&AtomURLRequest::DoRemoveExtraHeader, this, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,20 +188,20 @@ void AtomURLRequest::PassLoginInformation(
|
||||||
const base::string16& password) const {
|
const base::string16& password) const {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
if (username.empty() || password.empty()) {
|
if (username.empty() || password.empty()) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoCancelAuth, this));
|
base::BindOnce(&AtomURLRequest::DoCancelAuth, this));
|
||||||
} else {
|
} else {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoSetAuth, this, username, password));
|
base::BindOnce(&AtomURLRequest::DoSetAuth, this, username, password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomURLRequest::SetLoadFlags(int flags) const {
|
void AtomURLRequest::SetLoadFlags(int flags) const {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&AtomURLRequest::DoSetLoadFlags, this, flags));
|
base::BindOnce(&AtomURLRequest::DoSetLoadFlags, this, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,8 +309,8 @@ void AtomURLRequest::DoCancelAuth() const {
|
||||||
void AtomURLRequest::DoCancelWithError(const std::string& error,
|
void AtomURLRequest::DoCancelWithError(const std::string& error,
|
||||||
bool isRequestError) {
|
bool isRequestError) {
|
||||||
DoCancel();
|
DoCancel();
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomURLRequest::InformDelegateErrorOccured, this, error,
|
base::BindOnce(&AtomURLRequest::InformDelegateErrorOccured, this, error,
|
||||||
isRequestError));
|
isRequestError));
|
||||||
}
|
}
|
||||||
|
@ -338,8 +338,8 @@ void AtomURLRequest::OnReceivedRedirect(net::URLRequest* request,
|
||||||
*defer_redirect = true;
|
*defer_redirect = true;
|
||||||
scoped_refptr<net::HttpResponseHeaders> response_headers =
|
scoped_refptr<net::HttpResponseHeaders> response_headers =
|
||||||
request->response_headers();
|
request->response_headers();
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomURLRequest::InformDelegateReceivedRedirect, this,
|
base::BindOnce(&AtomURLRequest::InformDelegateReceivedRedirect, this,
|
||||||
info.status_code, info.new_method, info.new_url,
|
info.status_code, info.new_method, info.new_url,
|
||||||
response_headers));
|
response_headers));
|
||||||
|
@ -350,8 +350,8 @@ void AtomURLRequest::OnAuthRequired(net::URLRequest* request,
|
||||||
net::AuthChallengeInfo* auth_info) {
|
net::AuthChallengeInfo* auth_info) {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomURLRequest::InformDelegateAuthenticationRequired,
|
base::BindOnce(&AtomURLRequest::InformDelegateAuthenticationRequired,
|
||||||
this, scoped_refptr<net::AuthChallengeInfo>(auth_info)));
|
this, scoped_refptr<net::AuthChallengeInfo>(auth_info)));
|
||||||
}
|
}
|
||||||
|
@ -369,8 +369,8 @@ void AtomURLRequest::OnResponseStarted(net::URLRequest* request,
|
||||||
const auto& status = request_->status();
|
const auto& status = request_->status();
|
||||||
if (status.is_success()) {
|
if (status.is_success()) {
|
||||||
// Success or pending trigger a Read.
|
// Success or pending trigger a Read.
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomURLRequest::InformDelegateResponseStarted, this,
|
base::BindOnce(&AtomURLRequest::InformDelegateResponseStarted, this,
|
||||||
response_headers));
|
response_headers));
|
||||||
ReadResponse();
|
ReadResponse();
|
||||||
|
@ -428,8 +428,8 @@ void AtomURLRequest::OnReadCompleted(net::URLRequest* request, int bytes_read) {
|
||||||
if (response_error) {
|
if (response_error) {
|
||||||
DoCancelWithError(net::ErrorToString(status.ToNetError()), false);
|
DoCancelWithError(net::ErrorToString(status.ToNetError()), false);
|
||||||
} else if (data_ended) {
|
} else if (data_ended) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomURLRequest::InformDelegateResponseCompleted, this));
|
base::BindOnce(&AtomURLRequest::InformDelegateResponseCompleted, this));
|
||||||
DoTerminate();
|
DoTerminate();
|
||||||
} else if (data_transfer_error) {
|
} else if (data_transfer_error) {
|
||||||
|
@ -451,8 +451,8 @@ bool AtomURLRequest::CopyAndPostBuffer(int bytes_read) {
|
||||||
auto buffer_copy = WrapRefCounted(new net::IOBufferWithSize(bytes_read));
|
auto buffer_copy = WrapRefCounted(new net::IOBufferWithSize(bytes_read));
|
||||||
memcpy(buffer_copy->data(), response_read_buffer_->data(), bytes_read);
|
memcpy(buffer_copy->data(), response_read_buffer_->data(), bytes_read);
|
||||||
|
|
||||||
return content::BrowserThread::PostTask(
|
return base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomURLRequest::InformDelegateResponseData, this,
|
base::BindOnce(&AtomURLRequest::InformDelegateResponseData, this,
|
||||||
buffer_copy));
|
buffer_copy));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "base/lazy_instance.h"
|
#include "base/lazy_instance.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
|
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
|
||||||
|
#include "components/net_log/net_export_file_writer.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/network_service_instance.h"
|
#include "content/public/browser/network_service_instance.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
|
@ -147,6 +148,14 @@ SystemNetworkContextManager::GetSharedURLLoaderFactory() {
|
||||||
return shared_url_loader_factory_;
|
return shared_url_loader_factory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
net_log::NetExportFileWriter*
|
||||||
|
SystemNetworkContextManager::GetNetExportFileWriter() {
|
||||||
|
if (!net_export_file_writer_) {
|
||||||
|
net_export_file_writer_ = std::make_unique<net_log::NetExportFileWriter>();
|
||||||
|
}
|
||||||
|
return net_export_file_writer_.get();
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
network::mojom::NetworkContextParamsPtr
|
network::mojom::NetworkContextParamsPtr
|
||||||
SystemNetworkContextManager::CreateDefaultNetworkContextParams() {
|
SystemNetworkContextManager::CreateDefaultNetworkContextParams() {
|
||||||
|
|
|
@ -23,6 +23,10 @@ class URLLoaderFactory;
|
||||||
class SharedURLLoaderFactory;
|
class SharedURLLoaderFactory;
|
||||||
} // namespace network
|
} // namespace network
|
||||||
|
|
||||||
|
namespace net_log {
|
||||||
|
class NetExportFileWriter;
|
||||||
|
}
|
||||||
|
|
||||||
// Responsible for creating and managing access to the system NetworkContext.
|
// Responsible for creating and managing access to the system NetworkContext.
|
||||||
// Lives on the UI thread. The NetworkContext this owns is intended for requests
|
// Lives on the UI thread. The NetworkContext this owns is intended for requests
|
||||||
// not associated with a session. It stores no data on disk, and has no HTTP
|
// not associated with a session. It stores no data on disk, and has no HTTP
|
||||||
|
@ -71,6 +75,9 @@ class SystemNetworkContextManager {
|
||||||
// that is backed by the SystemNetworkContext.
|
// that is backed by the SystemNetworkContext.
|
||||||
scoped_refptr<network::SharedURLLoaderFactory> GetSharedURLLoaderFactory();
|
scoped_refptr<network::SharedURLLoaderFactory> GetSharedURLLoaderFactory();
|
||||||
|
|
||||||
|
// Returns a shared global NetExportFileWriter instance.
|
||||||
|
net_log::NetExportFileWriter* GetNetExportFileWriter();
|
||||||
|
|
||||||
// Called when content creates a NetworkService. Creates the
|
// Called when content creates a NetworkService. Creates the
|
||||||
// SystemNetworkContext, if the network service is enabled.
|
// SystemNetworkContext, if the network service is enabled.
|
||||||
void OnNetworkServiceCreated(network::mojom::NetworkService* network_service);
|
void OnNetworkServiceCreated(network::mojom::NetworkService* network_service);
|
||||||
|
@ -98,6 +105,9 @@ class SystemNetworkContextManager {
|
||||||
scoped_refptr<URLLoaderFactoryForSystem> shared_url_loader_factory_;
|
scoped_refptr<URLLoaderFactoryForSystem> shared_url_loader_factory_;
|
||||||
network::mojom::URLLoaderFactoryPtr url_loader_factory_;
|
network::mojom::URLLoaderFactoryPtr url_loader_factory_;
|
||||||
|
|
||||||
|
// Initialized on first access.
|
||||||
|
std::unique_ptr<net_log::NetExportFileWriter> net_export_file_writer_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager);
|
DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "atom/common/native_mate_converters/v8_value_converter.h"
|
#include "atom/common/native_mate_converters/v8_value_converter.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/task/post_task.h"
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -37,8 +38,8 @@ void BeforeStartInUI(base::WeakPtr<URLRequestAsyncAsarJob> job,
|
||||||
error = net::ERR_NOT_IMPLEMENTED;
|
error = net::ERR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&URLRequestAsyncAsarJob::StartAsync, job,
|
base::BindOnce(&URLRequestAsyncAsarJob::StartAsync, job,
|
||||||
std::move(request_options), error));
|
std::move(request_options), error));
|
||||||
}
|
}
|
||||||
|
@ -55,8 +56,8 @@ URLRequestAsyncAsarJob::~URLRequestAsyncAsarJob() = default;
|
||||||
void URLRequestAsyncAsarJob::Start() {
|
void URLRequestAsyncAsarJob::Start() {
|
||||||
auto request_details = std::make_unique<base::DictionaryValue>();
|
auto request_details = std::make_unique<base::DictionaryValue>();
|
||||||
FillRequestDetails(request_details.get(), request());
|
FillRequestDetails(request_details.get(), request());
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||||
handler(), std::move(request_details),
|
handler(), std::move(request_details),
|
||||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include "atom/common/native_mate_converters/v8_value_converter.h"
|
#include "atom/common/native_mate_converters/v8_value_converter.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "net/base/mime_util.h"
|
#include "net/base/mime_util.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
|
@ -47,8 +49,7 @@ void BeforeStartInUI(base::WeakPtr<URLRequestBufferJob> job,
|
||||||
error = net::ERR_NOT_IMPLEMENTED;
|
error = net::ERR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
|
||||||
base::BindOnce(&URLRequestBufferJob::StartAsync, job,
|
base::BindOnce(&URLRequestBufferJob::StartAsync, job,
|
||||||
std::move(request_options), error));
|
std::move(request_options), error));
|
||||||
}
|
}
|
||||||
|
@ -66,8 +67,8 @@ URLRequestBufferJob::~URLRequestBufferJob() = default;
|
||||||
void URLRequestBufferJob::Start() {
|
void URLRequestBufferJob::Start() {
|
||||||
auto request_details = std::make_unique<base::DictionaryValue>();
|
auto request_details = std::make_unique<base::DictionaryValue>();
|
||||||
FillRequestDetails(request_details.get(), request());
|
FillRequestDetails(request_details.get(), request());
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||||
handler(), std::move(request_details),
|
handler(), std::move(request_details),
|
||||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "components/network_session_configurator/common/network_switches.h"
|
#include "components/network_session_configurator/common/network_switches.h"
|
||||||
#include "components/prefs/value_map_pref_store.h"
|
#include "components/prefs/value_map_pref_store.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/devtools_network_transaction_factory.h"
|
#include "content/public/browser/devtools_network_transaction_factory.h"
|
||||||
#include "content/public/browser/network_service_instance.h"
|
#include "content/public/browser/network_service_instance.h"
|
||||||
|
@ -225,8 +226,8 @@ void URLRequestContextGetter::Handle::ShutdownOnUIThread() {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
if (main_request_context_getter_.get()) {
|
if (main_request_context_getter_.get()) {
|
||||||
if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) {
|
if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) {
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&URLRequestContextGetter::NotifyContextShuttingDown,
|
base::BindOnce(&URLRequestContextGetter::NotifyContextShuttingDown,
|
||||||
base::RetainedRef(main_request_context_getter_),
|
base::RetainedRef(main_request_context_getter_),
|
||||||
std::move(resource_context_)));
|
std::move(resource_context_)));
|
||||||
|
@ -340,7 +341,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
|
|
||||||
scoped_refptr<base::SingleThreadTaskRunner>
|
scoped_refptr<base::SingleThreadTaskRunner>
|
||||||
URLRequestContextGetter::GetNetworkTaskRunner() const {
|
URLRequestContextGetter::GetNetworkTaskRunner() const {
|
||||||
return BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
|
return base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include "base/guid.h"
|
#include "base/guid.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "net/base/io_buffer.h"
|
#include "net/base/io_buffer.h"
|
||||||
|
@ -87,8 +89,7 @@ void BeforeStartInUI(base::WeakPtr<URLRequestFetchJob> job,
|
||||||
mate::Dictionary options;
|
mate::Dictionary options;
|
||||||
if (!args->GetNext(&value) ||
|
if (!args->GetNext(&value) ||
|
||||||
!mate::ConvertFromV8(args->isolate(), value, &options)) {
|
!mate::ConvertFromV8(args->isolate(), value, &options)) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
|
||||||
base::BindOnce(&URLRequestFetchJob::OnError, job,
|
base::BindOnce(&URLRequestFetchJob::OnError, job,
|
||||||
net::ERR_NOT_IMPLEMENTED));
|
net::ERR_NOT_IMPLEMENTED));
|
||||||
return;
|
return;
|
||||||
|
@ -125,8 +126,8 @@ void BeforeStartInUI(base::WeakPtr<URLRequestFetchJob> job,
|
||||||
|
|
||||||
JsAsker::IsErrorOptions(request_options.get(), &error);
|
JsAsker::IsErrorOptions(request_options.get(), &error);
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&URLRequestFetchJob::StartAsync, job,
|
base::BindOnce(&URLRequestFetchJob::StartAsync, job,
|
||||||
base::RetainedRef(url_request_context_getter),
|
base::RetainedRef(url_request_context_getter),
|
||||||
base::RetainedRef(custom_browser_context),
|
base::RetainedRef(custom_browser_context),
|
||||||
|
@ -144,8 +145,8 @@ URLRequestFetchJob::~URLRequestFetchJob() = default;
|
||||||
void URLRequestFetchJob::Start() {
|
void URLRequestFetchJob::Start() {
|
||||||
auto request_details = std::make_unique<base::DictionaryValue>();
|
auto request_details = std::make_unique<base::DictionaryValue>();
|
||||||
FillRequestDetails(request_details.get(), request());
|
FillRequestDetails(request_details.get(), request());
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||||
handler(), std::move(request_details),
|
handler(), std::move(request_details),
|
||||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/filter/gzip_source_stream.h"
|
#include "net/filter/gzip_source_stream.h"
|
||||||
|
@ -32,8 +34,8 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStreamJob> job,
|
||||||
bool ended = false;
|
bool ended = false;
|
||||||
if (!args->GetNext(&value) || !value->IsObject()) {
|
if (!args->GetNext(&value) || !value->IsObject()) {
|
||||||
// Invalid opts.
|
// Invalid opts.
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&URLRequestStreamJob::OnError, job, net::ERR_FAILED));
|
base::BindOnce(&URLRequestStreamJob::OnError, job, net::ERR_FAILED));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -65,8 +67,8 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStreamJob> job,
|
||||||
// "data" was explicitly passed as null or undefined, assume the user wants
|
// "data" was explicitly passed as null or undefined, assume the user wants
|
||||||
// to send an empty body.
|
// to send an empty body.
|
||||||
ended = true;
|
ended = true;
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&URLRequestStreamJob::StartAsync, job, nullptr,
|
base::BindOnce(&URLRequestStreamJob::StartAsync, job, nullptr,
|
||||||
base::RetainedRef(response_headers), ended, error));
|
base::RetainedRef(response_headers), ended, error));
|
||||||
return;
|
return;
|
||||||
|
@ -76,8 +78,8 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStreamJob> job,
|
||||||
if (!data.Get("on", &value) || !value->IsFunction() ||
|
if (!data.Get("on", &value) || !value->IsFunction() ||
|
||||||
!data.Get("removeListener", &value) || !value->IsFunction()) {
|
!data.Get("removeListener", &value) || !value->IsFunction()) {
|
||||||
// If data is passed but it is not a stream, signal an error.
|
// If data is passed but it is not a stream, signal an error.
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&URLRequestStreamJob::OnError, job, net::ERR_FAILED));
|
base::BindOnce(&URLRequestStreamJob::OnError, job, net::ERR_FAILED));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,8 +87,8 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStreamJob> job,
|
||||||
auto subscriber = std::make_unique<mate::StreamSubscriber>(
|
auto subscriber = std::make_unique<mate::StreamSubscriber>(
|
||||||
args->isolate(), data.GetHandle(), job);
|
args->isolate(), data.GetHandle(), job);
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
base::BindOnce(&URLRequestStreamJob::StartAsync, job,
|
base::BindOnce(&URLRequestStreamJob::StartAsync, job,
|
||||||
std::move(subscriber), base::RetainedRef(response_headers),
|
std::move(subscriber), base::RetainedRef(response_headers),
|
||||||
ended, error));
|
ended, error));
|
||||||
|
@ -113,8 +115,8 @@ URLRequestStreamJob::~URLRequestStreamJob() {
|
||||||
void URLRequestStreamJob::Start() {
|
void URLRequestStreamJob::Start() {
|
||||||
auto request_details = std::make_unique<base::DictionaryValue>();
|
auto request_details = std::make_unique<base::DictionaryValue>();
|
||||||
FillRequestDetails(request_details.get(), request());
|
FillRequestDetails(request_details.get(), request());
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||||
handler(), std::move(request_details),
|
handler(), std::move(request_details),
|
||||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include "atom/common/atom_constants.h"
|
#include "atom/common/atom_constants.h"
|
||||||
#include "atom/common/native_mate_converters/net_converter.h"
|
#include "atom/common/native_mate_converters/net_converter.h"
|
||||||
#include "atom/common/native_mate_converters/v8_value_converter.h"
|
#include "atom/common/native_mate_converters/v8_value_converter.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
|
|
||||||
|
@ -36,8 +38,7 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStringJob> job,
|
||||||
error = net::ERR_NOT_IMPLEMENTED;
|
error = net::ERR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
|
||||||
content::BrowserThread::IO, FROM_HERE,
|
|
||||||
base::BindOnce(&URLRequestStringJob::StartAsync, job,
|
base::BindOnce(&URLRequestStringJob::StartAsync, job,
|
||||||
std::move(request_options), error));
|
std::move(request_options), error));
|
||||||
}
|
}
|
||||||
|
@ -54,8 +55,8 @@ URLRequestStringJob::~URLRequestStringJob() = default;
|
||||||
void URLRequestStringJob::Start() {
|
void URLRequestStringJob::Start() {
|
||||||
auto request_details = std::make_unique<base::DictionaryValue>();
|
auto request_details = std::make_unique<base::DictionaryValue>();
|
||||||
FillRequestDetails(request_details.get(), request());
|
FillRequestDetails(request_details.get(), request());
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
base::BindOnce(&JsAsker::AskForOptions, base::Unretained(isolate()),
|
||||||
handler(), std::move(request_details),
|
handler(), std::move(request_details),
|
||||||
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
base::Bind(&BeforeStartInUI, weak_factory_.GetWeakPtr())));
|
||||||
|
|
|
@ -37,13 +37,13 @@ void NodeDebugger::Start() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
auto options = std::make_shared<node::DebugOptions>();
|
node::DebugOptions options;
|
||||||
std::vector<std::string> exec_args;
|
std::vector<std::string> exec_args;
|
||||||
std::vector<std::string> v8_args;
|
std::vector<std::string> v8_args;
|
||||||
std::vector<std::string> errors;
|
std::vector<std::string> errors;
|
||||||
|
|
||||||
node::options_parser::DebugOptionsParser::instance.Parse(
|
node::options_parser::DebugOptionsParser::instance.Parse(
|
||||||
&args, &exec_args, &v8_args, options.get(),
|
&args, &exec_args, &v8_args, &options,
|
||||||
node::options_parser::kDisallowedInEnvironment, &errors);
|
node::options_parser::kDisallowedInEnvironment, &errors);
|
||||||
|
|
||||||
if (!errors.empty()) {
|
if (!errors.empty()) {
|
||||||
|
@ -54,13 +54,14 @@ void NodeDebugger::Start() {
|
||||||
|
|
||||||
// Set process._debugWaitConnect if --inspect-brk was specified to stop
|
// Set process._debugWaitConnect if --inspect-brk was specified to stop
|
||||||
// the debugger on the first line
|
// the debugger on the first line
|
||||||
if (options->wait_for_connect()) {
|
if (options.wait_for_connect()) {
|
||||||
mate::Dictionary process(env_->isolate(), env_->process_object());
|
mate::Dictionary process(env_->isolate(), env_->process_object());
|
||||||
process.Set("_breakFirstLine", true);
|
process.Set("_breakFirstLine", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* path = "";
|
const char* path = "";
|
||||||
if (inspector->Start(path, options, true /* is_main */))
|
if (inspector->Start(path, options, env_->inspector_host_port(),
|
||||||
|
true /* is_main */))
|
||||||
DCHECK(env_->inspector_agent()->IsListening());
|
DCHECK(env_->inspector_agent()->IsListening());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "content/public/browser/notification_event_dispatcher.h"
|
#include "content/public/browser/notification_event_dispatcher.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/common/notification_resources.h"
|
#include "third_party/blink/public/common/notifications/notification_resources.h"
|
||||||
#include "content/public/common/platform_notification_data.h"
|
#include "third_party/blink/public/common/notifications/platform_notification_data.h"
|
||||||
#include "third_party/skia/include/core/SkBitmap.h"
|
#include "third_party/skia/include/core/SkBitmap.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -21,7 +21,7 @@ namespace {
|
||||||
|
|
||||||
void OnWebNotificationAllowed(base::WeakPtr<Notification> notification,
|
void OnWebNotificationAllowed(base::WeakPtr<Notification> notification,
|
||||||
const SkBitmap& icon,
|
const SkBitmap& icon,
|
||||||
const content::PlatformNotificationData& data,
|
const blink::PlatformNotificationData& data,
|
||||||
bool audio_muted,
|
bool audio_muted,
|
||||||
bool allowed) {
|
bool allowed) {
|
||||||
if (!notification)
|
if (!notification)
|
||||||
|
@ -82,8 +82,8 @@ void PlatformNotificationService::DisplayNotification(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const std::string& notification_id,
|
const std::string& notification_id,
|
||||||
const GURL& origin,
|
const GURL& origin,
|
||||||
const content::PlatformNotificationData& notification_data,
|
const blink::PlatformNotificationData& notification_data,
|
||||||
const content::NotificationResources& notification_resources) {
|
const blink::NotificationResources& notification_resources) {
|
||||||
auto* presenter = browser_client_->GetNotificationPresenter();
|
auto* presenter = browser_client_->GetNotificationPresenter();
|
||||||
if (!presenter)
|
if (!presenter)
|
||||||
return;
|
return;
|
||||||
|
@ -104,8 +104,8 @@ void PlatformNotificationService::DisplayPersistentNotification(
|
||||||
const std::string& notification_id,
|
const std::string& notification_id,
|
||||||
const GURL& service_worker_scope,
|
const GURL& service_worker_scope,
|
||||||
const GURL& origin,
|
const GURL& origin,
|
||||||
const content::PlatformNotificationData& notification_data,
|
const blink::PlatformNotificationData& notification_data,
|
||||||
const content::NotificationResources& notification_resources) {}
|
const blink::NotificationResources& notification_resources) {}
|
||||||
|
|
||||||
void PlatformNotificationService::ClosePersistentNotification(
|
void PlatformNotificationService::ClosePersistentNotification(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
|
|
|
@ -28,15 +28,15 @@ class PlatformNotificationService
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const std::string& notification_id,
|
const std::string& notification_id,
|
||||||
const GURL& origin,
|
const GURL& origin,
|
||||||
const content::PlatformNotificationData& notification_data,
|
const blink::PlatformNotificationData& notification_data,
|
||||||
const content::NotificationResources& notification_resources) override;
|
const blink::NotificationResources& notification_resources) override;
|
||||||
void DisplayPersistentNotification(
|
void DisplayPersistentNotification(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const std::string& notification_id,
|
const std::string& notification_id,
|
||||||
const GURL& service_worker_scope,
|
const GURL& service_worker_scope,
|
||||||
const GURL& origin,
|
const GURL& origin,
|
||||||
const content::PlatformNotificationData& notification_data,
|
const blink::PlatformNotificationData& notification_data,
|
||||||
const content::NotificationResources& notification_resources) override;
|
const blink::NotificationResources& notification_resources) override;
|
||||||
void ClosePersistentNotification(content::BrowserContext* browser_context,
|
void ClosePersistentNotification(content::BrowserContext* browser_context,
|
||||||
const std::string& notification_id) override;
|
const std::string& notification_id) override;
|
||||||
void CloseNotification(content::BrowserContext* browser_context,
|
void CloseNotification(content::BrowserContext* browser_context,
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "content/public/common/platform_notification_data.h"
|
|
||||||
#include "third_party/skia/include/core/SkBitmap.h"
|
#include "third_party/skia/include/core/SkBitmap.h"
|
||||||
#include "ui/gfx/codec/png_codec.h"
|
#include "ui/gfx/codec/png_codec.h"
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "atom/common/application_info.h"
|
#include "atom/common/application_info.h"
|
||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
|
||||||
using ABI::Windows::Data::Xml::Dom::IXmlAttribute;
|
using ABI::Windows::Data::Xml::Dom::IXmlAttribute;
|
||||||
|
@ -411,8 +413,8 @@ ToastEventHandler::~ToastEventHandler() {}
|
||||||
IFACEMETHODIMP ToastEventHandler::Invoke(
|
IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||||
IInspectable* args) {
|
IInspectable* args) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::Bind(&Notification::NotificationClicked, notification_));
|
base::Bind(&Notification::NotificationClicked, notification_));
|
||||||
if (IsDebuggingNotifications())
|
if (IsDebuggingNotifications())
|
||||||
LOG(INFO) << "Notification clicked";
|
LOG(INFO) << "Notification clicked";
|
||||||
|
@ -423,8 +425,8 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||||
IFACEMETHODIMP ToastEventHandler::Invoke(
|
IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||||
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) {
|
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::Bind(&Notification::NotificationDismissed, notification_));
|
base::Bind(&Notification::NotificationDismissed, notification_));
|
||||||
if (IsDebuggingNotifications())
|
if (IsDebuggingNotifications())
|
||||||
LOG(INFO) << "Notification dismissed";
|
LOG(INFO) << "Notification dismissed";
|
||||||
|
@ -435,8 +437,8 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||||
IFACEMETHODIMP ToastEventHandler::Invoke(
|
IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||||
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) {
|
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::Bind(&Notification::NotificationFailed, notification_));
|
base::Bind(&Notification::NotificationFailed, notification_));
|
||||||
if (IsDebuggingNotifications())
|
if (IsDebuggingNotifications())
|
||||||
LOG(INFO) << "Notification failed";
|
LOG(INFO) << "Notification failed";
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/single_thread_task_runner.h"
|
#include "base/single_thread_task_runner.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "components/viz/common/features.h"
|
#include "components/viz/common/features.h"
|
||||||
#include "components/viz/common/frame_sinks/copy_output_request.h"
|
#include "components/viz/common/frame_sinks/copy_output_request.h"
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||||
#include "content/common/view_messages.h"
|
#include "content/common/view_messages.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/context_factory.h"
|
#include "content/public/browser/context_factory.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
|
@ -168,8 +170,8 @@ class AtomCopyFrameGenerator {
|
||||||
base::TimeDelta next_frame_in = next_frame_time_ - now;
|
base::TimeDelta next_frame_in = next_frame_time_ - now;
|
||||||
if (next_frame_in > frame_duration_ / 4) {
|
if (next_frame_in > frame_duration_ / 4) {
|
||||||
next_frame_time_ += frame_duration_;
|
next_frame_time_ += frame_duration_;
|
||||||
content::BrowserThread::PostDelayedTask(
|
base::PostDelayedTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomCopyFrameGenerator::OnCopyFrameCaptureSuccess,
|
base::BindOnce(&AtomCopyFrameGenerator::OnCopyFrameCaptureSuccess,
|
||||||
weak_ptr_factory_.GetWeakPtr(), damage_rect, bitmap),
|
weak_ptr_factory_.GetWeakPtr(), damage_rect, bitmap),
|
||||||
next_frame_in);
|
next_frame_in);
|
||||||
|
@ -188,8 +190,8 @@ class AtomCopyFrameGenerator {
|
||||||
const bool force_frame = (++frame_retry_count_ <= kFrameRetryLimit);
|
const bool force_frame = (++frame_retry_count_ <= kFrameRetryLimit);
|
||||||
if (force_frame) {
|
if (force_frame) {
|
||||||
// Retry with the same |damage_rect|.
|
// Retry with the same |damage_rect|.
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&AtomCopyFrameGenerator::GenerateCopyFrame,
|
base::BindOnce(&AtomCopyFrameGenerator::GenerateCopyFrame,
|
||||||
weak_ptr_factory_.GetWeakPtr(), damage_rect));
|
weak_ptr_factory_.GetWeakPtr(), damage_rect));
|
||||||
}
|
}
|
||||||
|
@ -222,8 +224,8 @@ class AtomBeginFrameTimer : public viz::DelayBasedTimeSourceClient {
|
||||||
const base::Closure& callback)
|
const base::Closure& callback)
|
||||||
: callback_(callback) {
|
: callback_(callback) {
|
||||||
time_source_.reset(new viz::DelayBasedTimeSource(
|
time_source_.reset(new viz::DelayBasedTimeSource(
|
||||||
content::BrowserThread::GetTaskRunnerForThread(
|
base::CreateSingleThreadTaskRunnerWithTraits(
|
||||||
content::BrowserThread::UI)
|
{content::BrowserThread::UI})
|
||||||
.get()));
|
.get()));
|
||||||
time_source_->SetTimebaseAndInterval(
|
time_source_->SetTimebaseAndInterval(
|
||||||
base::TimeTicks(),
|
base::TimeTicks(),
|
||||||
|
@ -1005,8 +1007,8 @@ void OffScreenRenderWidgetHostView::ReleaseResize() {
|
||||||
hold_resize_ = false;
|
hold_resize_ = false;
|
||||||
if (pending_resize_) {
|
if (pending_resize_) {
|
||||||
pending_resize_ = false;
|
pending_resize_ = false;
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(
|
base::BindOnce(
|
||||||
&OffScreenRenderWidgetHostView::SynchronizeVisualProperties,
|
&OffScreenRenderWidgetHostView::SynchronizeVisualProperties,
|
||||||
weak_ptr_factory_.GetWeakPtr()));
|
weak_ptr_factory_.GetWeakPtr()));
|
||||||
|
@ -1110,8 +1112,8 @@ void OffScreenRenderWidgetHostView::SendMouseWheelEvent(
|
||||||
// Scrolling outside of the popup widget so destroy it.
|
// Scrolling outside of the popup widget so destroy it.
|
||||||
// Execute asynchronously to avoid deleting the widget from inside some
|
// Execute asynchronously to avoid deleting the widget from inside some
|
||||||
// other callback.
|
// other callback.
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&OffScreenRenderWidgetHostView::CancelWidget,
|
base::BindOnce(&OffScreenRenderWidgetHostView::CancelWidget,
|
||||||
popup_host_view_->weak_ptr_factory_.GetWeakPtr()));
|
popup_host_view_->weak_ptr_factory_.GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,12 +166,6 @@ void OffScreenWebContentsView::RenderViewHostChanged(
|
||||||
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {}
|
void OffScreenWebContentsView::SetOverscrollControllerEnabled(bool enabled) {}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void OffScreenWebContentsView::SetAllowOtherViews(bool allow) {}
|
|
||||||
|
|
||||||
bool OffScreenWebContentsView::GetAllowOtherViews() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OffScreenWebContentsView::IsEventTracking() const {
|
bool OffScreenWebContentsView::IsEventTracking() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,6 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
||||||
void SetOverscrollControllerEnabled(bool enabled) override;
|
void SetOverscrollControllerEnabled(bool enabled) override;
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void SetAllowOtherViews(bool allow) override;
|
|
||||||
bool GetAllowOtherViews() const override;
|
|
||||||
bool IsEventTracking() const override;
|
bool IsEventTracking() const override;
|
||||||
void CloseTabAfterEventTracking() override;
|
void CloseTabAfterEventTracking() override;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "base/memory/read_only_shared_memory_region.h"
|
#include "base/memory/read_only_shared_memory_region.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "base/memory/ref_counted_memory.h"
|
#include "base/memory/ref_counted_memory.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/printing/print_job_manager.h"
|
#include "chrome/browser/printing/print_job_manager.h"
|
||||||
#include "chrome/browser/printing/printer_query.h"
|
#include "chrome/browser/printing/printer_query.h"
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
#include "components/printing/browser/print_manager_utils.h"
|
#include "components/printing/browser/print_manager_utils.h"
|
||||||
#include "components/printing/common/print_messages.h"
|
#include "components/printing/common/print_messages.h"
|
||||||
#include "components/services/pdf_compositor/public/cpp/pdf_service_mojo_types.h"
|
#include "components/services/pdf_compositor/public/cpp/pdf_service_mojo_types.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
|
@ -38,24 +40,12 @@ void StopWorker(int document_cookie) {
|
||||||
scoped_refptr<printing::PrinterQuery> printer_query =
|
scoped_refptr<printing::PrinterQuery> printer_query =
|
||||||
queue->PopPrinterQuery(document_cookie);
|
queue->PopPrinterQuery(document_cookie);
|
||||||
if (printer_query.get()) {
|
if (printer_query.get()) {
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::BindOnce(&printing::PrinterQuery::StopWorker, printer_query));
|
base::BindOnce(&printing::PrinterQuery::StopWorker, printer_query));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<base::RefCountedMemory> GetDataFromHandle(
|
|
||||||
base::SharedMemoryHandle handle,
|
|
||||||
uint32_t data_size) {
|
|
||||||
auto shared_buf = std::make_unique<base::SharedMemory>(handle, true);
|
|
||||||
if (!shared_buf->Map(data_size)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base::MakeRefCounted<base::RefCountedSharedMemory>(
|
|
||||||
std::move(shared_buf), data_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
PrintPreviewMessageHandler::PrintPreviewMessageHandler(
|
PrintPreviewMessageHandler::PrintPreviewMessageHandler(
|
||||||
|
@ -97,7 +87,7 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting(
|
||||||
StopWorker(params.document_cookie);
|
StopWorker(params.document_cookie);
|
||||||
|
|
||||||
const PrintHostMsg_DidPrintContent_Params& content = params.content;
|
const PrintHostMsg_DidPrintContent_Params& content = params.content;
|
||||||
if (!content.metafile_data_handle.IsValid() ||
|
if (!content.metafile_data_region.IsValid() ||
|
||||||
params.expected_pages_count <= 0) {
|
params.expected_pages_count <= 0) {
|
||||||
RunPrintToPDFCallback(ids.request_id, nullptr);
|
RunPrintToPDFCallback(ids.request_id, nullptr);
|
||||||
return;
|
return;
|
||||||
|
@ -114,7 +104,8 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting(
|
||||||
} else {
|
} else {
|
||||||
RunPrintToPDFCallback(
|
RunPrintToPDFCallback(
|
||||||
ids.request_id,
|
ids.request_id,
|
||||||
GetDataFromHandle(content.metafile_data_handle, content.data_size));
|
base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(
|
||||||
|
content.metafile_data_region));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,18 +77,10 @@
|
||||||
|
|
||||||
auto* inspectable_web_contents =
|
auto* inspectable_web_contents =
|
||||||
inspectableWebContentsView_->inspectable_web_contents();
|
inspectableWebContentsView_->inspectable_web_contents();
|
||||||
auto* webContents = inspectable_web_contents->GetWebContents();
|
|
||||||
auto* devToolsWebContents =
|
auto* devToolsWebContents =
|
||||||
inspectable_web_contents->GetDevToolsWebContents();
|
inspectable_web_contents->GetDevToolsWebContents();
|
||||||
auto devToolsView = devToolsWebContents->GetNativeView();
|
auto devToolsView = devToolsWebContents->GetNativeView();
|
||||||
|
|
||||||
if (visible && devtools_docked_) {
|
|
||||||
webContents->SetAllowOtherViews(true);
|
|
||||||
devToolsWebContents->SetAllowOtherViews(true);
|
|
||||||
} else if (!inspectable_web_contents->IsGuest()) {
|
|
||||||
webContents->SetAllowOtherViews(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
devtools_visible_ = visible;
|
devtools_visible_ = visible;
|
||||||
if (devtools_docked_) {
|
if (devtools_docked_) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "ui/base/accelerators/accelerator.h"
|
#include "ui/base/accelerators/accelerator.h"
|
||||||
#include "ui/base/accelerators/platform_accelerator_cocoa.h"
|
#include "ui/base/accelerators/platform_accelerator_cocoa.h"
|
||||||
|
@ -124,7 +126,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
||||||
isMenuOpen_ = NO;
|
isMenuOpen_ = NO;
|
||||||
model_->MenuWillClose();
|
model_->MenuWillClose();
|
||||||
if (!closeCallback.is_null()) {
|
if (!closeCallback.is_null()) {
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, closeCallback);
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closeCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +337,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
||||||
// Post async task so that itemSelected runs before the close callback
|
// Post async task so that itemSelected runs before the close callback
|
||||||
// deletes the controller from the map which deallocates it
|
// deletes the controller from the map which deallocates it
|
||||||
if (!closeCallback.is_null()) {
|
if (!closeCallback.is_null()) {
|
||||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, closeCallback);
|
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closeCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#define ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_
|
#define ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_
|
||||||
|
|
||||||
#include "atom/browser/ui/cocoa/event_dispatching_window.h"
|
#include "atom/browser/ui/cocoa/event_dispatching_window.h"
|
||||||
#include "ui/views/cocoa/native_widget_mac_nswindow.h"
|
|
||||||
#include "ui/views/widget/native_widget_mac.h"
|
#include "ui/views/widget/native_widget_mac.h"
|
||||||
|
#include "ui/views_bridge_mac/native_widget_mac_nswindow.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include <Quartz/Quartz.h>
|
#include <Quartz/Quartz.h>
|
||||||
|
|
||||||
#include "ui/views/cocoa/views_nswindow_delegate.h"
|
#include "ui/views_bridge_mac/views_nswindow_delegate.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
class NativeWindowMac;
|
class NativeWindowMac;
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
||||||
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
|
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
#include "ui/views/cocoa/bridged_native_widget.h"
|
|
||||||
#include "ui/views/widget/native_widget_mac.h"
|
#include "ui/views/widget/native_widget_mac.h"
|
||||||
|
#include "ui/views_bridge_mac/bridged_native_widget_impl.h"
|
||||||
|
|
||||||
@implementation AtomNSWindowDelegate
|
@implementation AtomNSWindowDelegate
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@
|
||||||
// on the fly.
|
// on the fly.
|
||||||
// TODO(zcbenz): Add interface in NativeWidgetMac to allow overriding creating
|
// TODO(zcbenz): Add interface in NativeWidgetMac to allow overriding creating
|
||||||
// window delegate.
|
// window delegate.
|
||||||
views::BridgedNativeWidget* bridged_view =
|
auto* bridged_view = views::BridgedNativeWidgetImpl::GetFromNativeWindow(
|
||||||
views::NativeWidgetMac::GetBridgeForNativeWindow(
|
|
||||||
shell->GetNativeWindow());
|
shell->GetNativeWindow());
|
||||||
if ((self = [super initWithBridgedNativeWidget:bridged_view])) {
|
if ((self = [super initWithBridgedNativeWidget:bridged_view])) {
|
||||||
shell_ = shell;
|
shell_ = shell;
|
||||||
|
@ -248,8 +247,7 @@
|
||||||
// Clears the delegate when window is going to be closed, since EL Capitan it
|
// Clears the delegate when window is going to be closed, since EL Capitan it
|
||||||
// is possible that the methods of delegate would get called after the window
|
// is possible that the methods of delegate would get called after the window
|
||||||
// has been closed.
|
// has been closed.
|
||||||
views::BridgedNativeWidget* bridged_view =
|
auto* bridged_view = views::BridgedNativeWidgetImpl::GetFromNativeWindow(
|
||||||
views::NativeWidgetMac::GetBridgeForNativeWindow(
|
|
||||||
shell_->GetNativeWindow());
|
shell_->GetNativeWindow());
|
||||||
bridged_view->OnWindowWillClose();
|
bridged_view->OnWindowWillClose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "content/public/common/user_agent.h"
|
#include "content/public/common/user_agent.h"
|
||||||
#include "content/shell/grit/shell_resources.h"
|
#include "electron/grit/electron_resources.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/socket/stream_socket.h"
|
#include "net/socket/stream_socket.h"
|
||||||
#include "net/socket/tcp_server_socket.h"
|
#include "net/socket/tcp_server_socket.h"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "atom/browser/ui/devtools_ui.h"
|
#include "atom/browser/ui/devtools_ui.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/memory/ref_counted_memory.h"
|
#include "base/memory/ref_counted_memory.h"
|
||||||
|
@ -56,6 +57,7 @@ std::string GetMimeTypeForPath(const std::string& path) {
|
||||||
class BundledDataSource : public content::URLDataSource {
|
class BundledDataSource : public content::URLDataSource {
|
||||||
public:
|
public:
|
||||||
BundledDataSource() {}
|
BundledDataSource() {}
|
||||||
|
~BundledDataSource() override {}
|
||||||
|
|
||||||
// content::URLDataSource implementation.
|
// content::URLDataSource implementation.
|
||||||
std::string GetSource() const override { return kChromeUIDevToolsHost; }
|
std::string GetSource() const override { return kChromeUIDevToolsHost; }
|
||||||
|
@ -104,7 +106,6 @@ class BundledDataSource : public content::URLDataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~BundledDataSource() override {}
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(BundledDataSource);
|
DISALLOW_COPY_AND_ASSIGN(BundledDataSource);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,7 +115,8 @@ DevToolsUI::DevToolsUI(content::BrowserContext* browser_context,
|
||||||
content::WebUI* web_ui)
|
content::WebUI* web_ui)
|
||||||
: WebUIController(web_ui) {
|
: WebUIController(web_ui) {
|
||||||
web_ui->SetBindings(0);
|
web_ui->SetBindings(0);
|
||||||
content::URLDataSource::Add(browser_context, new BundledDataSource());
|
content::URLDataSource::Add(browser_context,
|
||||||
|
std::make_unique<BundledDataSource>());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "chrome/browser/ui/libgtkui/gtk_signal.h"
|
|
||||||
#include "chrome/browser/ui/libgtkui/gtk_util.h"
|
#include "chrome/browser/ui/libgtkui/gtk_util.h"
|
||||||
|
#include "ui/base/glib/glib_signal.h"
|
||||||
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
|
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
|
||||||
|
|
||||||
namespace file_dialog {
|
namespace file_dialog {
|
||||||
|
@ -147,7 +147,11 @@ class FileChooserDialog {
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHROMEGTK_CALLBACK_1(FileChooserDialog, void, OnFileDialogResponse, int);
|
CHROMEG_CALLBACK_1(FileChooserDialog,
|
||||||
|
void,
|
||||||
|
OnFileDialogResponse,
|
||||||
|
GtkWidget*,
|
||||||
|
int);
|
||||||
|
|
||||||
GtkWidget* dialog() const { return dialog_; }
|
GtkWidget* dialog() const { return dialog_; }
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,15 @@
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "components/prefs/pref_registry_simple.h"
|
#include "components/prefs/pref_registry_simple.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
#include "components/prefs/scoped_user_pref_update.h"
|
#include "components/prefs/scoped_user_pref_update.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
#include "content/public/browser/file_select_listener.h"
|
||||||
#include "content/public/browser/host_zoom_map.h"
|
#include "content/public/browser/host_zoom_map.h"
|
||||||
#include "content/public/browser/navigation_handle.h"
|
#include "content/public/browser/navigation_handle.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
|
@ -175,8 +178,8 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
|
||||||
base::Value* id = new base::Value(stream_id_);
|
base::Value* id = new base::Value(stream_id_);
|
||||||
base::Value* chunk_value = new base::Value(chunk);
|
base::Value* chunk_value = new base::Value(chunk);
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::BindOnce(&InspectableWebContentsImpl::CallClientFunction, bindings_,
|
base::BindOnce(&InspectableWebContentsImpl::CallClientFunction, bindings_,
|
||||||
"DevToolsAPI.streamWrite", base::Owned(id),
|
"DevToolsAPI.streamWrite", base::Owned(id),
|
||||||
base::Owned(chunk_value), nullptr));
|
base::Owned(chunk_value), nullptr));
|
||||||
|
@ -426,7 +429,7 @@ void InspectableWebContentsImpl::ActivateWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::CloseWindow() {
|
void InspectableWebContentsImpl::CloseWindow() {
|
||||||
GetDevToolsWebContents()->DispatchBeforeUnload();
|
GetDevToolsWebContents()->DispatchBeforeUnload(false /* auto_cancel */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::LoadCompleted() {
|
void InspectableWebContentsImpl::LoadCompleted() {
|
||||||
|
@ -801,19 +804,20 @@ content::ColorChooser* InspectableWebContentsImpl::OpenColorChooser(
|
||||||
|
|
||||||
void InspectableWebContentsImpl::RunFileChooser(
|
void InspectableWebContentsImpl::RunFileChooser(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const content::FileChooserParams& params) {
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
|
const blink::mojom::FileChooserParams& params) {
|
||||||
auto* delegate = web_contents_->GetDelegate();
|
auto* delegate = web_contents_->GetDelegate();
|
||||||
if (delegate)
|
if (delegate)
|
||||||
delegate->RunFileChooser(render_frame_host, params);
|
delegate->RunFileChooser(render_frame_host, std::move(listener), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::EnumerateDirectory(
|
void InspectableWebContentsImpl::EnumerateDirectory(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
int request_id,
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
auto* delegate = web_contents_->GetDelegate();
|
auto* delegate = web_contents_->GetDelegate();
|
||||||
if (delegate)
|
if (delegate)
|
||||||
delegate->EnumerateDirectory(source, request_id, path);
|
delegate->EnumerateDirectory(source, std::move(listener), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::OnWebContentsFocused(
|
void InspectableWebContentsImpl::OnWebContentsFocused(
|
||||||
|
|
|
@ -191,9 +191,10 @@ class InspectableWebContentsImpl
|
||||||
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions)
|
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions)
|
||||||
override;
|
override;
|
||||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||||
const content::FileChooserParams& params) override;
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
|
const blink::mojom::FileChooserParams& params) override;
|
||||||
void EnumerateDirectory(content::WebContents* source,
|
void EnumerateDirectory(content::WebContents* source,
|
||||||
int request_id,
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
const base::FilePath& path) override;
|
const base::FilePath& path) override;
|
||||||
|
|
||||||
// net::URLFetcherDelegate:
|
// net::URLFetcherDelegate:
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "chrome/browser/ui/libgtkui/gtk_signal.h"
|
|
||||||
#include "chrome/browser/ui/libgtkui/gtk_util.h"
|
#include "chrome/browser/ui/libgtkui/gtk_util.h"
|
||||||
#include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
|
#include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
|
||||||
|
#include "ui/base/glib/glib_signal.h"
|
||||||
#include "ui/gfx/image/image_skia.h"
|
#include "ui/gfx/image/image_skia.h"
|
||||||
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
|
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
|
||||||
|
|
||||||
|
@ -168,8 +168,8 @@ class GtkMessageBox : public NativeWindowObserver {
|
||||||
parent_ = nullptr;
|
parent_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHROMEGTK_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, int);
|
CHROMEG_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, GtkWidget*, int);
|
||||||
CHROMEGTK_CALLBACK_0(GtkMessageBox, void, OnCheckboxToggled);
|
CHROMEG_CALLBACK_0(GtkMessageBox, void, OnCheckboxToggled, GtkWidget*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
atom::UnresponsiveSuppressor unresponsive_suppressor_;
|
atom::UnresponsiveSuppressor unresponsive_suppressor_;
|
||||||
|
|
|
@ -17,8 +17,10 @@
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "base/win/scoped_gdi_object.h"
|
#include "base/win/scoped_gdi_object.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "ui/gfx/icon_util.h"
|
#include "ui/gfx/icon_util.h"
|
||||||
#include "ui/gfx/image/image_skia.h"
|
#include "ui/gfx/image/image_skia.h"
|
||||||
|
@ -222,8 +224,7 @@ void RunMessageBoxInNewThread(base::Thread* thread,
|
||||||
int result = ShowTaskDialogUTF8(parent, type, buttons, default_id, cancel_id,
|
int result = ShowTaskDialogUTF8(parent, type, buttons, default_id, cancel_id,
|
||||||
options, title, message, detail,
|
options, title, message, detail,
|
||||||
checkbox_label, &checkbox_checked, icon);
|
checkbox_label, &checkbox_checked, icon);
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
|
||||||
base::Bind(callback, result, checkbox_checked));
|
base::Bind(callback, result, checkbox_checked));
|
||||||
content::BrowserThread::DeleteSoon(content::BrowserThread::UI, FROM_HERE,
|
content::BrowserThread::DeleteSoon(content::BrowserThread::UI, FROM_HERE,
|
||||||
thread);
|
thread);
|
||||||
|
|
|
@ -201,7 +201,7 @@ void AutofillPopupView::DrawAutofillEntry(gfx::Canvas* canvas,
|
||||||
canvas->DrawStringRectWithFlags(
|
canvas->DrawStringRectWithFlags(
|
||||||
popup_->GetLabelAt(index), popup_->GetLabelFontListForRow(index),
|
popup_->GetLabelAt(index), popup_->GetLabelFontListForRow(index),
|
||||||
GetNativeTheme()->GetSystemColor(
|
GetNativeTheme()->GetSystemColor(
|
||||||
ui::NativeTheme::kColorId_ResultsTableNormalDimmedText),
|
ui::NativeTheme::kColorId_ResultsTableDimmedText),
|
||||||
gfx::Rect(label_x_align_left, entry_rect.y(), label_width,
|
gfx::Rect(label_x_align_left, entry_rect.y(), label_width,
|
||||||
entry_rect.height()),
|
entry_rect.height()),
|
||||||
text_align);
|
text_align);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "atom/browser/ui/views/menu_bar.h"
|
#include "atom/browser/ui/views/menu_bar.h"
|
||||||
#include "atom/browser/ui/views/menu_model_adapter.h"
|
#include "atom/browser/ui/views/menu_model_adapter.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "ui/views/controls/button/menu_button.h"
|
#include "ui/views/controls/button/menu_button.h"
|
||||||
#include "ui/views/controls/menu/menu_item_view.h"
|
#include "ui/views/controls/menu/menu_item_view.h"
|
||||||
|
@ -130,8 +132,8 @@ views::MenuItemView* MenuDelegate::GetSiblingMenu(
|
||||||
button_to_open_ = button;
|
button_to_open_ = button;
|
||||||
// Switching menu asyncnously to avoid crash.
|
// Switching menu asyncnously to avoid crash.
|
||||||
if (!switch_in_progress) {
|
if (!switch_in_progress) {
|
||||||
content::BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
content::BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {content::BrowserThread::UI},
|
||||||
base::Bind(&views::MenuRunner::Cancel,
|
base::Bind(&views::MenuRunner::Cancel,
|
||||||
base::Unretained(menu_runner_.get())));
|
base::Unretained(menu_runner_.get())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,14 @@
|
||||||
#include "atom/common/api/api_messages.h"
|
#include "atom/common/api/api_messages.h"
|
||||||
#include "atom/common/atom_constants.h"
|
#include "atom/common/atom_constants.h"
|
||||||
#include "base/sequenced_task_runner_helpers.h"
|
#include "base/sequenced_task_runner_helpers.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "content/browser/loader/resource_dispatcher_host_impl.h"
|
#include "content/browser/loader/resource_dispatcher_host_impl.h"
|
||||||
#include "content/browser/loader/resource_request_info_impl.h"
|
#include "content/browser/loader/resource_request_info_impl.h"
|
||||||
#include "content/browser/loader/stream_resource_handler.h"
|
#include "content/browser/loader/stream_resource_handler.h"
|
||||||
#include "content/browser/resource_context_impl.h"
|
#include "content/browser/resource_context_impl.h"
|
||||||
#include "content/browser/streams/stream.h"
|
#include "content/browser/streams/stream.h"
|
||||||
#include "content/browser/streams/stream_context.h"
|
#include "content/browser/streams/stream_context.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
|
@ -183,8 +185,8 @@ class PdfViewerUI::ResourceRequester
|
||||||
new net::HttpResponseHeaders(headers->raw_headers());
|
new net::HttpResponseHeaders(headers->raw_headers());
|
||||||
stream_info_->mime_type = mime_type;
|
stream_info_->mime_type = mime_type;
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::Bind(&CallMigrationCallback<StreamResponseCallback>,
|
base::Bind(&CallMigrationCallback<StreamResponseCallback>,
|
||||||
base::Passed(&stream_response_cb_),
|
base::Passed(&stream_response_cb_),
|
||||||
base::Passed(&stream_info_)));
|
base::Passed(&stream_info_)));
|
||||||
|
@ -243,8 +245,8 @@ void PdfViewerUI::RenderFrameCreated(content::RenderFrameHost* rfh) {
|
||||||
auto callback =
|
auto callback =
|
||||||
base::BindOnce(&PdfViewerUI::OnPdfStreamCreated, base::Unretained(this));
|
base::BindOnce(&PdfViewerUI::OnPdfStreamCreated, base::Unretained(this));
|
||||||
resource_requester_ = new ResourceRequester(std::move(callback));
|
resource_requester_ = new ResourceRequester(std::move(callback));
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::Bind(&ResourceRequester::StartRequest, resource_requester_,
|
base::Bind(&ResourceRequester::StartRequest, resource_requester_,
|
||||||
GURL(src_), GURL(kPdfViewerUIOrigin), render_process_id,
|
GURL(src_), GURL(kPdfViewerUIOrigin), render_process_id,
|
||||||
render_view_id, render_frame_id, resource_context));
|
render_view_id, render_frame_id, resource_context));
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "atom/browser/web_dialog_helper.h"
|
#include "atom/browser/web_dialog_helper.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
|
@ -16,23 +17,29 @@
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
|
#include "content/public/browser/file_select_listener.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.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/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/file_chooser_file_info.h"
|
|
||||||
#include "content/public/common/file_chooser_params.h"
|
|
||||||
#include "net/base/mime_util.h"
|
#include "net/base/mime_util.h"
|
||||||
#include "ui/shell_dialogs/selected_file_info.h"
|
#include "ui/shell_dialogs/selected_file_info.h"
|
||||||
|
|
||||||
|
using blink::mojom::FileChooserFileInfo;
|
||||||
|
using blink::mojom::FileChooserFileInfoPtr;
|
||||||
|
using blink::mojom::FileChooserParams;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
||||||
public content::WebContentsObserver {
|
public content::WebContentsObserver {
|
||||||
public:
|
public:
|
||||||
FileSelectHelper(content::RenderFrameHost* render_frame_host,
|
FileSelectHelper(content::RenderFrameHost* render_frame_host,
|
||||||
const content::FileChooserParams::Mode& mode)
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
: render_frame_host_(render_frame_host), mode_(mode) {
|
blink::mojom::FileChooserParams::Mode mode)
|
||||||
|
: render_frame_host_(render_frame_host),
|
||||||
|
listener_(std::move(listener)),
|
||||||
|
mode_(mode) {
|
||||||
auto* web_contents =
|
auto* web_contents =
|
||||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||||
content::WebContentsObserver::Observe(web_contents);
|
content::WebContentsObserver::Observe(web_contents);
|
||||||
|
@ -61,13 +68,12 @@ class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
||||||
void OnOpenDialogDone(bool result, const std::vector<base::FilePath>& paths)
|
void OnOpenDialogDone(bool result, const std::vector<base::FilePath>& paths)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
std::vector<content::FileChooserFileInfo> file_info;
|
std::vector<FileChooserFileInfoPtr> file_info;
|
||||||
if (result) {
|
if (result) {
|
||||||
for (auto& path : paths) {
|
for (auto& path : paths) {
|
||||||
content::FileChooserFileInfo info;
|
file_info.push_back(FileChooserFileInfo::NewNativeFile(
|
||||||
info.file_path = path;
|
blink::mojom::NativeFileInfo::New(
|
||||||
info.display_name = path.BaseName().value();
|
path, path.BaseName().AsUTF16Unsafe())));
|
||||||
file_info.push_back(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (render_frame_host_ && !paths.empty()) {
|
if (render_frame_host_ && !paths.empty()) {
|
||||||
|
@ -77,7 +83,7 @@ class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
||||||
paths[0].DirName());
|
paths[0].DirName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnFilesSelected(file_info);
|
OnFilesSelected(std::move(file_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MAS_BUILD)
|
#if defined(MAS_BUILD)
|
||||||
|
@ -88,20 +94,22 @@ class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
||||||
void OnSaveDialogDone(bool result, const base::FilePath& path)
|
void OnSaveDialogDone(bool result, const base::FilePath& path)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
std::vector<content::FileChooserFileInfo> file_info;
|
std::vector<FileChooserFileInfoPtr> file_info;
|
||||||
if (result) {
|
if (result) {
|
||||||
content::FileChooserFileInfo info;
|
file_info.push_back(
|
||||||
info.file_path = path;
|
FileChooserFileInfo::NewNativeFile(blink::mojom::NativeFileInfo::New(
|
||||||
info.display_name = path.BaseName().value();
|
path, path.BaseName().AsUTF16Unsafe())));
|
||||||
file_info.push_back(info);
|
|
||||||
}
|
}
|
||||||
OnFilesSelected(file_info);
|
OnFilesSelected(std::move(file_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnFilesSelected(
|
void OnFilesSelected(std::vector<FileChooserFileInfoPtr> file_info) {
|
||||||
const std::vector<content::FileChooserFileInfo>& file_info) {
|
if (listener_) {
|
||||||
if (render_frame_host_)
|
listener_->FileSelected(std::move(file_info), mode_);
|
||||||
render_frame_host_->FilesSelectedInChooser(file_info, mode_);
|
listener_.reset();
|
||||||
|
}
|
||||||
|
render_frame_host_ = nullptr;
|
||||||
|
Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
// content::WebContentsObserver:
|
// content::WebContentsObserver:
|
||||||
|
@ -121,7 +129,8 @@ class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
||||||
void WebContentsDestroyed() override { render_frame_host_ = nullptr; }
|
void WebContentsDestroyed() override { render_frame_host_ = nullptr; }
|
||||||
|
|
||||||
content::RenderFrameHost* render_frame_host_;
|
content::RenderFrameHost* render_frame_host_;
|
||||||
content::FileChooserParams::Mode mode_;
|
std::unique_ptr<content::FileSelectListener> listener_;
|
||||||
|
blink::mojom::FileChooserParams::Mode mode_;
|
||||||
};
|
};
|
||||||
|
|
||||||
file_dialog::Filters GetFileTypesFromAcceptType(
|
file_dialog::Filters GetFileTypesFromAcceptType(
|
||||||
|
@ -201,31 +210,30 @@ WebDialogHelper::~WebDialogHelper() {}
|
||||||
|
|
||||||
void WebDialogHelper::RunFileChooser(
|
void WebDialogHelper::RunFileChooser(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const content::FileChooserParams& params) {
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
std::vector<content::FileChooserFileInfo> result;
|
const blink::mojom::FileChooserParams& params) {
|
||||||
|
|
||||||
file_dialog::DialogSettings settings;
|
file_dialog::DialogSettings settings;
|
||||||
settings.force_detached = offscreen_;
|
settings.force_detached = offscreen_;
|
||||||
settings.filters = GetFileTypesFromAcceptType(params.accept_types);
|
settings.filters = GetFileTypesFromAcceptType(params.accept_types);
|
||||||
settings.parent_window = window_;
|
settings.parent_window = window_;
|
||||||
settings.title = base::UTF16ToUTF8(params.title);
|
settings.title = base::UTF16ToUTF8(params.title);
|
||||||
|
|
||||||
scoped_refptr<FileSelectHelper> file_select_helper(
|
scoped_refptr<FileSelectHelper> file_select_helper(new FileSelectHelper(
|
||||||
new FileSelectHelper(render_frame_host, params.mode));
|
render_frame_host, std::move(listener), params.mode));
|
||||||
if (params.mode == content::FileChooserParams::Save) {
|
if (params.mode == FileChooserParams::Mode::kSave) {
|
||||||
settings.default_path = params.default_file_name;
|
settings.default_path = params.default_file_name;
|
||||||
file_select_helper->ShowSaveDialog(settings);
|
file_select_helper->ShowSaveDialog(settings);
|
||||||
} else {
|
} else {
|
||||||
int flags = file_dialog::FILE_DIALOG_CREATE_DIRECTORY;
|
int flags = file_dialog::FILE_DIALOG_CREATE_DIRECTORY;
|
||||||
switch (params.mode) {
|
switch (params.mode) {
|
||||||
case content::FileChooserParams::OpenMultiple:
|
case FileChooserParams::Mode::kOpenMultiple:
|
||||||
flags |= file_dialog::FILE_DIALOG_MULTI_SELECTIONS;
|
flags |= file_dialog::FILE_DIALOG_MULTI_SELECTIONS;
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case content::FileChooserParams::Open:
|
case FileChooserParams::Mode::kOpen:
|
||||||
flags |= file_dialog::FILE_DIALOG_OPEN_FILE;
|
flags |= file_dialog::FILE_DIALOG_OPEN_FILE;
|
||||||
flags |= file_dialog::FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY;
|
flags |= file_dialog::FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY;
|
||||||
break;
|
break;
|
||||||
case content::FileChooserParams::UploadFolder:
|
case FileChooserParams::Mode::kUploadFolder:
|
||||||
flags |= file_dialog::FILE_DIALOG_OPEN_DIRECTORY;
|
flags |= file_dialog::FILE_DIALOG_OPEN_DIRECTORY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -242,20 +250,23 @@ void WebDialogHelper::RunFileChooser(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebDialogHelper::EnumerateDirectory(content::WebContents* web_contents,
|
void WebDialogHelper::EnumerateDirectory(
|
||||||
int request_id,
|
content::WebContents* web_contents,
|
||||||
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
const base::FilePath& dir) {
|
const base::FilePath& dir) {
|
||||||
int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES |
|
int types = base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES |
|
||||||
base::FileEnumerator::INCLUDE_DOT_DOT;
|
base::FileEnumerator::INCLUDE_DOT_DOT;
|
||||||
base::FileEnumerator file_enum(dir, false, types);
|
base::FileEnumerator file_enum(dir, false, types);
|
||||||
|
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
std::vector<base::FilePath> paths;
|
std::vector<FileChooserFileInfoPtr> file_info;
|
||||||
while (!(path = file_enum.Next()).empty())
|
while (!(path = file_enum.Next()).empty()) {
|
||||||
paths.push_back(path);
|
file_info.push_back(FileChooserFileInfo::NewNativeFile(
|
||||||
|
blink::mojom::NativeFileInfo::New(path, base::string16())));
|
||||||
|
}
|
||||||
|
|
||||||
web_contents->GetRenderViewHost()->DirectoryEnumerationFinished(request_id,
|
listener->FileSelected(std::move(file_info),
|
||||||
paths);
|
FileChooserParams::Mode::kUploadFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -5,14 +5,17 @@
|
||||||
#ifndef ATOM_BROWSER_WEB_DIALOG_HELPER_H_
|
#ifndef ATOM_BROWSER_WEB_DIALOG_HELPER_H_
|
||||||
#define ATOM_BROWSER_WEB_DIALOG_HELPER_H_
|
#define ATOM_BROWSER_WEB_DIALOG_HELPER_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
|
#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class FilePath;
|
class FilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
struct FileChooserParams;
|
class FileSelectListener;
|
||||||
class RenderFrameHost;
|
class RenderFrameHost;
|
||||||
class WebContents;
|
class WebContents;
|
||||||
} // namespace content
|
} // namespace content
|
||||||
|
@ -27,9 +30,10 @@ class WebDialogHelper {
|
||||||
~WebDialogHelper();
|
~WebDialogHelper();
|
||||||
|
|
||||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||||
const content::FileChooserParams& params);
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
|
const blink::mojom::FileChooserParams& params);
|
||||||
void EnumerateDirectory(content::WebContents* web_contents,
|
void EnumerateDirectory(content::WebContents* web_contents,
|
||||||
int request_id,
|
std::unique_ptr<content::FileSelectListener> listener,
|
||||||
const base::FilePath& path);
|
const base::FilePath& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "native_mate/wrappable.h"
|
#include "native_mate/wrappable.h"
|
||||||
|
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
#include "atom_natives.h" // NOLINT: This file is generated with js2c.
|
#include "third_party/electron_node/src/node_native_module.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -122,23 +122,15 @@ void InitAsarSupport(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> source,
|
v8::Local<v8::Value> source,
|
||||||
v8::Local<v8::Value> require) {
|
v8::Local<v8::Value> require) {
|
||||||
// Evaluate asar_init.js.
|
// Evaluate asar_init.js.
|
||||||
v8::Local<v8::Context> context(isolate->GetCurrentContext());
|
std::vector<v8::Local<v8::String>> asar_init_params = {
|
||||||
auto maybe_asar_init = v8::Script::Compile(
|
node::FIXED_ONE_BYTE_STRING(isolate, "source"),
|
||||||
context, node::asar_init_value.ToStringChecked(isolate));
|
node::FIXED_ONE_BYTE_STRING(isolate, "require")};
|
||||||
v8::Local<v8::Script> asar_init;
|
|
||||||
v8::Local<v8::Value> result;
|
|
||||||
if (maybe_asar_init.ToLocal(&asar_init))
|
|
||||||
result = asar_init->Run(context).ToLocalChecked();
|
|
||||||
|
|
||||||
// Initialize asar support.
|
std::vector<v8::Local<v8::Value>> asar_init_args = {source, require};
|
||||||
DCHECK(result->IsFunction());
|
|
||||||
|
|
||||||
v8::Local<v8::Value> args[] = {
|
node::per_process::native_module_loader.CompileAndCall(
|
||||||
source,
|
isolate->GetCurrentContext(), "electron/js2c/asar_init",
|
||||||
require,
|
&asar_init_params, &asar_init_args, nullptr);
|
||||||
node::asar_value.ToStringChecked(isolate),
|
|
||||||
};
|
|
||||||
result.As<v8::Function>()->Call(result, 3, args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize(v8::Local<v8::Object> exports,
|
void Initialize(v8::Local<v8::Object> exports,
|
||||||
|
|
|
@ -22,7 +22,9 @@ struct Converter<CrashReporter::UploadReportResult> {
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
const CrashReporter::UploadReportResult& reports) {
|
const CrashReporter::UploadReportResult& reports) {
|
||||||
mate::Dictionary dict(isolate, v8::Object::New(isolate));
|
mate::Dictionary dict(isolate, v8::Object::New(isolate));
|
||||||
dict.Set("date", v8::Date::New(isolate, reports.first * 1000.0));
|
dict.Set("date",
|
||||||
|
v8::Date::New(isolate->GetCurrentContext(), reports.first * 1000.0)
|
||||||
|
.ToLocalChecked());
|
||||||
dict.Set("id", reports.second);
|
dict.Set("id", reports.second);
|
||||||
return dict.GetHandle();
|
return dict.GetHandle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ v8::Local<v8::Value> NativeImage::ToPNG(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkBitmap bitmap =
|
const SkBitmap bitmap =
|
||||||
image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap();
|
image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap();
|
||||||
std::vector<unsigned char> encoded;
|
std::vector<unsigned char> encoded;
|
||||||
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &encoded);
|
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &encoded);
|
||||||
const char* data = reinterpret_cast<char*>(encoded.data());
|
const char* data = reinterpret_cast<char*>(encoded.data());
|
||||||
|
@ -285,7 +285,7 @@ v8::Local<v8::Value> NativeImage::ToBitmap(mate::Arguments* args) {
|
||||||
float scale_factor = GetScaleFactorFromOptions(args);
|
float scale_factor = GetScaleFactorFromOptions(args);
|
||||||
|
|
||||||
const SkBitmap bitmap =
|
const SkBitmap bitmap =
|
||||||
image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap();
|
image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap();
|
||||||
SkPixelRef* ref = bitmap.pixelRef();
|
SkPixelRef* ref = bitmap.pixelRef();
|
||||||
if (!ref)
|
if (!ref)
|
||||||
return node::Buffer::New(args->isolate(), 0).ToLocalChecked();
|
return node::Buffer::New(args->isolate(), 0).ToLocalChecked();
|
||||||
|
@ -317,14 +317,14 @@ std::string NativeImage::ToDataURL(mate::Arguments* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return webui::GetBitmapDataUrl(
|
return webui::GetBitmapDataUrl(
|
||||||
image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap());
|
image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap());
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> NativeImage::GetBitmap(mate::Arguments* args) {
|
v8::Local<v8::Value> NativeImage::GetBitmap(mate::Arguments* args) {
|
||||||
float scale_factor = GetScaleFactorFromOptions(args);
|
float scale_factor = GetScaleFactorFromOptions(args);
|
||||||
|
|
||||||
const SkBitmap bitmap =
|
const SkBitmap bitmap =
|
||||||
image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap();
|
image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap();
|
||||||
SkPixelRef* ref = bitmap.pixelRef();
|
SkPixelRef* ref = bitmap.pixelRef();
|
||||||
if (!ref)
|
if (!ref)
|
||||||
return node::Buffer::New(args->isolate(), 0).ToLocalChecked();
|
return node::Buffer::New(args->isolate(), 0).ToLocalChecked();
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "third_party/blink/public/platform/web_mouse_event.h"
|
#include "third_party/blink/public/platform/web_mouse_event.h"
|
||||||
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
|
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
|
||||||
#include "third_party/blink/public/web/web_device_emulation_params.h"
|
#include "third_party/blink/public/web/web_device_emulation_params.h"
|
||||||
#include "third_party/blink/public/web/web_find_options.h"
|
|
||||||
#include "ui/base/clipboard/clipboard.h"
|
#include "ui/base/clipboard/clipboard.h"
|
||||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||||
#include "ui/events/keycodes/keyboard_code_conversion.h"
|
#include "ui/events/keycodes/keyboard_code_conversion.h"
|
||||||
|
@ -368,19 +367,6 @@ bool Converter<blink::WebDeviceEmulationParams>::FromV8(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Converter<blink::WebFindOptions>::FromV8(v8::Isolate* isolate,
|
|
||||||
v8::Local<v8::Value> val,
|
|
||||||
blink::WebFindOptions* out) {
|
|
||||||
mate::Dictionary dict;
|
|
||||||
if (!ConvertFromV8(isolate, val, &dict))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
dict.Get("forward", &out->forward);
|
|
||||||
dict.Get("matchCase", &out->match_case);
|
|
||||||
dict.Get("findNext", &out->find_next);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
v8::Local<v8::Value> Converter<blink::WebContextMenuData::MediaType>::ToV8(
|
v8::Local<v8::Value> Converter<blink::WebContextMenuData::MediaType>::ToV8(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
|
|
|
@ -15,7 +15,6 @@ class WebMouseEvent;
|
||||||
class WebMouseWheelEvent;
|
class WebMouseWheelEvent;
|
||||||
class WebKeyboardEvent;
|
class WebKeyboardEvent;
|
||||||
struct WebDeviceEmulationParams;
|
struct WebDeviceEmulationParams;
|
||||||
struct WebFindOptions;
|
|
||||||
struct WebFloatPoint;
|
struct WebFloatPoint;
|
||||||
struct WebPoint;
|
struct WebPoint;
|
||||||
struct WebSize;
|
struct WebSize;
|
||||||
|
@ -95,13 +94,6 @@ struct Converter<blink::WebDeviceEmulationParams> {
|
||||||
blink::WebDeviceEmulationParams* out);
|
blink::WebDeviceEmulationParams* out);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
struct Converter<blink::WebFindOptions> {
|
|
||||||
static bool FromV8(v8::Isolate* isolate,
|
|
||||||
v8::Local<v8::Value> val,
|
|
||||||
blink::WebFindOptions* out);
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct Converter<blink::WebContextMenuData::MediaType> {
|
struct Converter<blink::WebContextMenuData::MediaType> {
|
||||||
static v8::Local<v8::Value> ToV8(
|
static v8::Local<v8::Value> ToV8(
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#undef LIKELY
|
#undef LIKELY
|
||||||
#undef arraysize
|
#undef arraysize
|
||||||
#undef debug_string // This is defined in macOS SDK in AssertMacros.h.
|
#undef debug_string // This is defined in macOS SDK in AssertMacros.h.
|
||||||
|
#undef require_string // This is defined in macOS SDK in AssertMacros.h.
|
||||||
#include "env-inl.h"
|
#include "env-inl.h"
|
||||||
#include "env.h"
|
#include "env.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "native_mate/object_template_builder.h"
|
#include "native_mate/object_template_builder.h"
|
||||||
#include "third_party/blink/public/platform/web_cache.h"
|
#include "third_party/blink/public/platform/web_cache.h"
|
||||||
|
#include "third_party/blink/public/web/web_custom_element.h"
|
||||||
#include "third_party/blink/public/web/web_document.h"
|
#include "third_party/blink/public/web/web_document.h"
|
||||||
#include "third_party/blink/public/web/web_element.h"
|
#include "third_party/blink/public/web/web_element.h"
|
||||||
#include "third_party/blink/public/web/web_frame_widget.h"
|
#include "third_party/blink/public/web/web_frame_widget.h"
|
||||||
|
@ -188,13 +189,15 @@ void WebFrame::SetLayoutZoomLevelLimits(double min_level, double max_level) {
|
||||||
web_frame_->View()->ZoomLimitsChanged(min_level, max_level);
|
web_frame_->View()->ZoomLimitsChanged(min_level, max_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement(
|
void WebFrame::AllowGuestViewElementDefinition(
|
||||||
v8::Local<v8::Object> context,
|
v8::Local<v8::Object> context,
|
||||||
const base::string16& name,
|
v8::Local<v8::Function> register_cb) {
|
||||||
v8::Local<v8::Object> options) {
|
v8::HandleScope handle_scope(isolate());
|
||||||
v8::Context::Scope context_scope(context->CreationContext());
|
v8::Context::Scope context_scope(context->CreationContext());
|
||||||
return web_frame_->GetDocument().RegisterEmbedderCustomElement(
|
blink::WebCustomElement::EmbedderNamesAllowedScope embedder_names_scope;
|
||||||
blink::WebString::FromUTF16(name), options);
|
web_frame_->RequestExecuteV8Function(context->CreationContext(), register_cb,
|
||||||
|
v8::Null(isolate()), 0, nullptr,
|
||||||
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebFrame::GetWebFrameId(v8::Local<v8::Value> content_window) {
|
int WebFrame::GetWebFrameId(v8::Local<v8::Value> content_window) {
|
||||||
|
@ -491,8 +494,8 @@ void WebFrame::BuildPrototype(v8::Isolate* isolate,
|
||||||
&WebFrame::SetVisualZoomLevelLimits)
|
&WebFrame::SetVisualZoomLevelLimits)
|
||||||
.SetMethod("setLayoutZoomLevelLimits",
|
.SetMethod("setLayoutZoomLevelLimits",
|
||||||
&WebFrame::SetLayoutZoomLevelLimits)
|
&WebFrame::SetLayoutZoomLevelLimits)
|
||||||
.SetMethod("registerEmbedderCustomElement",
|
.SetMethod("allowGuestViewElementDefinition",
|
||||||
&WebFrame::RegisterEmbedderCustomElement)
|
&WebFrame::AllowGuestViewElementDefinition)
|
||||||
.SetMethod("getWebFrameId", &WebFrame::GetWebFrameId)
|
.SetMethod("getWebFrameId", &WebFrame::GetWebFrameId)
|
||||||
.SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider)
|
.SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider)
|
||||||
.SetMethod("registerURLSchemeAsBypassingCSP",
|
.SetMethod("registerURLSchemeAsBypassingCSP",
|
||||||
|
|
|
@ -50,10 +50,8 @@ class WebFrame : public mate::Wrappable<WebFrame> {
|
||||||
void SetVisualZoomLevelLimits(double min_level, double max_level);
|
void SetVisualZoomLevelLimits(double min_level, double max_level);
|
||||||
void SetLayoutZoomLevelLimits(double min_level, double max_level);
|
void SetLayoutZoomLevelLimits(double min_level, double max_level);
|
||||||
|
|
||||||
v8::Local<v8::Value> RegisterEmbedderCustomElement(
|
void AllowGuestViewElementDefinition(v8::Local<v8::Object> context,
|
||||||
v8::Local<v8::Object> context,
|
v8::Local<v8::Function> register_cb);
|
||||||
const base::string16& name,
|
|
||||||
v8::Local<v8::Object> options);
|
|
||||||
int GetWebFrameId(v8::Local<v8::Value> content_window);
|
int GetWebFrameId(v8::Local<v8::Value> content_window);
|
||||||
|
|
||||||
// Set the provider that will be used by SpellCheckClient for spell check.
|
// Set the provider that will be used by SpellCheckClient for spell check.
|
||||||
|
|
|
@ -177,7 +177,8 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutofillAgent::IsUserGesture() const {
|
bool AutofillAgent::IsUserGesture() const {
|
||||||
return blink::WebUserGestureIndicator::IsProcessingUserGesture();
|
return blink::WebUserGestureIndicator::IsProcessingUserGesture(
|
||||||
|
render_frame()->GetWebFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutofillAgent::HidePopup() {
|
void AutofillAgent::HidePopup() {
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
#include "third_party/blink/public/web/web_local_frame.h"
|
#include "third_party/blink/public/web/web_local_frame.h"
|
||||||
|
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
#include "atom_natives.h" // NOLINT: This file is generated with js2c
|
#include "third_party/electron_node/src/node_native_module.h"
|
||||||
#include "tracing/trace_event.h"
|
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -189,28 +188,20 @@ void AtomRendererClient::SetupMainWorldOverrides(
|
||||||
v8::Handle<v8::Context> context,
|
v8::Handle<v8::Context> context,
|
||||||
content::RenderFrame* render_frame) {
|
content::RenderFrame* render_frame) {
|
||||||
// Setup window overrides in the main world context
|
// Setup window overrides in the main world context
|
||||||
v8::Isolate* isolate = context->GetIsolate();
|
|
||||||
v8::HandleScope handle_scope(isolate);
|
|
||||||
v8::Context::Scope context_scope(context);
|
|
||||||
|
|
||||||
// Wrap the bundle into a function that receives the isolatedWorld as
|
// Wrap the bundle into a function that receives the isolatedWorld as
|
||||||
// an argument.
|
// an argument.
|
||||||
std::string left = "(function (nodeProcess, isolatedWorld) {\n";
|
auto* isolate = context->GetIsolate();
|
||||||
std::string right = "\n})";
|
std::vector<v8::Local<v8::String>> isolated_bundle_params = {
|
||||||
auto source = v8::String::Concat(
|
node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"),
|
||||||
isolate, mate::ConvertToV8(isolate, left)->ToString(isolate),
|
node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld")};
|
||||||
v8::String::Concat(isolate,
|
|
||||||
node::isolated_bundle_value.ToStringChecked(isolate),
|
|
||||||
mate::ConvertToV8(isolate, right)->ToString(isolate)));
|
|
||||||
auto result = RunScript(context, source);
|
|
||||||
DCHECK(result->IsFunction());
|
|
||||||
|
|
||||||
v8::Local<v8::Value> args[] = {
|
std::vector<v8::Local<v8::Value>> isolated_bundle_args = {
|
||||||
GetEnvironment(render_frame)->process_object(),
|
GetEnvironment(render_frame)->process_object(),
|
||||||
GetContext(render_frame->GetWebFrame(), isolate)->Global(),
|
GetContext(render_frame->GetWebFrame(), isolate)->Global()};
|
||||||
};
|
|
||||||
ignore_result(result.As<v8::Function>()->Call(context, v8::Null(isolate),
|
node::per_process::native_module_loader.CompileAndCall(
|
||||||
node::arraysize(args), args));
|
context, "electron/js2c/isolated_bundle", &isolated_bundle_params,
|
||||||
|
&isolated_bundle_args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
node::Environment* AtomRendererClient::GetEnvironment(
|
node::Environment* AtomRendererClient::GetEnvironment(
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
class Environment;
|
class Environment;
|
||||||
}
|
} // namespace node
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
#include "third_party/blink/public/web/web_document.h"
|
#include "third_party/blink/public/web/web_document.h"
|
||||||
|
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
#include "atom_natives.h" // NOLINT: This file is generated with js2c
|
#include "third_party/electron_node/src/node_binding.h"
|
||||||
|
#include "third_party/electron_node/src/node_native_module.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
|
||||||
return exports;
|
return exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* mod = node::get_builtin_module(module_key.c_str());
|
auto* mod = node::binding::get_builtin_module(module_key.c_str());
|
||||||
|
|
||||||
if (!mod) {
|
if (!mod) {
|
||||||
char errmsg[1024];
|
char errmsg[1024];
|
||||||
|
@ -182,30 +183,21 @@ void AtomSandboxedRendererClient::DidCreateScriptContext(
|
||||||
!IsDevToolsExtension(render_frame))
|
!IsDevToolsExtension(render_frame))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Wrap the bundle into a function that receives the binding object as
|
||||||
|
// argument.
|
||||||
auto* isolate = context->GetIsolate();
|
auto* isolate = context->GetIsolate();
|
||||||
v8::HandleScope handle_scope(isolate);
|
|
||||||
v8::Context::Scope context_scope(context);
|
|
||||||
// Wrap the bundle into a function that receives the binding object and the
|
|
||||||
// preload script path as arguments.
|
|
||||||
std::string left = "(function(binding, require) {\n";
|
|
||||||
std::string right = "\n})";
|
|
||||||
// Compile the wrapper and run it to get the function object
|
|
||||||
auto source = v8::String::Concat(
|
|
||||||
isolate, mate::ConvertToV8(isolate, left)->ToString(isolate),
|
|
||||||
v8::String::Concat(isolate,
|
|
||||||
node::preload_bundle_value.ToStringChecked(isolate),
|
|
||||||
mate::ConvertToV8(isolate, right)->ToString(isolate)));
|
|
||||||
auto result = RunScript(context, source);
|
|
||||||
|
|
||||||
DCHECK(result->IsFunction());
|
|
||||||
// Create and initialize the binding object
|
|
||||||
auto binding = v8::Object::New(isolate);
|
auto binding = v8::Object::New(isolate);
|
||||||
InitializeBindings(binding, context);
|
InitializeBindings(binding, context);
|
||||||
AddRenderBindings(isolate, binding);
|
AddRenderBindings(isolate, binding);
|
||||||
v8::Local<v8::Value> args[] = {binding};
|
|
||||||
// Execute the function with proper arguments
|
std::vector<v8::Local<v8::String>> preload_bundle_params = {
|
||||||
ignore_result(result.As<v8::Function>()->Call(context, v8::Null(isolate),
|
node::FIXED_ONE_BYTE_STRING(isolate, "binding")};
|
||||||
node::arraysize(args), args));
|
|
||||||
|
std::vector<v8::Local<v8::Value>> preload_bundle_args = {binding};
|
||||||
|
|
||||||
|
node::per_process::native_module_loader.CompileAndCall(
|
||||||
|
isolate->GetCurrentContext(), "electron/js2c/preload_bundle",
|
||||||
|
&preload_bundle_params, &preload_bundle_args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomSandboxedRendererClient::WillReleaseScriptContext(
|
void AtomSandboxedRendererClient::WillReleaseScriptContext(
|
||||||
|
|
|
@ -8,7 +8,7 @@ declare_args() {
|
||||||
# Allow running Electron as a node binary.
|
# Allow running Electron as a node binary.
|
||||||
enable_run_as_node = true
|
enable_run_as_node = true
|
||||||
|
|
||||||
enable_osr = true
|
enable_osr = false
|
||||||
|
|
||||||
enable_view_api = false
|
enable_view_api = false
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/resource_context.h"
|
#include "content/public/browser/resource_context.h"
|
||||||
#include "crypto/nss_util.h"
|
#include "crypto/nss_util.h"
|
||||||
|
@ -71,8 +73,8 @@ net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
|
||||||
void CertificateManagerModel::Create(content::BrowserContext* browser_context,
|
void CertificateManagerModel::Create(content::BrowserContext* browser_context,
|
||||||
const CreationCallback& callback) {
|
const CreationCallback& callback) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::Bind(&CertificateManagerModel::GetCertDBOnIOThread,
|
base::Bind(&CertificateManagerModel::GetCertDBOnIOThread,
|
||||||
browser_context->GetResourceContext(), callback));
|
browser_context->GetResourceContext(), callback));
|
||||||
}
|
}
|
||||||
|
@ -144,8 +146,8 @@ void CertificateManagerModel::DidGetCertDBOnIOThread(
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||||
|
|
||||||
bool is_user_db_available = !!cert_db->GetPublicSlot();
|
bool is_user_db_available = !!cert_db->GetPublicSlot();
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::UI, FROM_HERE,
|
FROM_HERE, {BrowserThread::UI},
|
||||||
base::Bind(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
|
base::Bind(&CertificateManagerModel::DidGetCertDBOnUIThread, cert_db,
|
||||||
is_user_db_available, callback));
|
is_user_db_available, callback));
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,12 +82,14 @@
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task/post_task.h"
|
||||||
#include "base/threading/platform_thread.h"
|
#include "base/threading/platform_thread.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "base/timer/timer.h"
|
#include "base/timer/timer.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
#include "content/public/browser/browser_task_traits.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "net/base/network_interfaces.h"
|
#include "net/base/network_interfaces.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
|
@ -702,8 +704,8 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK(
|
||||||
if (shutdown(fd_, SHUT_WR) < 0)
|
if (shutdown(fd_, SHUT_WR) < 0)
|
||||||
PLOG(ERROR) << "shutdown() failed";
|
PLOG(ERROR) << "shutdown() failed";
|
||||||
|
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::Bind(&ProcessSingleton::LinuxWatcher::RemoveSocketReader, parent_,
|
base::Bind(&ProcessSingleton::LinuxWatcher::RemoveSocketReader, parent_,
|
||||||
this));
|
this));
|
||||||
// We will be deleted once the posted RemoveSocketReader task runs.
|
// We will be deleted once the posted RemoveSocketReader task runs.
|
||||||
|
@ -882,8 +884,8 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() {
|
||||||
|
|
||||||
void ProcessSingleton::StartListeningOnSocket() {
|
void ProcessSingleton::StartListeningOnSocket() {
|
||||||
watcher_ = new LinuxWatcher(this);
|
watcher_ = new LinuxWatcher(this);
|
||||||
BrowserThread::PostTask(
|
base::PostTaskWithTraits(
|
||||||
BrowserThread::IO, FROM_HERE,
|
FROM_HERE, {BrowserThread::IO},
|
||||||
base::Bind(&ProcessSingleton::LinuxWatcher::StartListening, watcher_,
|
base::Bind(&ProcessSingleton::LinuxWatcher::StartListening, watcher_,
|
||||||
sock_));
|
sock_));
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ template("electron_extra_paks") {
|
||||||
"$root_gen_dir/components/components_resources.pak",
|
"$root_gen_dir/components/components_resources.pak",
|
||||||
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
||||||
"$root_gen_dir/content/content_resources.pak",
|
"$root_gen_dir/content/content_resources.pak",
|
||||||
"$root_gen_dir/content/shell/shell_resources.pak",
|
|
||||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||||
"$root_gen_dir/net/net_resources.pak",
|
"$root_gen_dir/net/net_resources.pak",
|
||||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||||
|
@ -67,7 +66,6 @@ template("electron_extra_paks") {
|
||||||
"//components/resources",
|
"//components/resources",
|
||||||
"//content:resources",
|
"//content:resources",
|
||||||
"//content/browser/tracing:resources",
|
"//content/browser/tracing:resources",
|
||||||
"//content/shell:copy_shell_resources",
|
|
||||||
"//electron:resources",
|
"//electron:resources",
|
||||||
"//mojo/public/js:resources",
|
"//mojo/public/js:resources",
|
||||||
"//net:net_resources",
|
"//net:net_resources",
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<includes>
|
<includes>
|
||||||
<include name="IDR_ELECTRON_CONTENT_BROWSER_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_browser_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
<include name="IDR_ELECTRON_CONTENT_BROWSER_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_browser_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||||
<include name="IDR_ELECTRON_CONTENT_PACKAGED_SERVICES_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_packaged_services_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
<include name="IDR_ELECTRON_CONTENT_PACKAGED_SERVICES_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_packaged_services_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||||
|
<include name="IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE" file="${target_gen_dir}\shell_devtools_discovery_page.html" use_base_dir="false" type="BINDATA" />
|
||||||
</includes>
|
</includes>
|
||||||
</release>
|
</release>
|
||||||
</grit>
|
</grit>
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
filenames = {
|
filenames = {
|
||||||
js2c_sources = [
|
|
||||||
"lib/common/asar.js",
|
|
||||||
"lib/common/asar_init.js",
|
|
||||||
]
|
|
||||||
|
|
||||||
js_sources = [
|
js_sources = [
|
||||||
"lib/browser/api/app.js",
|
"lib/browser/api/app.js",
|
||||||
"lib/browser/api/auto-updater.js",
|
"lib/browser/api/auto-updater.js",
|
||||||
|
@ -74,9 +69,10 @@ filenames = {
|
||||||
"lib/renderer/web-frame-init.js",
|
"lib/renderer/web-frame-init.js",
|
||||||
"lib/renderer/window-setup.js",
|
"lib/renderer/window-setup.js",
|
||||||
"lib/renderer/web-view/guest-view-internal.js",
|
"lib/renderer/web-view/guest-view-internal.js",
|
||||||
"lib/renderer/web-view/web-view.js",
|
|
||||||
"lib/renderer/web-view/web-view-attributes.js",
|
"lib/renderer/web-view/web-view-attributes.js",
|
||||||
"lib/renderer/web-view/web-view-constants.js",
|
"lib/renderer/web-view/web-view-constants.js",
|
||||||
|
"lib/renderer/web-view/web-view-element.js",
|
||||||
|
"lib/renderer/web-view/web-view-impl.js",
|
||||||
"lib/renderer/api/exports/electron.js",
|
"lib/renderer/api/exports/electron.js",
|
||||||
"lib/renderer/api/crash-reporter.js",
|
"lib/renderer/api/crash-reporter.js",
|
||||||
"lib/renderer/api/ipc-renderer.js",
|
"lib/renderer/api/ipc-renderer.js",
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
;(function () { // eslint-disable-line
|
/* global source, require */
|
||||||
return function (source, require, asarSource) {
|
|
||||||
// Expose fs module without asar support.
|
|
||||||
|
|
||||||
|
// Expose fs module without asar support.
|
||||||
// NB: Node's 'fs' and 'internal/fs/streams' have a lazy-loaded circular
|
// NB: Node's 'fs' and 'internal/fs/streams' have a lazy-loaded circular
|
||||||
// dependency. So to expose the unmodified Node 'fs' functionality here,
|
// dependency. So to expose the unmodified Node 'fs' functionality here,
|
||||||
// we have to copy both 'fs' *and* 'internal/fs/streams' and modify the
|
// we have to copy both 'fs' *and* 'internal/fs/streams' and modify the
|
||||||
// copies to depend on each other instead of on our asarified 'fs' code.
|
// copies to depend on each other instead of on our asarified 'fs' code.
|
||||||
source['original-fs'] = source.fs.replace("require('internal/fs/streams')", "require('original-fs/streams')")
|
source['original-fs'].replace("require('internal/fs/streams')", "require('original-fs/streams')")
|
||||||
source['original-fs/streams'] = source['internal/fs/streams'].replace("require('fs')", "require('original-fs')")
|
source['original-fs/streams'].replace("require('fs')", "require('original-fs')")
|
||||||
|
|
||||||
// Make asar.js accessible via "require".
|
|
||||||
source.ELECTRON_ASAR = asarSource
|
|
||||||
|
|
||||||
// Monkey-patch the fs module.
|
// Monkey-patch the fs module.
|
||||||
require('ELECTRON_ASAR').wrapFsWithAsar(require('fs'))
|
require('electron/js2c/asar').wrapFsWithAsar(require('fs'))
|
||||||
}
|
|
||||||
})()
|
|
||||||
|
|
|
@ -5,12 +5,13 @@
|
||||||
// Note: Don't use "process", as it will be replaced by browserify's one.
|
// Note: Don't use "process", as it will be replaced by browserify's one.
|
||||||
const v8Util = nodeProcess.atomBinding('v8_util')
|
const v8Util = nodeProcess.atomBinding('v8_util')
|
||||||
|
|
||||||
const setupWebView = v8Util.getHiddenValue(isolatedWorld, 'setup-webview')
|
const isolatedWorldArgs = v8Util.getHiddenValue(isolatedWorld, 'isolated-world-args')
|
||||||
if (setupWebView) {
|
const { webViewImpl, ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen } = isolatedWorldArgs
|
||||||
setupWebView(window)
|
|
||||||
|
if (webViewImpl) {
|
||||||
|
// Must setup the WebView element in main world.
|
||||||
|
const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element')
|
||||||
|
setupWebView(v8Util, webViewImpl)
|
||||||
}
|
}
|
||||||
|
|
||||||
const isolatedWorldArgs = v8Util.getHiddenValue(isolatedWorld, 'isolated-world-args')
|
|
||||||
const { ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen } = isolatedWorldArgs
|
|
||||||
|
|
||||||
require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen)
|
require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, isHiddenPage, usesNativeWindowOpen)
|
||||||
|
|
|
@ -50,17 +50,14 @@ const appPath = parseOption('app-path', null)
|
||||||
const guestInstanceId = parseOption('guest-instance-id', null, value => parseInt(value))
|
const guestInstanceId = parseOption('guest-instance-id', null, value => parseInt(value))
|
||||||
const openerId = parseOption('opener-id', null, value => parseInt(value))
|
const openerId = parseOption('opener-id', null, value => parseInt(value))
|
||||||
|
|
||||||
|
// The arguments to be passed to isolated world.
|
||||||
|
const isolatedWorldArgs = { ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen }
|
||||||
|
|
||||||
// The webContents preload script is loaded after the session preload scripts.
|
// The webContents preload script is loaded after the session preload scripts.
|
||||||
if (preloadScript) {
|
if (preloadScript) {
|
||||||
preloadScripts.push(preloadScript)
|
preloadScripts.push(preloadScript)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass the arguments to isolatedWorld.
|
|
||||||
if (contextIsolation) {
|
|
||||||
const isolatedWorldArgs = { ipcRenderer, guestInstanceId, isHiddenPage, openerId, usesNativeWindowOpen }
|
|
||||||
v8Util.setHiddenValue(global, 'isolated-world-args', isolatedWorldArgs)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window.location.protocol === 'chrome-devtools:') {
|
if (window.location.protocol === 'chrome-devtools:') {
|
||||||
// Override some inspector APIs.
|
// Override some inspector APIs.
|
||||||
require('@electron/internal/renderer/inspector')
|
require('@electron/internal/renderer/inspector')
|
||||||
|
@ -78,15 +75,21 @@ if (window.location.protocol === 'chrome-devtools:') {
|
||||||
|
|
||||||
// Load webview tag implementation.
|
// Load webview tag implementation.
|
||||||
if (webviewTag && guestInstanceId == null) {
|
if (webviewTag && guestInstanceId == null) {
|
||||||
const { setupWebView } = require('@electron/internal/renderer/web-view/web-view')
|
const webViewImpl = require('@electron/internal/renderer/web-view/web-view-impl')
|
||||||
if (contextIsolation) {
|
if (contextIsolation) {
|
||||||
v8Util.setHiddenValue(window, 'setup-webview', setupWebView)
|
Object.assign(isolatedWorldArgs, { webViewImpl })
|
||||||
} else {
|
} else {
|
||||||
setupWebView(window)
|
const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element')
|
||||||
|
setupWebView(v8Util, webViewImpl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pass the arguments to isolatedWorld.
|
||||||
|
if (contextIsolation) {
|
||||||
|
v8Util.setHiddenValue(global, 'isolated-world-args', isolatedWorldArgs)
|
||||||
|
}
|
||||||
|
|
||||||
if (nodeIntegration) {
|
if (nodeIntegration) {
|
||||||
// Export node bindings to global.
|
// Export node bindings to global.
|
||||||
global.require = require
|
global.require = require
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal')
|
const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal')
|
||||||
const { WebViewImpl } = require('@electron/internal/renderer/web-view/web-view')
|
const { WebViewImpl } = require('@electron/internal/renderer/web-view/web-view-impl')
|
||||||
const webViewConstants = require('@electron/internal/renderer/web-view/web-view-constants')
|
const webViewConstants = require('@electron/internal/renderer/web-view/web-view-constants')
|
||||||
const errorUtils = require('@electron/internal/common/error-utils')
|
const errorUtils = require('@electron/internal/common/error-utils')
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue