mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
115 Commits
nikwen/iss
...
v6.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c322b7349 | ||
|
|
b2ea1bc517 | ||
|
|
16250493b8 | ||
|
|
08887e016c | ||
|
|
aadcce0907 | ||
|
|
9b5353309d | ||
|
|
76303502a6 | ||
|
|
cf07904338 | ||
|
|
8f1e28b59c | ||
|
|
10d0268070 | ||
|
|
7871e18232 | ||
|
|
ceb3792f3c | ||
|
|
65a4bdd87a | ||
|
|
7094870a44 | ||
|
|
cee99b5f2d | ||
|
|
ac86d362ba | ||
|
|
2233a9eb5a | ||
|
|
af24a4f364 | ||
|
|
a78692f5b8 | ||
|
|
335178098d | ||
|
|
ddc0e8f7ba | ||
|
|
80fa2449a1 | ||
|
|
476abafefe | ||
|
|
f7d4d51261 | ||
|
|
7b08510075 | ||
|
|
14b62b28ce | ||
|
|
1c44ed0912 | ||
|
|
de1edf3f4d | ||
|
|
a21ffa027a | ||
|
|
899d42563c | ||
|
|
6eecbb5edd | ||
|
|
6a8e7a10ea | ||
|
|
85bb488732 | ||
|
|
c957215854 | ||
|
|
2ba3a26785 | ||
|
|
f0dc3bc79f | ||
|
|
28d3edcd92 | ||
|
|
8026dee591 | ||
|
|
197cda9e45 | ||
|
|
903fd4e5e9 | ||
|
|
621c86b4cf | ||
|
|
deda7c700f | ||
|
|
d225304370 | ||
|
|
fd22b7ec2a | ||
|
|
a2b1d394b5 | ||
|
|
7d4c78e73e | ||
|
|
b37ff2b822 | ||
|
|
5887f5aa4f | ||
|
|
a9176a2ac8 | ||
|
|
6ceb431942 | ||
|
|
508d131c95 | ||
|
|
ae36659f7a | ||
|
|
f970660766 | ||
|
|
43c5837cda | ||
|
|
a87e88df20 | ||
|
|
5a5d4b06b3 | ||
|
|
28ba88ba70 | ||
|
|
4f8ffe934e | ||
|
|
c5c0a7abc5 | ||
|
|
84b762f0b3 | ||
|
|
043838f9b6 | ||
|
|
a824e92628 | ||
|
|
1843411e79 | ||
|
|
da76c4d7c5 | ||
|
|
4468b86a81 | ||
|
|
8acbb9a3ad | ||
|
|
f5e28bc999 | ||
|
|
b45ad7f74e | ||
|
|
9e9238454e | ||
|
|
3f2aba69ee | ||
|
|
371e804c6b | ||
|
|
6131e89aa9 | ||
|
|
c54b67300e | ||
|
|
e847f048d7 | ||
|
|
b5955fa663 | ||
|
|
a648e6c06d | ||
|
|
e6216da031 | ||
|
|
5b7bd56367 | ||
|
|
01b1c0ca8b | ||
|
|
05ced19f9f | ||
|
|
b8ef669905 | ||
|
|
212ce1840f | ||
|
|
e090fa94d0 | ||
|
|
a431f1a663 | ||
|
|
ea6815c0f7 | ||
|
|
40e05eef23 | ||
|
|
a790e702f5 | ||
|
|
be16a195fb | ||
|
|
2f10c0fd6d | ||
|
|
276c07d3d7 | ||
|
|
57f7c8b6b9 | ||
|
|
2ce22ba0e9 | ||
|
|
7186c62a27 | ||
|
|
bf88a13f1e | ||
|
|
6e9c540baf | ||
|
|
24b14d55ef | ||
|
|
3b8eb6c061 | ||
|
|
f9b7f6389e | ||
|
|
8f30faacf8 | ||
|
|
f631890237 | ||
|
|
8982889a8d | ||
|
|
cd3539aaf8 | ||
|
|
275e277721 | ||
|
|
283b1241d5 | ||
|
|
7bdea26085 | ||
|
|
f1fa589779 | ||
|
|
7226ad1eba | ||
|
|
d92743f0f3 | ||
|
|
2c309efef4 | ||
|
|
0b418315a3 | ||
|
|
2f474867c7 | ||
|
|
0b5acd9569 | ||
|
|
3419c3c730 | ||
|
|
754200f1b1 | ||
|
|
37f4bd4dd0 |
@@ -176,6 +176,22 @@ step-restore-brew-cache: &step-restore-brew-cache
|
||||
keys:
|
||||
- v1-brew-cache-{{ arch }}
|
||||
|
||||
step-get-more-space-on-mac: &step-get-more-space-on-mac
|
||||
run:
|
||||
name: Free up space on MacOS
|
||||
command: |
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
sudo rm -rf /Library/Developer/CoreSimulator
|
||||
fi
|
||||
|
||||
step-delete-git-directories: &step-delete-git-directories
|
||||
run:
|
||||
name: Delete src/.git directory on MacOS to free space
|
||||
command: |
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
sudo rm -rf src/.git
|
||||
fi
|
||||
|
||||
# On macOS the npm install command during gclient sync was run on a linux
|
||||
# machine and therefore installed a slightly different set of dependencies
|
||||
# Notably "fsevents" is a macOS only dependency, we rerun npm install once
|
||||
@@ -535,6 +551,7 @@ steps-checkout: &steps-checkout
|
||||
- *step-depot-tools-get
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-restore-brew-cache
|
||||
- *step-get-more-space-on-mac
|
||||
- *step-install-gnutar-on-mac
|
||||
|
||||
- restore_cache:
|
||||
@@ -651,9 +668,11 @@ steps-electron-build-for-publish: &steps-electron-build-for-publish
|
||||
- *step-depot-tools-get
|
||||
- *step-depot-tools-add-to-path
|
||||
- *step-restore-brew-cache
|
||||
- *step-get-more-space-on-mac
|
||||
- *step-gclient-sync
|
||||
- *step-setup-env-for-build
|
||||
- *step-gn-gen-default
|
||||
- *step-delete-git-directories
|
||||
|
||||
# Electron app
|
||||
- *step-electron-build
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# These env vars are only necessary for creating Electron releases.
|
||||
# See docs/development/releasing.md
|
||||
|
||||
APPVEYOR_TOKEN=
|
||||
APPVEYOR_CLOUD_TOKEN=
|
||||
CIRCLE_TOKEN=
|
||||
ELECTRON_GITHUB_TOKEN=
|
||||
VSTS_TOKEN=
|
||||
@@ -16,7 +16,8 @@
|
||||
}],
|
||||
"prefer-const": ["error", {
|
||||
"destructuring": "all"
|
||||
}]
|
||||
}],
|
||||
"node/no-deprecated-api": 0
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -37,7 +37,7 @@
|
||||
/vendor/pyyaml
|
||||
node_modules/
|
||||
SHASUMS256.txt
|
||||
**/yarn.lock
|
||||
**/package-lock.json
|
||||
compile_commands.json
|
||||
.envrc
|
||||
|
||||
|
||||
13
BUILD.gn
13
BUILD.gn
@@ -8,7 +8,7 @@ import("//tools/generate_library_loader/generate_library_loader.gni")
|
||||
import("//tools/grit/grit_rule.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
|
||||
import("//v8/snapshot_toolchain.gni")
|
||||
import("//v8/gni/snapshot_toolchain.gni")
|
||||
import("build/asar.gni")
|
||||
import("build/js_wrap.gni")
|
||||
import("build/npm.gni")
|
||||
@@ -64,7 +64,7 @@ config("branding") {
|
||||
npm_action("build_electron_definitions") {
|
||||
script = "gn-typescript-definitions"
|
||||
args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
|
||||
inputs = auto_filenames.api_docs + [ "package-lock.json" ]
|
||||
inputs = auto_filenames.api_docs + [ "yarn.lock" ]
|
||||
|
||||
outputs = [
|
||||
"$target_gen_dir/tsc/typings/electron.d.ts",
|
||||
@@ -545,6 +545,7 @@ static_library("electron_lib") {
|
||||
|
||||
if (is_mac) {
|
||||
deps += [
|
||||
"//components/remote_cocoa/app_shim",
|
||||
"//third_party/crashpad/crashpad/client",
|
||||
"//ui/accelerated_widget_mac",
|
||||
]
|
||||
@@ -1067,6 +1068,7 @@ template("dist_zip") {
|
||||
"deps",
|
||||
"data_deps",
|
||||
"data",
|
||||
"testonly",
|
||||
])
|
||||
write_runtime_deps = _runtime_deps_file
|
||||
}
|
||||
@@ -1076,7 +1078,11 @@ template("dist_zip") {
|
||||
deps = [
|
||||
":$_runtime_deps_target",
|
||||
]
|
||||
forward_variables_from(invoker, [ "outputs" ])
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"outputs",
|
||||
"testonly",
|
||||
])
|
||||
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
|
||||
target_cpu,
|
||||
target_os,
|
||||
@@ -1144,6 +1150,7 @@ dist_zip("electron_ffmpeg_zip") {
|
||||
}
|
||||
|
||||
dist_zip("electron_chromedriver_zip") {
|
||||
testonly = true
|
||||
data_deps = [
|
||||
"//chrome/test/chromedriver",
|
||||
":licenses",
|
||||
|
||||
9
DEPS
9
DEPS
@@ -10,9 +10,9 @@ gclient_gn_args = [
|
||||
|
||||
vars = {
|
||||
'chromium_version':
|
||||
'75.0.3740.3',
|
||||
'76.0.3809.3',
|
||||
'node_version':
|
||||
'2dc0f8811b2b295c08d797b8a11b030234c98502',
|
||||
'a86a4a160dc520c61a602c949a32a1bc4c0fc633',
|
||||
|
||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||
'pyyaml_version': '3.12',
|
||||
@@ -24,6 +24,9 @@ vars = {
|
||||
'requests_git': 'https://github.com/kennethreitz',
|
||||
'yaml_git': 'https://github.com/yaml',
|
||||
|
||||
# KEEP IN SYNC WITH spec-runner FILE
|
||||
'yarn_version': '1.15.2',
|
||||
|
||||
# To be able to build clean Chromium from sources.
|
||||
'apply_patches': True,
|
||||
|
||||
@@ -107,7 +110,7 @@ hooks = [
|
||||
'action': [
|
||||
'python',
|
||||
'-c',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npm.py", "install"]);',
|
||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
locales \
|
||||
lsb-release \
|
||||
nano \
|
||||
python-dbusmock \
|
||||
python-dbus \
|
||||
python-pip \
|
||||
python-setuptools \
|
||||
sudo \
|
||||
@@ -33,6 +33,9 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
# crcmod is required by gsutil, which is used for filling the gclient git cache
|
||||
RUN pip install -U crcmod
|
||||
|
||||
# dbusmock is needed for Electron tests
|
||||
RUN pip install python-dbusmock
|
||||
|
||||
RUN mkdir /tmp/workspace
|
||||
RUN chown builduser:builduser /tmp/workspace
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.0.0-nightly.20190404
|
||||
6.0.0-beta.6
|
||||
@@ -25,11 +25,12 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: libcc-20
|
||||
image: libcc-20-vs2017-15.7.4
|
||||
image: libcc-20-vs2017-15.9
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
|
||||
DISABLE_CRASH_REPORTER_TESTS: true
|
||||
ELECTRON_OUT_DIR: Default
|
||||
ELECTRON_ENABLE_STACK_DUMPING: 1
|
||||
build_script:
|
||||
- ps: >-
|
||||
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
|
||||
@@ -38,7 +39,7 @@ build_script:
|
||||
- echo "Building $env:GN_CONFIG build"
|
||||
- git config --global core.longpaths true
|
||||
- cd ..
|
||||
- md src
|
||||
- ps: if (Test-Path src\electron) { Remove-Item src\electron -Recurse }
|
||||
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
|
||||
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
|
||||
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
|
||||
@@ -52,7 +53,7 @@ build_script:
|
||||
--unmanaged
|
||||
%GCLIENT_EXTRA_ARGS%
|
||||
"https://github.com/electron/electron"
|
||||
- gclient sync --with_branch_heads --with_tags
|
||||
- gclient sync --with_branch_heads --with_tags --reset
|
||||
- cd src
|
||||
- ps: $env:BUILD_CONFIG_PATH="//electron/build/args/%GN_CONFIG%.gn"
|
||||
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS%"
|
||||
|
||||
@@ -268,4 +268,8 @@ void AtomContentClient::AddContentDecryptionModules(
|
||||
}
|
||||
}
|
||||
|
||||
bool AtomContentClient::IsDataResourceGzipped(int resource_id) const {
|
||||
return ui::ResourceBundle::GetSharedInstance().IsGzipped(resource_id);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -31,6 +31,7 @@ class AtomContentClient : public content::ContentClient {
|
||||
void AddContentDecryptionModules(
|
||||
std::vector<content::CdmInfo>* cdms,
|
||||
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
|
||||
bool IsDataResourceGzipped(int resource_id) const override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
#include "atom/app/atom_main_delegate_mac.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/win/win_util.h"
|
||||
#endif
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
@@ -181,6 +185,9 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
// Disable the ActiveVerifier, which is used by Chrome to track possible
|
||||
// bugs, but no use in Electron.
|
||||
base::win::DisableHandleVerifier();
|
||||
|
||||
if (IsBrowserProcess(command_line))
|
||||
base::win::PinUser32();
|
||||
#endif
|
||||
|
||||
content_client_ = std::make_unique<AtomContentClient>();
|
||||
|
||||
@@ -18,6 +18,22 @@
|
||||
#include "chrome/services/printing/public/cpp/manifest.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
// TODO(https://crbug.com/781334): Remove these helpers and just update the
|
||||
// manifest definitions to be marked out-of-process. This is here only to avoid
|
||||
// extra churn when transitioning away from content_packaged_services.
|
||||
service_manager::Manifest MakeOutOfProcess(
|
||||
const service_manager::Manifest& manifest) {
|
||||
// cpplint.py emits a false positive [build/include_what_you_use]
|
||||
service_manager::Manifest copy(manifest); // NOLINT
|
||||
copy.options.execution_mode =
|
||||
service_manager::Manifest::ExecutionMode::kOutOfProcessBuiltin;
|
||||
return copy;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
|
||||
static base::NoDestructor<service_manager::Manifest> manifest{
|
||||
service_manager::ManifestBuilder()
|
||||
@@ -35,14 +51,14 @@ const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
|
||||
}
|
||||
|
||||
const std::vector<service_manager::Manifest>&
|
||||
GetElectronPackagedServicesOverlayManifest() {
|
||||
GetElectronBuiltinServiceManifests() {
|
||||
static base::NoDestructor<std::vector<service_manager::Manifest>> manifests{{
|
||||
proxy_resolver::GetManifest(),
|
||||
MakeOutOfProcess(proxy_resolver::GetManifest()),
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
printing::GetPdfCompositorManifest(),
|
||||
MakeOutOfProcess(printing::GetPdfCompositorManifest()),
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
||||
GetChromePrintingManifest(),
|
||||
MakeOutOfProcess(GetChromePrintingManifest()),
|
||||
#endif
|
||||
}};
|
||||
return *manifests;
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
|
||||
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest();
|
||||
const std::vector<service_manager::Manifest>&
|
||||
GetElectronPackagedServicesOverlayManifest();
|
||||
GetElectronBuiltinServiceManifests();
|
||||
|
||||
#endif // ATOM_APP_MANIFESTS_H_
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "atom/common/node_includes.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/task/task_scheduler/task_scheduler.h"
|
||||
#include "base/task/thread_pool/thread_pool.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "gin/array_buffer.h"
|
||||
#include "gin/public/isolate_holder.h"
|
||||
@@ -48,7 +48,7 @@ int NodeMain(int argc, char* argv[]) {
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
|
||||
// V8 requires a task scheduler apparently
|
||||
base::TaskScheduler::CreateAndStartWithDefaultParams("Electron");
|
||||
base::ThreadPoolInstance::CreateAndStartWithDefaultParams("Electron");
|
||||
|
||||
// Initialize gin::IsolateHolder.
|
||||
JavascriptEnvironment gin_env(loop);
|
||||
@@ -101,6 +101,7 @@ int NodeMain(int argc, char* argv[]) {
|
||||
}
|
||||
} while (more == true);
|
||||
|
||||
node_debugger.Stop();
|
||||
exit_code = node::EmitExit(env);
|
||||
node::RunAtExit(env);
|
||||
gin_env.platform()->DrainTasks(env->isolate());
|
||||
@@ -112,10 +113,10 @@ int NodeMain(int argc, char* argv[]) {
|
||||
|
||||
// According to "src/gin/shell/gin_main.cc":
|
||||
//
|
||||
// gin::IsolateHolder waits for tasks running in TaskScheduler in its
|
||||
// destructor and thus must be destroyed before TaskScheduler starts skipping
|
||||
// gin::IsolateHolder waits for tasks running in ThreadPool in its
|
||||
// destructor and thus must be destroyed before ThreadPool starts skipping
|
||||
// CONTINUE_ON_SHUTDOWN tasks.
|
||||
base::TaskScheduler::GetInstance()->Shutdown();
|
||||
base::ThreadPoolInstance::Get()->Shutdown();
|
||||
|
||||
v8::V8::Dispose();
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ struct Converter<Browser::UserTask> {
|
||||
return false;
|
||||
dict.Get("arguments", &(out->arguments));
|
||||
dict.Get("description", &(out->description));
|
||||
dict.Get("workingDirectory", &(out->working_dir));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -157,6 +158,7 @@ struct Converter<JumpListItem> {
|
||||
|
||||
dict.Get("args", &(out->arguments));
|
||||
dict.Get("description", &(out->description));
|
||||
dict.Get("workingDirectory", &(out->working_dir));
|
||||
return true;
|
||||
|
||||
case JumpListItem::Type::SEPARATOR:
|
||||
@@ -183,6 +185,7 @@ struct Converter<JumpListItem> {
|
||||
dict.Set("iconPath", val.icon_path);
|
||||
dict.Set("iconIndex", val.icon_index);
|
||||
dict.Set("description", val.description);
|
||||
dict.Set("workingDirectory", val.working_dir);
|
||||
break;
|
||||
|
||||
case JumpListItem::Type::SEPARATOR:
|
||||
@@ -529,9 +532,9 @@ int ImportIntoCertStore(CertificateManagerModel* model,
|
||||
}
|
||||
#endif
|
||||
|
||||
void OnIconDataAvailable(util::Promise promise, gfx::Image* icon) {
|
||||
if (icon && !icon->IsEmpty()) {
|
||||
promise.Resolve(*icon);
|
||||
void OnIconDataAvailable(util::Promise promise, gfx::Image icon) {
|
||||
if (!icon.IsEmpty()) {
|
||||
promise.Resolve(icon);
|
||||
} else {
|
||||
promise.RejectWithErrorMessage("Failed to get file icon.");
|
||||
}
|
||||
@@ -672,7 +675,7 @@ void App::OnLogin(scoped_refptr<LoginHandler> login_handler,
|
||||
if (web_contents) {
|
||||
prevent_default = Emit(
|
||||
"login", WebContents::FromOrCreate(isolate(), web_contents),
|
||||
request_details, login_handler->auth_info(),
|
||||
request_details, *login_handler->auth_info(),
|
||||
base::Bind(&PassLoginInformation, base::RetainedRef(login_handler)));
|
||||
}
|
||||
|
||||
@@ -718,7 +721,7 @@ void App::AllowCertificateError(
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
content::ResourceType resource_type,
|
||||
bool is_main_frame_request,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
@@ -1056,7 +1059,7 @@ Browser::LoginItemSettings App::GetLoginItemSettings(mate::Arguments* args) {
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
void App::ImportCertificate(const base::DictionaryValue& options,
|
||||
const net::CompletionCallback& callback) {
|
||||
net::CompletionRepeatingCallback callback) {
|
||||
auto browser_context = AtomBrowserContext::From("", false);
|
||||
if (!certificate_manager_model_) {
|
||||
auto copy = base::DictionaryValue::From(
|
||||
@@ -1069,17 +1072,17 @@ void App::ImportCertificate(const base::DictionaryValue& options,
|
||||
}
|
||||
|
||||
int rv = ImportIntoCertStore(certificate_manager_model_.get(), options);
|
||||
callback.Run(rv);
|
||||
std::move(callback).Run(rv);
|
||||
}
|
||||
|
||||
void App::OnCertificateManagerModelCreated(
|
||||
std::unique_ptr<base::DictionaryValue> options,
|
||||
const net::CompletionCallback& callback,
|
||||
net::CompletionOnceCallback callback,
|
||||
std::unique_ptr<CertificateManagerModel> model) {
|
||||
certificate_manager_model_ = std::move(model);
|
||||
int rv =
|
||||
ImportIntoCertStore(certificate_manager_model_.get(), *(options.get()));
|
||||
callback.Run(rv);
|
||||
std::move(callback).Run(rv);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1268,6 +1271,14 @@ void App::EnableSandbox(mate::Arguments* args) {
|
||||
command_line->AppendSwitch(switches::kEnableSandbox);
|
||||
}
|
||||
|
||||
void App::SetUserAgentFallback(const std::string& user_agent) {
|
||||
AtomBrowserClient::Get()->SetUserAgent(user_agent);
|
||||
}
|
||||
|
||||
std::string App::GetUserAgentFallback() {
|
||||
return AtomBrowserClient::Get()->GetUserAgent();
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
bool App::MoveToApplicationsFolder(mate::Arguments* args) {
|
||||
return ui::cocoa::AtomBundleMover::Move(args);
|
||||
@@ -1428,6 +1439,8 @@ void App::BuildPrototype(v8::Isolate* isolate,
|
||||
#if defined(OS_MACOSX)
|
||||
.SetProperty("dock", &App::GetDockAPI)
|
||||
#endif
|
||||
.SetProperty("userAgentFallback", &App::GetUserAgentFallback,
|
||||
&App::SetUserAgentFallback)
|
||||
.SetMethod("enableSandbox", &App::EnableSandbox);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "native_mate/handle.h"
|
||||
#include "net/base/completion_callback.h"
|
||||
#include "net/base/completion_once_callback.h"
|
||||
#include "net/base/completion_repeating_callback.h"
|
||||
#include "net/ssl/client_cert_identity.h"
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
@@ -78,7 +79,7 @@ class App : public AtomBrowserClient::Delegate,
|
||||
#if defined(USE_NSS_CERTS)
|
||||
void OnCertificateManagerModelCreated(
|
||||
std::unique_ptr<base::DictionaryValue> options,
|
||||
const net::CompletionCallback& callback,
|
||||
net::CompletionOnceCallback callback,
|
||||
std::unique_ptr<CertificateManagerModel> model);
|
||||
#endif
|
||||
|
||||
@@ -129,7 +130,7 @@ class App : public AtomBrowserClient::Delegate,
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
content::ResourceType resource_type,
|
||||
bool is_main_frame_request,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
@@ -199,7 +200,7 @@ class App : public AtomBrowserClient::Delegate,
|
||||
Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
|
||||
#if defined(USE_NSS_CERTS)
|
||||
void ImportCertificate(const base::DictionaryValue& options,
|
||||
const net::CompletionCallback& callback);
|
||||
net::CompletionRepeatingCallback callback);
|
||||
#endif
|
||||
v8::Local<v8::Promise> GetFileIcon(const base::FilePath& path,
|
||||
mate::Arguments* args);
|
||||
@@ -209,6 +210,8 @@ class App : public AtomBrowserClient::Delegate,
|
||||
v8::Local<v8::Promise> GetGPUInfo(v8::Isolate* isolate,
|
||||
const std::string& info_type);
|
||||
void EnableSandbox(mate::Arguments* args);
|
||||
void SetUserAgentFallback(const std::string& user_agent);
|
||||
std::string GetUserAgentFallback();
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
bool MoveToApplicationsFolder(mate::Arguments* args);
|
||||
|
||||
@@ -64,11 +64,17 @@ void AutoUpdater::OnError(const std::string& message,
|
||||
auto errorObject =
|
||||
error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked();
|
||||
|
||||
auto context = isolate()->GetCurrentContext();
|
||||
|
||||
// add two new params for better error handling
|
||||
errorObject->Set(mate::StringToV8(isolate(), "code"),
|
||||
v8::Integer::New(isolate(), code));
|
||||
errorObject->Set(mate::StringToV8(isolate(), "domain"),
|
||||
mate::StringToV8(isolate(), domain));
|
||||
errorObject
|
||||
->Set(context, mate::StringToV8(isolate(), "code"),
|
||||
v8::Integer::New(isolate(), code))
|
||||
.Check();
|
||||
errorObject
|
||||
->Set(context, mate::StringToV8(isolate(), "domain"),
|
||||
mate::StringToV8(isolate(), domain))
|
||||
.Check();
|
||||
|
||||
mate::EmitEvent(isolate(), GetWrapper(), "error", errorObject, message);
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
||||
net::CanonicalCookie::CreateSanitizedCookie(
|
||||
url, name, value, domain, path, creation_time, expiration_time,
|
||||
last_access_time, secure, http_only,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
|
||||
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT));
|
||||
auto completion_callback = base::BindOnce(OnSetCookie, std::move(promise));
|
||||
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
||||
std::move(completion_callback)
|
||||
|
||||
@@ -165,8 +165,12 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
|
||||
std::vector<std::string> device_names;
|
||||
// Crucially, this list of device names will be in the same order as
|
||||
// |media_list_sources|.
|
||||
webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
|
||||
&device_names);
|
||||
if (!webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
|
||||
&device_names)) {
|
||||
Emit("error", "Failed to get sources.");
|
||||
return;
|
||||
}
|
||||
|
||||
int device_name_index = 0;
|
||||
for (auto& source : screen_sources) {
|
||||
const auto& device_name = device_names[device_name_index++];
|
||||
@@ -176,13 +180,13 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
|
||||
const int64_t device_id =
|
||||
display::win::DisplayInfo::DeviceIdFromDeviceName(
|
||||
wide_device_name.c_str());
|
||||
source.display_id = base::Int64ToString(device_id);
|
||||
source.display_id = base::NumberToString(device_id);
|
||||
}
|
||||
}
|
||||
#elif defined(OS_MACOSX)
|
||||
// On Mac, the IDs across the APIs match.
|
||||
for (auto& source : screen_sources) {
|
||||
source.display_id = base::Int64ToString(source.media_list_source.id.id);
|
||||
source.display_id = base::NumberToString(source.media_list_source.id.id);
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
// TODO(ajmacd): Add Linux support. The IDs across APIs differ but Chrome
|
||||
@@ -222,7 +226,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("desktopCapturer", atom::api::DesktopCapturer::Create(isolate));
|
||||
dict.SetMethod("createDesktopCapturer", &atom::api::DesktopCapturer::Create);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -52,7 +52,7 @@ void MenuViews::PopupAt(TopLevelWindow* window,
|
||||
std::make_unique<MenuRunner>(model(), flags, close_callback);
|
||||
menu_runners_[window_id]->RunMenuAt(
|
||||
native_window->widget(), NULL, gfx::Rect(location, gfx::Size()),
|
||||
views::MENU_ANCHOR_TOPLEFT, ui::MENU_SOURCE_MOUSE);
|
||||
views::MenuAnchorPosition::kTopLeft, ui::MENU_SOURCE_MOUSE);
|
||||
}
|
||||
|
||||
void MenuViews::ClosePopupAt(int32_t window_id) {
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "native_mate/object_template_builder.h"
|
||||
#include "net/base/completion_repeating_callback.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/disk_cache/disk_cache.h"
|
||||
#include "net/dns/host_cache.h" // nogncheck
|
||||
@@ -268,7 +269,7 @@ void DoCacheActionInIO(
|
||||
// Call GetBackend and make the backend's ptr accessable in OnGetBackend.
|
||||
using BackendPtr = disk_cache::Backend*;
|
||||
auto** backend_ptr = new BackendPtr(nullptr);
|
||||
net::CompletionCallback on_get_backend =
|
||||
net::CompletionRepeatingCallback on_get_backend =
|
||||
base::Bind(&OnGetBackend, base::Owned(backend_ptr), action,
|
||||
util::CopyablePromise(promise));
|
||||
int rv = http_cache->GetBackend(backend_ptr, on_get_backend);
|
||||
@@ -351,8 +352,8 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
|
||||
uint32_t id) {
|
||||
download_manager->CreateDownloadItem(
|
||||
base::GenerateGUID(), id, path, path, url_chain, GURL(), GURL(), GURL(),
|
||||
GURL(), mime_type, mime_type, start_time, base::Time(), etag,
|
||||
last_modified, offset, length, std::string(),
|
||||
GURL(), base::nullopt, mime_type, mime_type, start_time, base::Time(),
|
||||
etag, last_modified, offset, length, std::string(),
|
||||
download::DownloadItem::INTERRUPTED,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, false, base::Time(),
|
||||
@@ -365,8 +366,9 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
if (!global_handle.IsEmpty()) {
|
||||
v8::Local<v8::Value> local_handle = global_handle.Get(isolate);
|
||||
if (local_handle->IsObject()) {
|
||||
v8::Local<v8::Object> object = local_handle->ToObject(isolate);
|
||||
v8::Local<v8::Object> object;
|
||||
if (local_handle->IsObject() &&
|
||||
local_handle->ToObject(isolate->GetCurrentContext()).ToLocal(&object)) {
|
||||
void* ptr = object->GetAlignedPointerFromInternalField(0);
|
||||
if (!ptr)
|
||||
return;
|
||||
@@ -579,14 +581,33 @@ void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
||||
|
||||
void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
|
||||
mate::Arguments* args) {
|
||||
AtomPermissionManager::RequestHandler handler;
|
||||
if (!(val->IsNull() || mate::ConvertFromV8(args->isolate(), val, &handler))) {
|
||||
using StatusCallback =
|
||||
base::RepeatingCallback<void(blink::mojom::PermissionStatus)>;
|
||||
using RequestHandler =
|
||||
base::Callback<void(content::WebContents*, content::PermissionType,
|
||||
StatusCallback, const base::DictionaryValue&)>;
|
||||
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
||||
browser_context()->GetPermissionControllerDelegate());
|
||||
if (val->IsNull()) {
|
||||
permission_manager->SetPermissionRequestHandler(
|
||||
AtomPermissionManager::RequestHandler());
|
||||
return;
|
||||
}
|
||||
auto handler = std::make_unique<RequestHandler>();
|
||||
if (!mate::ConvertFromV8(args->isolate(), val, handler.get())) {
|
||||
args->ThrowError("Must pass null or function");
|
||||
return;
|
||||
}
|
||||
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
||||
browser_context()->GetPermissionControllerDelegate());
|
||||
permission_manager->SetPermissionRequestHandler(handler);
|
||||
permission_manager->SetPermissionRequestHandler(base::BindRepeating(
|
||||
[](RequestHandler* handler, content::WebContents* web_contents,
|
||||
content::PermissionType permission_type,
|
||||
AtomPermissionManager::StatusCallback callback,
|
||||
const base::DictionaryValue& details) {
|
||||
handler->Run(web_contents, permission_type,
|
||||
base::AdaptCallbackForRepeating(std::move(callback)),
|
||||
details);
|
||||
},
|
||||
base::Owned(std::move(handler))));
|
||||
}
|
||||
|
||||
void Session::SetPermissionCheckHandler(v8::Local<v8::Value> val,
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "base/values.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "native_mate/handle.h"
|
||||
#include "net/base/completion_callback.h"
|
||||
|
||||
class GURL;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "atom/browser/mac/atom_application.h"
|
||||
#include "atom/browser/mac/dict_util.h"
|
||||
#include "atom/browser/ui/cocoa/NSColor+Hex.h"
|
||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "base/mac/scoped_cftyperef.h"
|
||||
@@ -111,21 +112,6 @@ std::string ConvertAuthorizationStatus(AVAuthorizationStatusMac status) {
|
||||
}
|
||||
}
|
||||
|
||||
// Convert color to RGBA value like "aabbccdd"
|
||||
std::string ToRGBA(NSColor* color) {
|
||||
return base::StringPrintf(
|
||||
"%02X%02X%02X%02X", (int)(color.redComponent * 0xFF),
|
||||
(int)(color.greenComponent * 0xFF), (int)(color.blueComponent * 0xFF),
|
||||
(int)(color.alphaComponent * 0xFF));
|
||||
}
|
||||
|
||||
// Convert color to RGB hex value like "#ABCDEF"
|
||||
std::string ToRGBHex(NSColor* color) {
|
||||
return base::StringPrintf("#%02X%02X%02X", (int)(color.redComponent * 0xFF),
|
||||
(int)(color.greenComponent * 0xFF),
|
||||
(int)(color.blueComponent * 0xFF));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void SystemPreferences::PostNotification(const std::string& name,
|
||||
@@ -405,7 +391,7 @@ std::string SystemPreferences::GetAccentColor() {
|
||||
if (@available(macOS 10.14, *))
|
||||
sysColor = [NSColor controlAccentColor];
|
||||
|
||||
return ToRGBA(sysColor);
|
||||
return base::SysNSStringToUTF8([sysColor RGBAValue]);
|
||||
}
|
||||
|
||||
std::string SystemPreferences::GetSystemColor(const std::string& color,
|
||||
@@ -434,7 +420,7 @@ std::string SystemPreferences::GetSystemColor(const std::string& color,
|
||||
return "";
|
||||
}
|
||||
|
||||
return ToRGBHex(sysColor);
|
||||
return base::SysNSStringToUTF8([sysColor hexadecimalValue]);
|
||||
}
|
||||
|
||||
bool SystemPreferences::CanPromptTouchID() {
|
||||
@@ -587,7 +573,7 @@ std::string SystemPreferences::GetColor(const std::string& color,
|
||||
return "";
|
||||
}
|
||||
|
||||
return ToRGBHex(sysColor);
|
||||
return base::SysNSStringToUTF8([sysColor hexadecimalValue]);
|
||||
}
|
||||
|
||||
std::string SystemPreferences::GetMediaAccessStatus(
|
||||
|
||||
@@ -648,10 +648,11 @@ void TopLevelWindow::SetFocusable(bool focusable) {
|
||||
}
|
||||
|
||||
void TopLevelWindow::SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> value) {
|
||||
auto context = isolate->GetCurrentContext();
|
||||
mate::Handle<Menu> menu;
|
||||
if (value->IsObject() &&
|
||||
gin::V8ToString(
|
||||
isolate, value->ToObject(isolate)->GetConstructorName()) == "Menu" &&
|
||||
v8::Local<v8::Object> object;
|
||||
if (value->IsObject() && value->ToObject(context).ToLocal(&object) &&
|
||||
gin::V8ToString(isolate, object->GetConstructorName()) == "Menu" &&
|
||||
mate::ConvertFromV8(isolate, value, &menu) && !menu.IsEmpty()) {
|
||||
menu_.Reset(isolate, menu.ToV8());
|
||||
window_->SetMenu(menu->model());
|
||||
|
||||
@@ -59,11 +59,7 @@ Tray::Tray(v8::Isolate* isolate,
|
||||
InitWith(isolate, wrapper);
|
||||
}
|
||||
|
||||
Tray::~Tray() {
|
||||
// Destroy the native tray in next tick.
|
||||
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
|
||||
tray_icon_.release());
|
||||
}
|
||||
Tray::~Tray() = default;
|
||||
|
||||
// static
|
||||
mate::WrappableBase* Tray::New(mate::Handle<NativeImage> image,
|
||||
|
||||
@@ -354,7 +354,7 @@ void URLRequest::OnReceivedRedirect(
|
||||
}
|
||||
|
||||
void URLRequest::OnAuthenticationRequired(
|
||||
scoped_refptr<const net::AuthChallengeInfo> auth_info) {
|
||||
const net::AuthChallengeInfo& auth_info) {
|
||||
if (request_state_.Canceled() || request_state_.Closed()) {
|
||||
return;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ void URLRequest::OnAuthenticationRequired(
|
||||
return;
|
||||
}
|
||||
|
||||
Emit("login", auth_info.get(),
|
||||
Emit("login", auth_info,
|
||||
base::Bind(&AtomURLRequest::PassLoginInformation, atom_request_));
|
||||
}
|
||||
|
||||
|
||||
@@ -105,8 +105,7 @@ class URLRequest : public mate::EventEmitter<URLRequest> {
|
||||
const std::string& method,
|
||||
const GURL& url,
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers);
|
||||
void OnAuthenticationRequired(
|
||||
scoped_refptr<const net::AuthChallengeInfo> auth_info);
|
||||
void OnAuthenticationRequired(const net::AuthChallengeInfo& auth_info);
|
||||
void OnResponseStarted(
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers);
|
||||
void OnResponseData(scoped_refptr<const net::IOBufferWithSize> data);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "atom/common/options_switches.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
@@ -86,6 +87,7 @@
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
#include "third_party/blink/public/platform/web_input_event.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
@@ -490,12 +492,14 @@ void WebContents::DestroyWebContents(bool async) {
|
||||
ResetManagedWebContents(async);
|
||||
}
|
||||
|
||||
bool WebContents::DidAddMessageToConsole(content::WebContents* source,
|
||||
int32_t level,
|
||||
const base::string16& message,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) {
|
||||
return Emit("console-message", level, message, line_no, source_id);
|
||||
bool WebContents::DidAddMessageToConsole(
|
||||
content::WebContents* source,
|
||||
blink::mojom::ConsoleMessageLevel level,
|
||||
const base::string16& message,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) {
|
||||
return Emit("console-message", static_cast<int32_t>(level), message, line_no,
|
||||
source_id);
|
||||
}
|
||||
|
||||
void WebContents::OnCreateWindow(
|
||||
@@ -807,20 +811,20 @@ void WebContents::PluginCrashed(const base::FilePath& plugin_path,
|
||||
}
|
||||
|
||||
void WebContents::MediaStartedPlaying(const MediaPlayerInfo& video_type,
|
||||
const MediaPlayerId& id) {
|
||||
const content::MediaPlayerId& id) {
|
||||
Emit("media-started-playing");
|
||||
}
|
||||
|
||||
void WebContents::MediaStoppedPlaying(
|
||||
const MediaPlayerInfo& video_type,
|
||||
const MediaPlayerId& id,
|
||||
const content::MediaPlayerId& id,
|
||||
content::WebContentsObserver::MediaStoppedReason reason) {
|
||||
Emit("media-paused");
|
||||
}
|
||||
|
||||
void WebContents::DidChangeThemeColor(SkColor theme_color) {
|
||||
if (theme_color != SK_ColorTRANSPARENT) {
|
||||
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
|
||||
void WebContents::DidChangeThemeColor(base::Optional<SkColor> theme_color) {
|
||||
if (theme_color) {
|
||||
Emit("did-change-theme-color", atom::ToRGBHex(theme_color.value()));
|
||||
} else {
|
||||
Emit("did-change-theme-color", nullptr);
|
||||
}
|
||||
@@ -1192,7 +1196,7 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto* render_view_host = contents->GetRenderViewHost();
|
||||
auto* render_view_host = contents->GetRenderViewHost();
|
||||
if (!render_view_host) {
|
||||
return;
|
||||
}
|
||||
@@ -1211,7 +1215,7 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
|
||||
render_widget_host_impl->disable_hidden_ = !background_throttling_;
|
||||
|
||||
if (render_widget_host_impl->is_hidden()) {
|
||||
render_widget_host_impl->WasShown(false);
|
||||
render_widget_host_impl->WasShown(base::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1915,10 +1919,9 @@ v8::Local<v8::Promise> WebContents::CapturePage(mate::Arguments* args) {
|
||||
}
|
||||
|
||||
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
|
||||
content::CursorInfo info;
|
||||
cursor.GetCursorInfo(&info);
|
||||
const content::CursorInfo& info = cursor.info();
|
||||
|
||||
if (cursor.IsCustom()) {
|
||||
if (info.type == blink::WebCursorInfo::kTypeCustom) {
|
||||
Emit("cursor-changed", CursorTypeToString(info),
|
||||
gfx::Image::CreateFrom1xBitmap(info.custom_image),
|
||||
info.image_scale_factor,
|
||||
@@ -2068,7 +2071,7 @@ v8::Local<v8::Value> WebContents::GetLastWebPreferences(
|
||||
}
|
||||
|
||||
bool WebContents::IsRemoteModuleEnabled() const {
|
||||
if (web_contents()->GetVisibleURL().SchemeIs("chrome-devtools")) {
|
||||
if (web_contents()->GetVisibleURL().SchemeIs("devtools")) {
|
||||
return false;
|
||||
}
|
||||
if (auto* web_preferences = WebContentsPreferences::From(web_contents())) {
|
||||
|
||||
@@ -337,7 +337,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||
|
||||
// content::WebContentsDelegate:
|
||||
bool DidAddMessageToConsole(content::WebContents* source,
|
||||
int32_t level,
|
||||
blink::mojom::ConsoleMessageLevel level,
|
||||
const base::string16& message,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) override;
|
||||
@@ -445,12 +445,12 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||
void PluginCrashed(const base::FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) override;
|
||||
void MediaStartedPlaying(const MediaPlayerInfo& video_type,
|
||||
const MediaPlayerId& id) override;
|
||||
const content::MediaPlayerId& id) override;
|
||||
void MediaStoppedPlaying(
|
||||
const MediaPlayerInfo& video_type,
|
||||
const MediaPlayerId& id,
|
||||
const content::MediaPlayerId& id,
|
||||
content::WebContentsObserver::MediaStoppedReason reason) override;
|
||||
void DidChangeThemeColor(SkColor theme_color) override;
|
||||
void DidChangeThemeColor(base::Optional<SkColor> theme_color) override;
|
||||
void OnInterfaceRequestFromFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const std::string& interface_name,
|
||||
|
||||
@@ -52,7 +52,10 @@ void Event::FrameDeleted(content::RenderFrameHost* rfh) {
|
||||
}
|
||||
|
||||
void Event::PreventDefault(v8::Isolate* isolate) {
|
||||
GetWrapper()->Set(StringToV8(isolate, "defaultPrevented"), v8::True(isolate));
|
||||
GetWrapper()
|
||||
->Set(isolate->GetCurrentContext(),
|
||||
StringToV8(isolate, "defaultPrevented"), v8::True(isolate))
|
||||
.Check();
|
||||
}
|
||||
|
||||
bool Event::SendReply(const base::ListValue& result) {
|
||||
|
||||
@@ -104,8 +104,13 @@ class EventEmitter : public Wrappable<T> {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
EmitEvent(isolate(), GetWrapper(), name, event, args...);
|
||||
return event->Get(StringToV8(isolate(), "defaultPrevented"))
|
||||
->BooleanValue(isolate());
|
||||
auto context = isolate()->GetCurrentContext();
|
||||
v8::Local<v8::Value> defaultPrevented;
|
||||
if (event->Get(context, StringToV8(isolate(), "defaultPrevented"))
|
||||
.ToLocal(&defaultPrevented)) {
|
||||
return defaultPrevented->BooleanValue(isolate());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
|
||||
|
||||
@@ -108,18 +108,6 @@ void GPUInfoEnumerator::EndAuxAttributes() {
|
||||
value_stack.pop();
|
||||
}
|
||||
|
||||
void GPUInfoEnumerator::BeginOverlayCapability() {
|
||||
value_stack.push(std::move(current));
|
||||
current = std::make_unique<base::DictionaryValue>();
|
||||
}
|
||||
|
||||
void GPUInfoEnumerator::EndOverlayCapability() {
|
||||
auto& top_value = value_stack.top();
|
||||
top_value->SetDictionary(kOverlayCapabilityKey, std::move(current));
|
||||
current = std::move(top_value);
|
||||
value_stack.pop();
|
||||
}
|
||||
|
||||
void GPUInfoEnumerator::BeginDx12VulkanVersionInfo() {
|
||||
value_stack.push(std::move(current));
|
||||
current = std::make_unique<base::DictionaryValue>();
|
||||
|
||||
@@ -25,7 +25,6 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
||||
const char* kImageDecodeAcceleratorSupportedProfileKey =
|
||||
"imageDecodeAcceleratorSupportedProfile";
|
||||
const char* kAuxAttributesKey = "auxAttributes";
|
||||
const char* kOverlayCapabilityKey = "overlayCapability";
|
||||
const char* kDx12VulkanVersionInfoKey = "dx12VulkanVersionInfo";
|
||||
|
||||
public:
|
||||
@@ -47,8 +46,6 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
||||
void EndImageDecodeAcceleratorSupportedProfile() override;
|
||||
void BeginAuxAttributes() override;
|
||||
void EndAuxAttributes() override;
|
||||
void BeginOverlayCapability() override;
|
||||
void EndOverlayCapability() override;
|
||||
void BeginDx12VulkanVersionInfo() override;
|
||||
void EndDx12VulkanVersionInfo() override;
|
||||
std::unique_ptr<base::DictionaryValue> GetDictionary();
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
#include "services/device/public/cpp/geolocation/location_provider.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "services/network/public/cpp/resource_request_body.h"
|
||||
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
@@ -108,8 +107,6 @@
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
#include "chrome/browser/printing/printing_message_filter.h"
|
||||
#include "chrome/services/printing/public/mojom/constants.mojom.h"
|
||||
#include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h"
|
||||
#endif // BUILDFLAG(ENABLE_PRINTING)
|
||||
|
||||
using content::BrowserThread;
|
||||
@@ -498,7 +495,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
|
||||
|
||||
content::WebContents* web_contents = GetWebContentsFromProcessID(process_id);
|
||||
if (web_contents) {
|
||||
if (web_contents->GetVisibleURL().SchemeIs("chrome-devtools")) {
|
||||
if (web_contents->GetVisibleURL().SchemeIs("devtools")) {
|
||||
command_line->AppendSwitch(switches::kDisableRemoteModule);
|
||||
}
|
||||
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
||||
@@ -534,7 +531,7 @@ std::string AtomBrowserClient::GetGeolocationApiKey() {
|
||||
return api_key;
|
||||
}
|
||||
|
||||
content::QuotaPermissionContext*
|
||||
scoped_refptr<content::QuotaPermissionContext>
|
||||
AtomBrowserClient::CreateQuotaPermissionContext() {
|
||||
return new AtomQuotaPermissionContext;
|
||||
}
|
||||
@@ -555,14 +552,14 @@ void AtomBrowserClient::AllowCertificateError(
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
content::ResourceType resource_type,
|
||||
bool is_main_frame_request,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
callback) {
|
||||
if (delegate_) {
|
||||
delegate_->AllowCertificateError(
|
||||
web_contents, cert_error, ssl_info, request_url, resource_type,
|
||||
web_contents, cert_error, ssl_info, request_url, is_main_frame_request,
|
||||
strict_enforcement, expired_previous_decision, callback);
|
||||
}
|
||||
}
|
||||
@@ -705,43 +702,26 @@ network::mojom::NetworkContext* AtomBrowserClient::GetSystemNetworkContext() {
|
||||
return g_browser_process->system_network_context_manager()->GetContext();
|
||||
}
|
||||
|
||||
void AtomBrowserClient::RegisterOutOfProcessServices(
|
||||
OutOfProcessServiceMap* services) {
|
||||
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
|
||||
base::BindRepeating(&l10n_util::GetStringUTF16,
|
||||
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
(*services)[printing::mojom::kServiceName] =
|
||||
base::BindRepeating(&l10n_util::GetStringUTF16,
|
||||
IDS_UTILITY_PROCESS_PDF_COMPOSITOR_SERVICE_NAME);
|
||||
|
||||
(*services)[printing::mojom::kChromePrintingServiceName] =
|
||||
base::BindRepeating(&l10n_util::GetStringUTF16,
|
||||
IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME);
|
||||
#endif
|
||||
}
|
||||
|
||||
base::Optional<service_manager::Manifest>
|
||||
AtomBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
||||
if (name == content::mojom::kBrowserServiceName) {
|
||||
if (name == content::mojom::kBrowserServiceName)
|
||||
return GetElectronContentBrowserOverlayManifest();
|
||||
} else if (name == content::mojom::kPackagedServicesServiceName) {
|
||||
service_manager::Manifest overlay;
|
||||
overlay.packaged_services = GetElectronPackagedServicesOverlayManifest();
|
||||
return overlay;
|
||||
}
|
||||
|
||||
return base::nullopt;
|
||||
}
|
||||
|
||||
std::vector<service_manager::Manifest>
|
||||
AtomBrowserClient::GetExtraServiceManifests() {
|
||||
return GetElectronBuiltinServiceManifests();
|
||||
}
|
||||
|
||||
net::NetLog* AtomBrowserClient::GetNetLog() {
|
||||
return g_browser_process->net_log();
|
||||
}
|
||||
|
||||
content::BrowserMainParts* AtomBrowserClient::CreateBrowserMainParts(
|
||||
std::unique_ptr<content::BrowserMainParts>
|
||||
AtomBrowserClient::CreateBrowserMainParts(
|
||||
const content::MainFunctionParams& params) {
|
||||
return new AtomBrowserMainParts(params);
|
||||
return std::make_unique<AtomBrowserMainParts>(params);
|
||||
}
|
||||
|
||||
void AtomBrowserClient::WebNotificationAllowed(
|
||||
@@ -829,8 +809,6 @@ bool AtomBrowserClient::HandleExternalProtocol(
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const std::string& method,
|
||||
const net::HttpRequestHeaders& headers,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
// clang-format off
|
||||
network::mojom::URLLoaderFactory*& out_factory) { // NOLINT
|
||||
@@ -867,7 +845,8 @@ NotificationPresenter* AtomBrowserClient::GetNotificationPresenter() {
|
||||
}
|
||||
|
||||
content::PlatformNotificationService*
|
||||
AtomBrowserClient::GetPlatformNotificationService() {
|
||||
AtomBrowserClient::GetPlatformNotificationService(
|
||||
content::BrowserContext* browser_context) {
|
||||
if (!notification_service_) {
|
||||
notification_service_.reset(new PlatformNotificationService(this));
|
||||
}
|
||||
@@ -912,7 +891,13 @@ std::string AtomBrowserClient::GetProduct() const {
|
||||
}
|
||||
|
||||
std::string AtomBrowserClient::GetUserAgent() const {
|
||||
return GetApplicationUserAgent();
|
||||
if (user_agent_override_.empty())
|
||||
return GetApplicationUserAgent();
|
||||
return user_agent_override_;
|
||||
}
|
||||
|
||||
void AtomBrowserClient::SetUserAgent(const std::string& user_agent) {
|
||||
user_agent_override_ = user_agent;
|
||||
}
|
||||
|
||||
std::string AtomBrowserClient::GetApplicationLocale() {
|
||||
|
||||
@@ -64,6 +64,9 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
||||
// content::ContentBrowserClient:
|
||||
bool ShouldEnableStrictSiteIsolation() override;
|
||||
|
||||
std::string GetUserAgent() const override;
|
||||
void SetUserAgent(const std::string& user_agent);
|
||||
|
||||
protected:
|
||||
void RenderProcessWillLaunch(
|
||||
content::RenderProcessHost* host,
|
||||
@@ -90,7 +93,8 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
||||
base::CommandLine* command_line) override;
|
||||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
||||
std::string GetGeolocationApiKey() override;
|
||||
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
|
||||
override;
|
||||
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
|
||||
content::BrowserContext* context) override;
|
||||
void AllowCertificateError(
|
||||
@@ -98,7 +102,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
content::ResourceType resource_type,
|
||||
bool is_main_frame_request,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
@@ -138,15 +142,15 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path) override;
|
||||
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
||||
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
|
||||
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
std::vector<service_manager::Manifest> GetExtraServiceManifests() override;
|
||||
net::NetLog* GetNetLog() override;
|
||||
content::MediaObserver* GetMediaObserver() override;
|
||||
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
|
||||
content::PlatformNotificationService* GetPlatformNotificationService()
|
||||
override;
|
||||
content::BrowserMainParts* CreateBrowserMainParts(
|
||||
content::PlatformNotificationService* GetPlatformNotificationService(
|
||||
content::BrowserContext* browser_context) override;
|
||||
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
|
||||
const content::MainFunctionParams&) override;
|
||||
base::FilePath GetDefaultDownloadDirectory() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
@@ -155,7 +159,6 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
||||
network::mojom::NetworkService* network_service) override;
|
||||
bool ShouldBypassCORB(int render_process_id) const override;
|
||||
std::string GetProduct() const override;
|
||||
std::string GetUserAgent() const override;
|
||||
|
||||
// content::RenderProcessHostObserver:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
@@ -171,8 +174,6 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const std::string& method,
|
||||
const net::HttpRequestHeaders& headers,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
// clang-format off
|
||||
network::mojom::URLLoaderFactory*& out_factory) // NOLINT
|
||||
@@ -231,6 +232,8 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
||||
mutable base::Lock process_preferences_lock_;
|
||||
std::map<int, ProcessPreferences> process_preferences_;
|
||||
|
||||
std::string user_agent_override_ = "";
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomBrowserClient);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "atom/browser/atom_blob_reader.h"
|
||||
#include "atom/browser/atom_browser_client.h"
|
||||
#include "atom/browser/atom_browser_main_parts.h"
|
||||
#include "atom/browser/atom_download_manager_delegate.h"
|
||||
#include "atom/browser/atom_paths.h"
|
||||
@@ -67,7 +68,7 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
|
||||
storage_policy_(new SpecialStoragePolicy),
|
||||
in_memory_(in_memory),
|
||||
weak_factory_(this) {
|
||||
user_agent_ = GetApplicationUserAgent();
|
||||
user_agent_ = AtomBrowserClient::Get()->GetUserAgent();
|
||||
|
||||
// Read options.
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
@@ -109,11 +110,12 @@ AtomBrowserContext::~AtomBrowserContext() {
|
||||
NotifyWillBeDestroyed(this);
|
||||
ShutdownStoragePartitions();
|
||||
|
||||
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE,
|
||||
std::move(resource_context_));
|
||||
|
||||
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
|
||||
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
|
||||
io_handle_->ShutdownOnUIThread();
|
||||
} else {
|
||||
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE,
|
||||
std::move(resource_context_));
|
||||
}
|
||||
|
||||
// Notify any keyed services of browser context destruction.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
#include "ui/base/l10n/l10n_util.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/system_fonts_win.h"
|
||||
#include "ui/strings/grit/app_locale_settings.h"
|
||||
#endif
|
||||
|
||||
@@ -102,7 +102,7 @@ void Erase(T* container, typename T::iterator iter) {
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// gfx::Font callbacks
|
||||
void AdjustUIFont(gfx::PlatformFontWin::FontAdjustment* font_adjustment) {
|
||||
void AdjustUIFont(gfx::win::FontAdjustment* font_adjustment) {
|
||||
l10n_util::NeedOverrideDefaultUIFont(&font_adjustment->font_family_override,
|
||||
&font_adjustment->font_scale);
|
||||
font_adjustment->font_scale *= display::win::GetAccessibilityFontScale();
|
||||
@@ -380,8 +380,8 @@ void AtomBrowserMainParts::ToolkitInitialized() {
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
gfx::PlatformFontWin::SetAdjustFontCallback(&AdjustUIFont);
|
||||
gfx::PlatformFontWin::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
|
||||
gfx::win::SetAdjustFontCallback(&AdjustUIFont);
|
||||
gfx::win::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
|
||||
|
||||
wchar_t module_name[MAX_PATH] = {0};
|
||||
if (GetModuleFileName(NULL, module_name, MAX_PATH))
|
||||
@@ -469,6 +469,7 @@ void AtomBrowserMainParts::PostMainMessageLoopRun() {
|
||||
ui::SetX11ErrorHandlers(X11EmptyErrorHandler, X11EmptyIOErrorHandler);
|
||||
#endif
|
||||
|
||||
node_debugger_->Stop();
|
||||
js_env_->OnMessageLoopDestroying();
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
||||
@@ -41,8 +41,26 @@ void AtomBrowserMainParts::InitializeMainNib() {
|
||||
auto application = [principalClass sharedApplication];
|
||||
|
||||
NSString* mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
|
||||
auto mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
|
||||
bundle:base::mac::FrameworkBundle()];
|
||||
|
||||
NSNib* mainNib;
|
||||
|
||||
@try {
|
||||
mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
|
||||
bundle:base::mac::FrameworkBundle()];
|
||||
// Handle failure of initWithNibNamed on SMB shares
|
||||
// TODO(codebytere): Remove when
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=932935 is fixed
|
||||
} @catch (NSException* exception) {
|
||||
NSString* nibPath =
|
||||
[NSString stringWithFormat:@"Resources/%@.nib", mainNibName];
|
||||
nibPath = [base::mac::FrameworkBundle().bundlePath
|
||||
stringByAppendingPathComponent:nibPath];
|
||||
|
||||
NSData* data = [NSData dataWithContentsOfFile:nibPath];
|
||||
mainNib = [[NSNib alloc] initWithNibData:data
|
||||
bundle:base::mac::FrameworkBundle()];
|
||||
}
|
||||
|
||||
[mainNib instantiateWithOwner:application topLevelObjects:nil];
|
||||
[mainNib release];
|
||||
}
|
||||
|
||||
@@ -127,8 +127,8 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
|
||||
base::Bind(&AtomDownloadManagerDelegate::OnDownloadSaveDialogDone,
|
||||
base::Unretained(this), download_id, callback);
|
||||
|
||||
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));
|
||||
ignore_result(dialog_promise.Then(dialog_callback));
|
||||
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));
|
||||
} else {
|
||||
callback.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
|
||||
@@ -136,54 +136,48 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
void AtomDownloadManagerDelegate::OnDownloadSaveDialogDone(
|
||||
uint32_t download_id,
|
||||
const content::DownloadTargetCallback& download_callback,
|
||||
bool result,
|
||||
const base::FilePath& path,
|
||||
const std::string& bookmark)
|
||||
#else
|
||||
void AtomDownloadManagerDelegate::OnDownloadSaveDialogDone(
|
||||
uint32_t download_id,
|
||||
const content::DownloadTargetCallback& download_callback,
|
||||
bool result,
|
||||
const base::FilePath& path)
|
||||
#endif
|
||||
{
|
||||
mate::Dictionary result) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
auto* item = download_manager_->GetDownload(download_id);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (result) {
|
||||
// Remember the last selected download directory.
|
||||
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
|
||||
download_manager_->GetBrowserContext());
|
||||
browser_context->prefs()->SetFilePath(prefs::kDownloadDefaultDirectory,
|
||||
path.DirName());
|
||||
bool canceled = true;
|
||||
result.Get("canceled", &canceled);
|
||||
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
api::DownloadItem* download_item =
|
||||
api::DownloadItem::FromWrappedClass(isolate, item);
|
||||
if (download_item)
|
||||
download_item->SetSavePath(path);
|
||||
base::FilePath path;
|
||||
|
||||
if (!canceled) {
|
||||
if (result.Get("filePath", &path)) {
|
||||
// Remember the last selected download directory.
|
||||
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
|
||||
download_manager_->GetBrowserContext());
|
||||
browser_context->prefs()->SetFilePath(prefs::kDownloadDefaultDirectory,
|
||||
path.DirName());
|
||||
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
api::DownloadItem* download_item =
|
||||
api::DownloadItem::FromWrappedClass(isolate, item);
|
||||
if (download_item)
|
||||
download_item->SetSavePath(path);
|
||||
}
|
||||
}
|
||||
|
||||
// Running the DownloadTargetCallback with an empty FilePath signals that the
|
||||
// download should be cancelled. If user cancels the file save dialog, run
|
||||
// the callback with empty FilePath.
|
||||
const base::FilePath download_path = result ? path : base::FilePath();
|
||||
const auto interrupt_reason =
|
||||
download_path.empty() ? download::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED
|
||||
: download::DOWNLOAD_INTERRUPT_REASON_NONE;
|
||||
download_callback.Run(download_path,
|
||||
download::DownloadItem::TARGET_DISPOSITION_PROMPT,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download_path, interrupt_reason);
|
||||
path.empty() ? download::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED
|
||||
: download::DOWNLOAD_INTERRUPT_REASON_NONE;
|
||||
download_callback.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
|
||||
interrupt_reason);
|
||||
}
|
||||
|
||||
void AtomDownloadManagerDelegate::Shutdown() {
|
||||
|
||||
@@ -45,20 +45,10 @@ class AtomDownloadManagerDelegate : public content::DownloadManagerDelegate {
|
||||
const content::DownloadTargetCallback& callback,
|
||||
const base::FilePath& default_path);
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
void OnDownloadSaveDialogDone(
|
||||
uint32_t download_id,
|
||||
const content::DownloadTargetCallback& download_callback,
|
||||
bool result,
|
||||
const base::FilePath& path,
|
||||
const std::string& bookmark);
|
||||
#else
|
||||
void OnDownloadSaveDialogDone(
|
||||
uint32_t download_id,
|
||||
const content::DownloadTargetCallback& download_callback,
|
||||
bool result,
|
||||
const base::FilePath& path);
|
||||
#endif
|
||||
mate::Dictionary result);
|
||||
|
||||
content::DownloadManager* download_manager_;
|
||||
base::WeakPtrFactory<AtomDownloadManagerDelegate> weak_ptr_factory_;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "atom/browser/atom_permission_manager.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "atom/browser/atom_browser_client.h"
|
||||
@@ -32,9 +33,9 @@ bool WebContentsDestroyed(int process_id) {
|
||||
}
|
||||
|
||||
void PermissionRequestResponseCallbackWrapper(
|
||||
const AtomPermissionManager::StatusCallback& callback,
|
||||
AtomPermissionManager::StatusCallback callback,
|
||||
const std::vector<blink::mojom::PermissionStatus>& vector) {
|
||||
callback.Run(vector[0]);
|
||||
std::move(callback).Run(vector[0]);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -43,9 +44,9 @@ class AtomPermissionManager::PendingRequest {
|
||||
public:
|
||||
PendingRequest(content::RenderFrameHost* render_frame_host,
|
||||
const std::vector<content::PermissionType>& permissions,
|
||||
const StatusesCallback& callback)
|
||||
StatusesCallback callback)
|
||||
: render_process_id_(render_frame_host->GetProcess()->GetID()),
|
||||
callback_(callback),
|
||||
callback_(std::move(callback)),
|
||||
permissions_(permissions),
|
||||
results_(permissions.size(), blink::mojom::PermissionStatus::DENIED),
|
||||
remaining_results_(permissions.size()) {}
|
||||
@@ -74,11 +75,15 @@ class AtomPermissionManager::PendingRequest {
|
||||
|
||||
bool IsComplete() const { return remaining_results_ == 0; }
|
||||
|
||||
void RunCallback() const { callback_.Run(results_); }
|
||||
void RunCallback() {
|
||||
if (!callback_.is_null()) {
|
||||
std::move(callback_).Run(results_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int render_process_id_;
|
||||
const StatusesCallback callback_;
|
||||
StatusesCallback callback_;
|
||||
std::vector<content::PermissionType> permissions_;
|
||||
std::vector<blink::mojom::PermissionStatus> results_;
|
||||
size_t remaining_results_;
|
||||
@@ -91,8 +96,8 @@ AtomPermissionManager::~AtomPermissionManager() {}
|
||||
void AtomPermissionManager::SetPermissionRequestHandler(
|
||||
const RequestHandler& handler) {
|
||||
if (handler.is_null() && !pending_requests_.IsEmpty()) {
|
||||
for (PendingRequestsMap::const_iterator iter(&pending_requests_);
|
||||
!iter.IsAtEnd(); iter.Advance()) {
|
||||
for (PendingRequestsMap::iterator iter(&pending_requests_); !iter.IsAtEnd();
|
||||
iter.Advance()) {
|
||||
auto* request = iter.GetCurrentValue();
|
||||
if (!WebContentsDestroyed(request->render_process_id()))
|
||||
request->RunCallback();
|
||||
@@ -112,11 +117,10 @@ int AtomPermissionManager::RequestPermission(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(blink::mojom::PermissionStatus)>&
|
||||
response_callback) {
|
||||
StatusCallback response_callback) {
|
||||
return RequestPermissionWithDetails(permission, render_frame_host,
|
||||
requesting_origin, user_gesture, nullptr,
|
||||
response_callback);
|
||||
std::move(response_callback));
|
||||
}
|
||||
|
||||
int AtomPermissionManager::RequestPermissionWithDetails(
|
||||
@@ -125,11 +129,12 @@ int AtomPermissionManager::RequestPermissionWithDetails(
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::DictionaryValue* details,
|
||||
const StatusCallback& response_callback) {
|
||||
StatusCallback response_callback) {
|
||||
return RequestPermissionsWithDetails(
|
||||
std::vector<content::PermissionType>(1, permission), render_frame_host,
|
||||
requesting_origin, user_gesture, details,
|
||||
base::Bind(&PermissionRequestResponseCallbackWrapper, response_callback));
|
||||
base::BindOnce(PermissionRequestResponseCallbackWrapper,
|
||||
std::move(response_callback)));
|
||||
}
|
||||
|
||||
int AtomPermissionManager::RequestPermissions(
|
||||
@@ -137,10 +142,10 @@ int AtomPermissionManager::RequestPermissions(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const StatusesCallback& response_callback) {
|
||||
StatusesCallback response_callback) {
|
||||
return RequestPermissionsWithDetails(permissions, render_frame_host,
|
||||
requesting_origin, user_gesture, nullptr,
|
||||
response_callback);
|
||||
std::move(response_callback));
|
||||
}
|
||||
|
||||
int AtomPermissionManager::RequestPermissionsWithDetails(
|
||||
@@ -149,9 +154,9 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::DictionaryValue* details,
|
||||
const StatusesCallback& response_callback) {
|
||||
StatusesCallback response_callback) {
|
||||
if (permissions.empty()) {
|
||||
response_callback.Run(std::vector<blink::mojom::PermissionStatus>());
|
||||
std::move(response_callback).Run({});
|
||||
return content::PermissionController::kNoPendingOperation;
|
||||
}
|
||||
|
||||
@@ -169,20 +174,20 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
|
||||
}
|
||||
statuses.push_back(blink::mojom::PermissionStatus::GRANTED);
|
||||
}
|
||||
response_callback.Run(statuses);
|
||||
std::move(response_callback).Run(statuses);
|
||||
return content::PermissionController::kNoPendingOperation;
|
||||
}
|
||||
|
||||
auto* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
int request_id = pending_requests_.Add(std::make_unique<PendingRequest>(
|
||||
render_frame_host, permissions, response_callback));
|
||||
render_frame_host, permissions, std::move(response_callback)));
|
||||
|
||||
for (size_t i = 0; i < permissions.size(); ++i) {
|
||||
auto permission = permissions[i];
|
||||
const auto callback =
|
||||
base::Bind(&AtomPermissionManager::OnPermissionResponse,
|
||||
base::Unretained(this), request_id, i);
|
||||
base::BindRepeating(&AtomPermissionManager::OnPermissionResponse,
|
||||
base::Unretained(this), request_id, i);
|
||||
if (details == nullptr) {
|
||||
request_handler_.Run(web_contents, permission, callback,
|
||||
base::DictionaryValue());
|
||||
@@ -224,7 +229,7 @@ int AtomPermissionManager::SubscribePermissionStatusChange(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
const base::Callback<void(blink::mojom::PermissionStatus)>& callback) {
|
||||
base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,13 @@ class AtomPermissionManager : public content::PermissionControllerDelegate {
|
||||
AtomPermissionManager();
|
||||
~AtomPermissionManager() override;
|
||||
|
||||
using StatusCallback = base::Callback<void(blink::mojom::PermissionStatus)>;
|
||||
using StatusesCallback =
|
||||
base::Callback<void(const std::vector<blink::mojom::PermissionStatus>&)>;
|
||||
using StatusCallback =
|
||||
base::OnceCallback<void(blink::mojom::PermissionStatus)>;
|
||||
using StatusesCallback = base::OnceCallback<void(
|
||||
const std::vector<blink::mojom::PermissionStatus>&)>;
|
||||
using RequestHandler = base::Callback<void(content::WebContents*,
|
||||
content::PermissionType,
|
||||
const StatusCallback&,
|
||||
StatusCallback,
|
||||
const base::DictionaryValue&)>;
|
||||
using CheckHandler = base::Callback<bool(content::WebContents*,
|
||||
content::PermissionType,
|
||||
@@ -42,35 +43,30 @@ class AtomPermissionManager : public content::PermissionControllerDelegate {
|
||||
void SetPermissionCheckHandler(const CheckHandler& handler);
|
||||
|
||||
// content::PermissionControllerDelegate:
|
||||
int RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
|
||||
override;
|
||||
int RequestPermission(content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
StatusCallback callback) override;
|
||||
int RequestPermissionWithDetails(content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::DictionaryValue* details,
|
||||
const StatusCallback& callback);
|
||||
StatusCallback callback);
|
||||
int RequestPermissions(
|
||||
const std::vector<content::PermissionType>& permissions,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<
|
||||
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
|
||||
override;
|
||||
StatusesCallback callback) override;
|
||||
int RequestPermissionsWithDetails(
|
||||
const std::vector<content::PermissionType>& permissions,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::DictionaryValue* details,
|
||||
const base::Callback<
|
||||
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback);
|
||||
StatusesCallback callback);
|
||||
blink::mojom::PermissionStatus GetPermissionStatusForFrame(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
@@ -98,7 +94,7 @@ class AtomPermissionManager : public content::PermissionControllerDelegate {
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
|
||||
base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback)
|
||||
override;
|
||||
void UnsubscribePermissionStatusChange(int subscription_id) override;
|
||||
|
||||
|
||||
@@ -197,6 +197,7 @@ class Browser : public WindowListObserver {
|
||||
base::string16 arguments;
|
||||
base::string16 title;
|
||||
base::string16 description;
|
||||
base::FilePath working_dir;
|
||||
base::FilePath icon_path;
|
||||
int icon_index;
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
|
||||
void Browser::SetAppUserModelID(const base::string16& name) {}
|
||||
|
||||
bool Browser::SetBadgeCount(int count) {
|
||||
DockSetBadgeText(count != 0 ? base::IntToString(count) : "");
|
||||
DockSetBadgeText(count != 0 ? base::NumberToString(count) : "");
|
||||
badge_count_ = count;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "chrome/browser/net/chrome_net_log_helper.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "components/net_log/net_export_file_writer.h"
|
||||
@@ -19,6 +18,7 @@
|
||||
#include "components/proxy_config/proxy_config_dictionary.h"
|
||||
#include "components/proxy_config/proxy_config_pref_names.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "net/log/net_log_capture_mode.h"
|
||||
#include "net/proxy_resolution/proxy_config.h"
|
||||
#include "net/proxy_resolution/proxy_config_service.h"
|
||||
#include "net/proxy_resolution/proxy_config_with_annotation.h"
|
||||
@@ -105,7 +105,9 @@ void BrowserProcessImpl::PreCreateThreads(
|
||||
command_line.GetSwitchValuePath(network::switches::kLogNetLog);
|
||||
if (!log_file.empty()) {
|
||||
net_log_->StartWritingToFile(
|
||||
log_file, GetNetCaptureModeFromCommandLine(command_line),
|
||||
log_file,
|
||||
net::GetNetCaptureModeFromCommandLine(
|
||||
command_line, network::switches::kNetLogCaptureMode),
|
||||
command_line.GetCommandLineString(), std::string());
|
||||
}
|
||||
}
|
||||
@@ -338,3 +340,7 @@ printing::PrintJobManager* BrowserProcessImpl::print_job_manager() {
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
StartupData* BrowserProcessImpl::startup_data() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ class BrowserProcessImpl : public BrowserProcess {
|
||||
void SetApplicationLocale(const std::string& locale) override;
|
||||
const std::string& GetApplicationLocale() override;
|
||||
printing::PrintJobManager* print_job_manager() override;
|
||||
StartupData* startup_data() override;
|
||||
|
||||
private:
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
|
||||
@@ -96,7 +96,7 @@ void Browser::Focus() {
|
||||
}
|
||||
|
||||
void Browser::AddRecentDocument(const base::FilePath& path) {
|
||||
if (base::win::GetVersion() < base::win::VERSION_WIN7)
|
||||
if (base::win::GetVersion() < base::win::Version::WIN7)
|
||||
return;
|
||||
|
||||
CComPtr<IShellItem> item;
|
||||
@@ -141,6 +141,7 @@ bool Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
|
||||
item.icon_path = task.icon_path;
|
||||
item.icon_index = task.icon_index;
|
||||
item.description = task.description;
|
||||
item.working_dir = task.working_dir;
|
||||
category.items.push_back(item);
|
||||
}
|
||||
|
||||
@@ -346,7 +347,7 @@ std::string Browser::GetExecutableFileProductName() const {
|
||||
|
||||
bool Browser::IsEmojiPanelSupported() {
|
||||
// emoji picker is supported on Windows 10's Spring 2018 update & above.
|
||||
return base::win::GetVersion() >= base::win::Version::VERSION_WIN10_RS4;
|
||||
return base::win::GetVersion() >= base::win::Version::WIN10_RS4;
|
||||
}
|
||||
|
||||
void Browser::ShowEmojiPanel() {
|
||||
|
||||
@@ -84,22 +84,23 @@ std::string RegisterFileSystem(content::WebContents* web_contents,
|
||||
const base::FilePath& path) {
|
||||
auto* isolated_context = storage::IsolatedContext::GetInstance();
|
||||
std::string root_name(kRootName);
|
||||
std::string file_system_id = isolated_context->RegisterFileSystemForPath(
|
||||
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
|
||||
storage::IsolatedContext::ScopedFSHandle file_system =
|
||||
isolated_context->RegisterFileSystemForPath(
|
||||
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
|
||||
|
||||
content::ChildProcessSecurityPolicy* policy =
|
||||
content::ChildProcessSecurityPolicy::GetInstance();
|
||||
content::RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
|
||||
int renderer_id = render_view_host->GetProcess()->GetID();
|
||||
policy->GrantReadFileSystem(renderer_id, file_system_id);
|
||||
policy->GrantWriteFileSystem(renderer_id, file_system_id);
|
||||
policy->GrantCreateFileForFileSystem(renderer_id, file_system_id);
|
||||
policy->GrantDeleteFromFileSystem(renderer_id, file_system_id);
|
||||
policy->GrantReadFileSystem(renderer_id, file_system.id());
|
||||
policy->GrantWriteFileSystem(renderer_id, file_system.id());
|
||||
policy->GrantCreateFileForFileSystem(renderer_id, file_system.id());
|
||||
policy->GrantDeleteFromFileSystem(renderer_id, file_system.id());
|
||||
|
||||
if (!policy->CanReadFile(renderer_id, path))
|
||||
policy->GrantReadFile(renderer_id, path);
|
||||
|
||||
return file_system_id;
|
||||
return file_system.id();
|
||||
}
|
||||
|
||||
FileSystem CreateFileSystemStruct(content::WebContents* web_contents,
|
||||
@@ -352,9 +353,8 @@ blink::WebSecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
|
||||
SecurityStateTabHelper* helper =
|
||||
SecurityStateTabHelper::FromWebContents(web_contents);
|
||||
DCHECK(helper);
|
||||
security_state::SecurityInfo security_info;
|
||||
helper->GetSecurityInfo(&security_info);
|
||||
return security_state::GetSecurityStyle(security_info,
|
||||
return security_state::GetSecurityStyle(helper->GetSecurityLevel(),
|
||||
*helper->GetVisibleSecurityState(),
|
||||
security_style_explanations);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "atom/browser/net/url_request_context_getter.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
@@ -35,6 +36,24 @@ IOThread::~IOThread() {
|
||||
BrowserThread::SetIOThreadDelegate(nullptr);
|
||||
}
|
||||
|
||||
void IOThread::RegisterURLRequestContextGetter(
|
||||
atom::URLRequestContextGetter* getter) {
|
||||
base::AutoLock lock(lock_);
|
||||
|
||||
DCHECK(!base::FeatureList::IsEnabled(network::features::kNetworkService));
|
||||
DCHECK_EQ(0u, request_context_getters_.count(getter));
|
||||
request_context_getters_.insert(getter);
|
||||
}
|
||||
|
||||
void IOThread::DeregisterURLRequestContextGetter(
|
||||
atom::URLRequestContextGetter* getter) {
|
||||
base::AutoLock lock(lock_);
|
||||
|
||||
DCHECK(!base::FeatureList::IsEnabled(network::features::kNetworkService));
|
||||
DCHECK_EQ(1u, request_context_getters_.count(getter));
|
||||
request_context_getters_.erase(getter);
|
||||
}
|
||||
|
||||
void IOThread::Init() {
|
||||
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
|
||||
std::unique_ptr<network::URLRequestContextBuilderMojo> builder =
|
||||
@@ -45,7 +64,7 @@ void IOThread::Init() {
|
||||
|
||||
auto cert_verifier = std::make_unique<net::CachingCertVerifier>(
|
||||
std::make_unique<net::MultiThreadedCertVerifier>(
|
||||
net::CertVerifyProc::CreateDefault()));
|
||||
net::CertVerifyProc::CreateDefault(nullptr)));
|
||||
builder->SetCertVerifier(std::move(cert_verifier));
|
||||
|
||||
// Create the network service, so that shared host resolver
|
||||
@@ -55,20 +74,24 @@ void IOThread::Init() {
|
||||
network_service->ConfigureHttpAuthPrefs(
|
||||
std::move(http_auth_dynamic_params_));
|
||||
|
||||
system_network_context_ =
|
||||
network_service
|
||||
->CreateNetworkContextWithBuilder(
|
||||
std::move(network_context_request_),
|
||||
std::move(network_context_params_), std::move(builder),
|
||||
&system_request_context_)
|
||||
.release();
|
||||
system_network_context_ = network_service->CreateNetworkContextWithBuilder(
|
||||
std::move(network_context_request_), std::move(network_context_params_),
|
||||
std::move(builder), &system_request_context_);
|
||||
}
|
||||
}
|
||||
|
||||
void IOThread::CleanUp() {
|
||||
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
|
||||
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
|
||||
system_request_context_->proxy_resolution_service()->OnShutdown();
|
||||
|
||||
base::AutoLock lock(lock_);
|
||||
for (auto* getter : request_context_getters_) {
|
||||
getter->NotifyContextShuttingDown();
|
||||
}
|
||||
|
||||
system_network_context_.reset();
|
||||
}
|
||||
|
||||
if (net_log_)
|
||||
net_log_->ShutDownBeforeTaskScheduler();
|
||||
net_log_->ShutDownBeforeThreadPool();
|
||||
}
|
||||
|
||||
@@ -6,12 +6,18 @@
|
||||
#define ATOM_BROWSER_IO_THREAD_H_
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "atom/browser/net/system_network_context_manager.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "content/public/browser/browser_thread_delegate.h"
|
||||
#include "services/network/public/mojom/network_service.mojom.h"
|
||||
|
||||
namespace atom {
|
||||
class URLRequestContextGetter;
|
||||
}
|
||||
|
||||
namespace net {
|
||||
class URLRequestContext;
|
||||
}
|
||||
@@ -27,6 +33,9 @@ class IOThread : public content::BrowserThreadDelegate {
|
||||
SystemNetworkContextManager* system_network_context_manager);
|
||||
~IOThread() override;
|
||||
|
||||
void RegisterURLRequestContextGetter(atom::URLRequestContextGetter* getter);
|
||||
void DeregisterURLRequestContextGetter(atom::URLRequestContextGetter* getter);
|
||||
|
||||
protected:
|
||||
// BrowserThreadDelegate Implementation, runs on the IO thread.
|
||||
void Init() override;
|
||||
@@ -39,13 +48,7 @@ class IOThread : public content::BrowserThreadDelegate {
|
||||
|
||||
// When the network service is disabled, this holds on to a
|
||||
// content::NetworkContext class that owns |system_request_context_|.
|
||||
// TODO(deepak1556): primary network context has to be destroyed after
|
||||
// other active contexts, but since the ownership of latter is not released
|
||||
// before IO thread is destroyed, it results in a DCHECK failure.
|
||||
// We leak the reference to primary context to workaround this issue,
|
||||
// since there is only one instance for the entire lifetime of app, it is
|
||||
// safe.
|
||||
network::mojom::NetworkContext* system_network_context_;
|
||||
std::unique_ptr<network::mojom::NetworkContext> system_network_context_;
|
||||
net::URLRequestContext* system_request_context_;
|
||||
|
||||
// These are set on the UI thread, and then consumed during initialization on
|
||||
@@ -59,6 +62,13 @@ class IOThread : public content::BrowserThreadDelegate {
|
||||
network::mojom::HttpAuthStaticParamsPtr http_auth_static_params_;
|
||||
network::mojom::HttpAuthDynamicParamsPtr http_auth_dynamic_params_;
|
||||
|
||||
// |lock_| protects access to |request_context_getters_|.
|
||||
base::Lock lock_;
|
||||
|
||||
// List of all request contexts that needs to be notified when
|
||||
// IO thread is shutting down.
|
||||
std::set<atom::URLRequestContextGetter*> request_context_getters_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(IOThread);
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "atom/common/node_includes.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/task/task_scheduler/initialization_util.h"
|
||||
#include "base/task/thread_pool/initialization_util.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "gin/array_buffer.h"
|
||||
@@ -49,7 +49,7 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
|
||||
auto* tracing_controller = tracing_agent->GetTracingController();
|
||||
node::tracing::TraceEventHelper::SetAgent(tracing_agent);
|
||||
platform_ = node::CreatePlatform(
|
||||
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
|
||||
base::RecommendedMaxNumberOfThreadsInThreadGroup(3, 8, 0.1, 0),
|
||||
tracing_controller);
|
||||
|
||||
v8::V8::InitializePlatform(platform_);
|
||||
|
||||
@@ -26,7 +26,7 @@ LoginHandler::LoginHandler(net::URLRequest* request,
|
||||
net::AuthCredentials* credentials,
|
||||
content::ResourceRequestInfo* resource_request_info)
|
||||
: credentials_(credentials),
|
||||
auth_info_(&auth_info),
|
||||
auth_info_(std::make_unique<net::AuthChallengeInfo>(auth_info)),
|
||||
auth_callback_(std::move(callback)),
|
||||
weak_factory_(this) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef ATOM_BROWSER_LOGIN_HANDLER_H_
|
||||
#define ATOM_BROWSER_LOGIN_HANDLER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
@@ -57,7 +59,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
|
||||
net::AuthCredentials* credentials_;
|
||||
|
||||
// Who/where/what asked for the authentication.
|
||||
scoped_refptr<const net::AuthChallengeInfo> auth_info_;
|
||||
std::unique_ptr<const net::AuthChallengeInfo> auth_info_;
|
||||
|
||||
// WebContents associated with the login request.
|
||||
content::ResourceRequestInfo::WebContentsGetter web_contents_getter_;
|
||||
|
||||
@@ -167,7 +167,7 @@ class NativeWindowMac : public NativeWindow {
|
||||
|
||||
private:
|
||||
// Add custom layers to the content view.
|
||||
void AddContentViewLayers();
|
||||
void AddContentViewLayers(bool minimizable, bool closable);
|
||||
|
||||
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
||||
void SetForwardMouseMessages(bool forward);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "base/mac/mac_util.h"
|
||||
#include "base/mac/scoped_cftyperef.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "components/remote_cocoa/app_shim/bridged_native_widget_impl.h"
|
||||
#include "content/public/browser/browser_accessibility_state.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "skia/ext/skia_utils_mac.h"
|
||||
@@ -30,7 +31,6 @@
|
||||
#include "ui/gl/gpu_switching_manager.h"
|
||||
#include "ui/views/background.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
|
||||
// as a NSWindow's contentView. It is needed because NSWindow's implementation
|
||||
@@ -73,9 +73,11 @@
|
||||
NSButton* close_button =
|
||||
[NSWindow standardWindowButton:NSWindowCloseButton
|
||||
forStyleMask:NSWindowStyleMaskTitled];
|
||||
[close_button setTag:1];
|
||||
NSButton* miniaturize_button =
|
||||
[NSWindow standardWindowButton:NSWindowMiniaturizeButton
|
||||
forStyleMask:NSWindowStyleMaskTitled];
|
||||
[miniaturize_button setTag:2];
|
||||
|
||||
CGFloat x = 0;
|
||||
const CGFloat space_between = 20;
|
||||
@@ -459,7 +461,7 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||
|
||||
// Default content view.
|
||||
SetContentView(new views::View());
|
||||
AddContentViewLayers();
|
||||
AddContentViewLayers(minimizable, closable);
|
||||
|
||||
original_frame_ = [window_ frame];
|
||||
original_level_ = [window_ level];
|
||||
@@ -851,9 +853,9 @@ void NativeWindowMac::SetAlwaysOnTop(bool top,
|
||||
if (newLevel >= minWindowLevel && newLevel <= maxWindowLevel) {
|
||||
[window_ setLevel:newLevel];
|
||||
} else {
|
||||
*error = std::string([
|
||||
[NSString stringWithFormat:@"relativeLevel must be between %d and %d",
|
||||
minWindowLevel, maxWindowLevel] UTF8String]);
|
||||
*error = std::string([[NSString
|
||||
stringWithFormat:@"relativeLevel must be between %d and %d",
|
||||
minWindowLevel, maxWindowLevel] UTF8String]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1102,7 +1104,7 @@ void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
|
||||
}
|
||||
|
||||
[view->GetInspectableWebContentsView()->GetNativeView().GetNativeNSView()
|
||||
removeFromSuperview];
|
||||
removeFromSuperview];
|
||||
remove_browser_view(view);
|
||||
|
||||
[CATransaction commit];
|
||||
@@ -1384,7 +1386,7 @@ views::View* NativeWindowMac::GetContentsView() {
|
||||
return root_view_.get();
|
||||
}
|
||||
|
||||
void NativeWindowMac::AddContentViewLayers() {
|
||||
void NativeWindowMac::AddContentViewLayers(bool minimizable, bool closable) {
|
||||
// Make sure the bottom corner is rounded for non-modal windows:
|
||||
// http://crbug.com/396264.
|
||||
if (!is_modal()) {
|
||||
@@ -1424,6 +1426,12 @@ void NativeWindowMac::AddContentViewLayers() {
|
||||
[[CustomWindowButtonView alloc] initWithFrame:NSZeroRect]);
|
||||
// NSWindowStyleMaskFullSizeContentView does not work with zoom button
|
||||
SetFullScreenable(false);
|
||||
|
||||
if (!minimizable)
|
||||
[[buttons_view_ viewWithTag:2] removeFromSuperview];
|
||||
if (!closable)
|
||||
[[buttons_view_ viewWithTag:1] removeFromSuperview];
|
||||
|
||||
[[window_ contentView] addSubview:buttons_view_];
|
||||
} else {
|
||||
if (title_bar_style_ != NORMAL)
|
||||
@@ -1480,7 +1488,7 @@ void NativeWindowMac::OverrideNSWindowContentView() {
|
||||
setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
[container_view_ setFrame:[[[window_ contentView] superview] bounds]];
|
||||
[window_ setContentView:container_view_];
|
||||
AddContentViewLayers();
|
||||
AddContentViewLayers(IsMinimizable(), IsClosable());
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetStyleMask(bool on, NSUInteger flag) {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "atom/browser/native_window_views.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <objbase.h>
|
||||
#include <wrl/client.h>
|
||||
#endif
|
||||
|
||||
@@ -59,10 +58,8 @@
|
||||
#elif defined(OS_WIN)
|
||||
#include "atom/browser/ui/views/win_frame_view.h"
|
||||
#include "atom/browser/ui/win/atom_desktop_native_widget_aura.h"
|
||||
#include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h"
|
||||
#include "skia/ext/skia_utils_win.h"
|
||||
#include "ui/base/win/shell.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/display/win/screen_win.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
||||
@@ -188,11 +185,7 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options,
|
||||
if (parent)
|
||||
params.parent = parent->GetNativeWindow();
|
||||
|
||||
params.native_widget = new AtomDesktopNativeWidgetAura(widget());
|
||||
atom_desktop_window_tree_host_win_ = new AtomDesktopWindowTreeHostWin(
|
||||
this, widget(),
|
||||
static_cast<views::DesktopNativeWidgetAura*>(params.native_widget));
|
||||
params.desktop_window_tree_host = atom_desktop_window_tree_host_win_;
|
||||
params.native_widget = new AtomDesktopNativeWidgetAura(this);
|
||||
#elif defined(USE_X11)
|
||||
std::string name = Browser::Get()->GetName();
|
||||
// Set WM_WINDOW_ROLE.
|
||||
@@ -380,6 +373,9 @@ void NativeWindowViews::Show() {
|
||||
|
||||
widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect());
|
||||
|
||||
// explicitly focus the window
|
||||
widget()->Activate();
|
||||
|
||||
NotifyWindowShow();
|
||||
|
||||
#if defined(USE_X11)
|
||||
@@ -470,24 +466,15 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(USE_X11)
|
||||
void NativeWindowViews::Maximize() {
|
||||
#if defined(OS_WIN)
|
||||
// For window without WS_THICKFRAME style, we can not call Maximize().
|
||||
if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
|
||||
restore_bounds_ = GetBounds();
|
||||
auto display =
|
||||
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
|
||||
SetBounds(display.work_area(), false);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (IsVisible())
|
||||
widget()->Maximize();
|
||||
else
|
||||
widget()->native_widget_private()->Show(ui::SHOW_STATE_MAXIMIZED,
|
||||
gfx::Rect());
|
||||
}
|
||||
#endif
|
||||
|
||||
void NativeWindowViews::Unmaximize() {
|
||||
#if defined(OS_WIN)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "atom/browser/ui/win/message_handler_delegate.h"
|
||||
#include "atom/browser/ui/win/taskbar_host.h"
|
||||
#include "base/win/scoped_gdi_object.h"
|
||||
#endif
|
||||
@@ -30,16 +29,11 @@ class GlobalMenuBarX11;
|
||||
class RootView;
|
||||
class WindowStateWatcher;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
class AtomDesktopWindowTreeHostWin;
|
||||
#elif defined(USE_X11)
|
||||
#if defined(USE_X11)
|
||||
class EventDisabler;
|
||||
#endif
|
||||
|
||||
class NativeWindowViews : public NativeWindow,
|
||||
#if defined(OS_WIN)
|
||||
public MessageHandlerDelegate,
|
||||
#endif
|
||||
public views::WidgetObserver,
|
||||
public ui::EventHandler {
|
||||
public:
|
||||
@@ -142,6 +136,16 @@ class NativeWindowViews : public NativeWindow,
|
||||
void DecrementChildModals();
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Catch-all message handling and filtering. Called before
|
||||
// HWNDMessageHandler's built-in handling, which may pre-empt some
|
||||
// expectations in Views/Aura if messages are consumed. Returns true if the
|
||||
// message was consumed by the delegate and should not be processed further
|
||||
// by the HWNDMessageHandler. In this case, |result| is returned. |result| is
|
||||
// not modified otherwise.
|
||||
bool PreHandleMSG(UINT message,
|
||||
WPARAM w_param,
|
||||
LPARAM l_param,
|
||||
LRESULT* result);
|
||||
void SetIcon(HICON small_icon, HICON app_icon);
|
||||
#elif defined(USE_X11)
|
||||
void SetIcon(const gfx::ImageSkia& icon);
|
||||
@@ -180,11 +184,6 @@ class NativeWindowViews : public NativeWindow,
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// MessageHandlerDelegate:
|
||||
bool PreHandleMSG(UINT message,
|
||||
WPARAM w_param,
|
||||
LPARAM l_param,
|
||||
LRESULT* result) override;
|
||||
void HandleSizeEvent(WPARAM w_param, LPARAM l_param);
|
||||
void SetForwardMouseMessages(bool forward);
|
||||
static LRESULT CALLBACK SubclassProc(HWND hwnd,
|
||||
@@ -237,8 +236,6 @@ class NativeWindowViews : public NativeWindow,
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Weak ref.
|
||||
AtomDesktopWindowTreeHostWin* atom_desktop_window_tree_host_win_;
|
||||
|
||||
ui::WindowShowState last_window_state_;
|
||||
|
||||
|
||||
@@ -2,14 +2,19 @@
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <dwmapi.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "atom/browser/browser.h"
|
||||
#include "atom/browser/native_window_views.h"
|
||||
#include "atom/browser/ui/views/root_view.h"
|
||||
#include "atom/common/atom_constants.h"
|
||||
#include "content/public/browser/browser_accessibility_state.h"
|
||||
#include "ui/base/win/accessibility_misc_utils.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/win/screen_win.h"
|
||||
#include "ui/gfx/geometry/insets.h"
|
||||
#include "ui/views/widget/native_widget_private.h"
|
||||
|
||||
// Must be included after other Windows headers.
|
||||
#include <UIAutomationCoreApi.h>
|
||||
@@ -138,11 +143,155 @@ bool IsScreenReaderActive() {
|
||||
return screenReader && UiaClientsAreListening();
|
||||
}
|
||||
|
||||
// We use "enum" instead of "enum class" because we need to do bitwise compare.
|
||||
enum AppbarAutohideEdge {
|
||||
TOP = 1 << 0,
|
||||
LEFT = 1 << 1,
|
||||
BOTTOM = 1 << 2,
|
||||
RIGHT = 1 << 3,
|
||||
};
|
||||
|
||||
// The thickness of an auto-hide taskbar in pixel.
|
||||
constexpr int kAutoHideTaskbarThicknessPx = 2;
|
||||
|
||||
// Code is copied from chrome_views_delegate_win.cc.
|
||||
bool MonitorHasAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
|
||||
APPBARDATA taskbar_data = {sizeof(APPBARDATA), NULL, 0, edge};
|
||||
taskbar_data.hWnd = ::GetForegroundWindow();
|
||||
|
||||
// MSDN documents an ABM_GETAUTOHIDEBAREX, which supposedly takes a monitor
|
||||
// rect and returns autohide bars on that monitor. This sounds like a good
|
||||
// idea for multi-monitor systems. Unfortunately, it appears to not work at
|
||||
// least some of the time (erroneously returning NULL) and there's almost no
|
||||
// online documentation or other sample code using it that suggests ways to
|
||||
// address this problem. We do the following:-
|
||||
// 1. Use the ABM_GETAUTOHIDEBAR message. If it works, i.e. returns a valid
|
||||
// window we are done.
|
||||
// 2. If the ABM_GETAUTOHIDEBAR message does not work we query the auto hide
|
||||
// state of the taskbar and then retrieve its position. That call returns
|
||||
// the edge on which the taskbar is present. If it matches the edge we
|
||||
// are looking for, we are done.
|
||||
// NOTE: This call spins a nested run loop.
|
||||
HWND taskbar = reinterpret_cast<HWND>(
|
||||
SHAppBarMessage(ABM_GETAUTOHIDEBAR, &taskbar_data));
|
||||
if (!::IsWindow(taskbar)) {
|
||||
APPBARDATA taskbar_data = {sizeof(APPBARDATA), 0, 0, 0};
|
||||
unsigned int taskbar_state = SHAppBarMessage(ABM_GETSTATE, &taskbar_data);
|
||||
if (!(taskbar_state & ABS_AUTOHIDE))
|
||||
return false;
|
||||
|
||||
taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", NULL);
|
||||
if (!::IsWindow(taskbar_data.hWnd))
|
||||
return false;
|
||||
|
||||
SHAppBarMessage(ABM_GETTASKBARPOS, &taskbar_data);
|
||||
if (taskbar_data.uEdge == edge)
|
||||
taskbar = taskbar_data.hWnd;
|
||||
}
|
||||
|
||||
// There is a potential race condition here:
|
||||
// 1. A maximized chrome window is fullscreened.
|
||||
// 2. It is switched back to maximized.
|
||||
// 3. In the process the window gets a WM_NCCACLSIZE message which calls us to
|
||||
// get the autohide state.
|
||||
// 4. The worker thread is invoked. It calls the API to get the autohide
|
||||
// state. On Windows versions earlier than Windows 7, taskbars could
|
||||
// easily be always on top or not.
|
||||
// This meant that we only want to look for taskbars which have the topmost
|
||||
// bit set. However this causes problems in cases where the window on the
|
||||
// main thread is still in the process of switching away from fullscreen.
|
||||
// In this case the taskbar might not yet have the topmost bit set.
|
||||
// 5. The main thread resumes and does not leave space for the taskbar and
|
||||
// hence it does not pop when hovered.
|
||||
//
|
||||
// To address point 4 above, it is best to not check for the WS_EX_TOPMOST
|
||||
// window style on the taskbar, as starting from Windows 7, the topmost
|
||||
// style is always set. We don't support XP and Vista anymore.
|
||||
if (::IsWindow(taskbar)) {
|
||||
if (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONEAREST) == monitor)
|
||||
return true;
|
||||
// In some cases like when the autohide taskbar is on the left of the
|
||||
// secondary monitor, the MonitorFromWindow call above fails to return the
|
||||
// correct monitor the taskbar is on. We fallback to MonitorFromPoint for
|
||||
// the cursor position in that case, which seems to work well.
|
||||
POINT cursor_pos = {0};
|
||||
GetCursorPos(&cursor_pos);
|
||||
if (MonitorFromPoint(cursor_pos, MONITOR_DEFAULTTONEAREST) == monitor)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int GetAppbarAutohideEdges(HWND hwnd) {
|
||||
HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL);
|
||||
if (!monitor)
|
||||
return 0;
|
||||
|
||||
int edges = 0;
|
||||
if (MonitorHasAutohideTaskbarForEdge(ABE_LEFT, monitor))
|
||||
edges |= AppbarAutohideEdge::LEFT;
|
||||
if (MonitorHasAutohideTaskbarForEdge(ABE_TOP, monitor))
|
||||
edges |= AppbarAutohideEdge::TOP;
|
||||
if (MonitorHasAutohideTaskbarForEdge(ABE_RIGHT, monitor))
|
||||
edges |= AppbarAutohideEdge::RIGHT;
|
||||
if (MonitorHasAutohideTaskbarForEdge(ABE_BOTTOM, monitor))
|
||||
edges |= AppbarAutohideEdge::BOTTOM;
|
||||
return edges;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::set<NativeWindowViews*> NativeWindowViews::forwarding_windows_;
|
||||
HHOOK NativeWindowViews::mouse_hook_ = NULL;
|
||||
|
||||
void NativeWindowViews::Maximize() {
|
||||
int autohide_edges = 0;
|
||||
if (!has_frame())
|
||||
autohide_edges = GetAppbarAutohideEdges(GetAcceleratedWidget());
|
||||
|
||||
// Only use Maximize() when:
|
||||
// 1. window has WS_THICKFRAME style;
|
||||
// 2. and window is not frameless when there is autohide taskbar.
|
||||
if ((::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME) &&
|
||||
(has_frame() || autohide_edges == 0)) {
|
||||
if (IsVisible())
|
||||
widget()->Maximize();
|
||||
else
|
||||
widget()->native_widget_private()->Show(ui::SHOW_STATE_MAXIMIZED,
|
||||
gfx::Rect());
|
||||
return;
|
||||
}
|
||||
|
||||
gfx::Insets insets;
|
||||
if (!has_frame()) {
|
||||
// When taskbar is autohide, we need to leave some space so the window
|
||||
// isn't treated as a "fullscreen app", which would cause the taskbars
|
||||
// to disappear.
|
||||
//
|
||||
// This trick comes from hwnd_message_handler.cc. While Chromium already
|
||||
// does this for normal window, somehow it is not applying the trick when
|
||||
// using frameless window, and we have to do it ourselves.
|
||||
float scale_factor =
|
||||
display::win::ScreenWin::GetScaleFactorForHWND(GetAcceleratedWidget());
|
||||
int thickness = std::ceil(kAutoHideTaskbarThicknessPx / scale_factor);
|
||||
if (autohide_edges & AppbarAutohideEdge::LEFT)
|
||||
insets.set_left(-thickness);
|
||||
if (autohide_edges & AppbarAutohideEdge::TOP)
|
||||
insets.set_top(-thickness);
|
||||
if (autohide_edges & AppbarAutohideEdge::RIGHT)
|
||||
insets.set_right(thickness);
|
||||
if (autohide_edges & AppbarAutohideEdge::BOTTOM)
|
||||
insets.set_bottom(thickness);
|
||||
}
|
||||
|
||||
restore_bounds_ = GetBounds();
|
||||
auto display =
|
||||
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
|
||||
gfx::Rect bounds = display.work_area();
|
||||
bounds.Inset(insets);
|
||||
SetBounds(bounds, false);
|
||||
}
|
||||
|
||||
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
|
||||
std::string command = AppCommandToString(command_id);
|
||||
NotifyWindowExecuteAppCommand(command);
|
||||
|
||||
@@ -152,7 +152,7 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
||||
};
|
||||
|
||||
AtomCertVerifier::AtomCertVerifier(RequireCTDelegate* ct_delegate)
|
||||
: default_cert_verifier_(net::CertVerifier::CreateDefault()),
|
||||
: default_cert_verifier_(net::CertVerifier::CreateDefault(nullptr)),
|
||||
ct_delegate_(ct_delegate) {}
|
||||
|
||||
AtomCertVerifier::~AtomCertVerifier() {}
|
||||
|
||||
@@ -29,19 +29,19 @@ namespace atom {
|
||||
|
||||
const char* ResourceTypeToString(content::ResourceType type) {
|
||||
switch (type) {
|
||||
case content::RESOURCE_TYPE_MAIN_FRAME:
|
||||
case content::ResourceType::kMainFrame:
|
||||
return "mainFrame";
|
||||
case content::RESOURCE_TYPE_SUB_FRAME:
|
||||
case content::ResourceType::kSubFrame:
|
||||
return "subFrame";
|
||||
case content::RESOURCE_TYPE_STYLESHEET:
|
||||
case content::ResourceType::kStylesheet:
|
||||
return "stylesheet";
|
||||
case content::RESOURCE_TYPE_SCRIPT:
|
||||
case content::ResourceType::kScript:
|
||||
return "script";
|
||||
case content::RESOURCE_TYPE_IMAGE:
|
||||
case content::ResourceType::kImage:
|
||||
return "image";
|
||||
case content::RESOURCE_TYPE_OBJECT:
|
||||
case content::ResourceType::kObject:
|
||||
return "object";
|
||||
case content::RESOURCE_TYPE_XHR:
|
||||
case content::ResourceType::kXhr:
|
||||
return "xhr";
|
||||
default:
|
||||
return "other";
|
||||
|
||||
@@ -347,13 +347,13 @@ void AtomURLRequest::OnReceivedRedirect(net::URLRequest* request,
|
||||
}
|
||||
|
||||
void AtomURLRequest::OnAuthRequired(net::URLRequest* request,
|
||||
net::AuthChallengeInfo* auth_info) {
|
||||
const net::AuthChallengeInfo& auth_info) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
||||
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&AtomURLRequest::InformDelegateAuthenticationRequired,
|
||||
this, scoped_refptr<net::AuthChallengeInfo>(auth_info)));
|
||||
this, auth_info));
|
||||
}
|
||||
|
||||
void AtomURLRequest::OnResponseStarted(net::URLRequest* request,
|
||||
@@ -468,7 +468,7 @@ void AtomURLRequest::InformDelegateReceivedRedirect(
|
||||
}
|
||||
|
||||
void AtomURLRequest::InformDelegateAuthenticationRequired(
|
||||
scoped_refptr<net::AuthChallengeInfo> auth_info) const {
|
||||
const net::AuthChallengeInfo& auth_info) const {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
if (delegate_)
|
||||
delegate_->OnAuthenticationRequired(auth_info);
|
||||
|
||||
@@ -53,7 +53,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
|
||||
const net::RedirectInfo& info,
|
||||
bool* defer_redirect) override;
|
||||
void OnAuthRequired(net::URLRequest* request,
|
||||
net::AuthChallengeInfo* auth_info) override;
|
||||
const net::AuthChallengeInfo& auth_info) override;
|
||||
void OnResponseStarted(net::URLRequest* request, int net_error) override;
|
||||
void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
|
||||
|
||||
@@ -93,7 +93,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
|
||||
const GURL& url,
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers) const;
|
||||
void InformDelegateAuthenticationRequired(
|
||||
scoped_refptr<net::AuthChallengeInfo> auth_info) const;
|
||||
const net::AuthChallengeInfo& auth_info) const;
|
||||
void InformDelegateResponseStarted(
|
||||
scoped_refptr<net::HttpResponseHeaders>) const;
|
||||
void InformDelegateResponseData(
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "atom/browser/atom_browser_client.h"
|
||||
#include "atom/browser/io_thread.h"
|
||||
#include "atom/common/application_info.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
@@ -50,6 +51,8 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams() {
|
||||
command_line->GetSwitchValueASCII(atom::switches::kAuthServerWhitelist);
|
||||
auth_dynamic_params->delegate_whitelist = command_line->GetSwitchValueASCII(
|
||||
atom::switches::kAuthNegotiateDelegateWhitelist);
|
||||
auth_dynamic_params->enable_negotiate_port =
|
||||
command_line->HasSwitch(atom::switches::kEnableAuthNegotiatePort);
|
||||
|
||||
return auth_dynamic_params;
|
||||
}
|
||||
@@ -164,8 +167,7 @@ SystemNetworkContextManager::CreateDefaultNetworkContextParams() {
|
||||
network::mojom::NetworkContextParamsPtr network_context_params =
|
||||
network::mojom::NetworkContextParams::New();
|
||||
|
||||
network_context_params->enable_brotli =
|
||||
base::FeatureList::IsEnabled(features::kBrotliEncoding);
|
||||
network_context_params->enable_brotli = true;
|
||||
|
||||
network_context_params->enable_referrers = true;
|
||||
|
||||
@@ -245,7 +247,8 @@ SystemNetworkContextManager::CreateNetworkContextParams() {
|
||||
|
||||
network_context_params->context_name = std::string("system");
|
||||
|
||||
network_context_params->user_agent = atom::GetApplicationUserAgent();
|
||||
network_context_params->user_agent =
|
||||
atom::AtomBrowserClient::Get()->GetUserAgent();
|
||||
|
||||
network_context_params->http_cache_enabled = false;
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ void URLRequestBufferJob::Kill() {
|
||||
|
||||
void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
|
||||
std::string status("HTTP/1.1 ");
|
||||
status.append(base::IntToString(status_code_));
|
||||
status.append(base::NumberToString(status_code_));
|
||||
status.append(" ");
|
||||
status.append(net::GetHttpReasonPhrase(status_code_));
|
||||
status.append("\0\0", 2);
|
||||
|
||||
@@ -122,9 +122,13 @@ URLRequestContextGetter::Handle::CreateMainRequestContextGetter(
|
||||
content::URLRequestInterceptorScopedVector protocol_interceptors) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
DCHECK(!main_request_context_getter_.get());
|
||||
DCHECK(g_browser_process->io_thread());
|
||||
|
||||
LazyInitialize();
|
||||
main_request_context_getter_ = new URLRequestContextGetter(
|
||||
this, protocol_handlers, std::move(protocol_interceptors));
|
||||
g_browser_process->io_thread()->RegisterURLRequestContextGetter(
|
||||
main_request_context_getter_.get());
|
||||
return main_request_context_getter_;
|
||||
}
|
||||
|
||||
@@ -203,13 +207,13 @@ void URLRequestContextGetter::Handle::LazyInitialize() {
|
||||
|
||||
void URLRequestContextGetter::Handle::ShutdownOnUIThread() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
if (main_request_context_getter_.get()) {
|
||||
|
||||
if (main_request_context_getter_) {
|
||||
if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&URLRequestContextGetter::NotifyContextShuttingDown,
|
||||
base::RetainedRef(main_request_context_getter_),
|
||||
std::move(resource_context_)));
|
||||
base::RetainedRef(main_request_context_getter_)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,18 +242,20 @@ URLRequestContextGetter::~URLRequestContextGetter() {
|
||||
DCHECK(context_shutting_down_);
|
||||
}
|
||||
|
||||
void URLRequestContextGetter::NotifyContextShuttingDown(
|
||||
std::unique_ptr<content::ResourceContext> resource_context) {
|
||||
void URLRequestContextGetter::NotifyContextShuttingDown() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
DCHECK(g_browser_process->io_thread());
|
||||
DCHECK(context_handle_);
|
||||
|
||||
// todo(brenca): remove once C70 lands
|
||||
if (url_request_context_ && url_request_context_->cookie_store()) {
|
||||
url_request_context_->cookie_store()->FlushStore(base::NullCallback());
|
||||
}
|
||||
if (context_shutting_down_)
|
||||
return;
|
||||
|
||||
g_browser_process->io_thread()->DeregisterURLRequestContextGetter(this);
|
||||
|
||||
context_shutting_down_ = true;
|
||||
resource_context.reset();
|
||||
context_handle_->resource_context_.reset();
|
||||
net::URLRequestContextGetter::NotifyContextShuttingDown();
|
||||
network_context_.reset();
|
||||
}
|
||||
|
||||
net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||
@@ -296,7 +302,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||
const auto& custom_standard_schemes = atom::api::GetStandardSchemes();
|
||||
cookie_schemes.insert(cookie_schemes.end(), custom_standard_schemes.begin(),
|
||||
custom_standard_schemes.end());
|
||||
cookie_monster->SetCookieableSchemes(cookie_schemes);
|
||||
cookie_monster->SetCookieableSchemes(cookie_schemes, base::NullCallback());
|
||||
|
||||
// Setup handlers for custom job factory.
|
||||
top_job_factory_.reset(new AtomURLRequestJobFactory);
|
||||
|
||||
@@ -37,7 +37,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||
|
||||
// Discard reference to URLRequestContext and inform observers to
|
||||
// shutdown. Must be called only on IO thread.
|
||||
void NotifyContextShuttingDown(std::unique_ptr<content::ResourceContext>);
|
||||
void NotifyContextShuttingDown();
|
||||
|
||||
AtomURLRequestJobFactory* job_factory() const {
|
||||
return top_job_factory_.get();
|
||||
|
||||
@@ -48,7 +48,7 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStreamJob> job,
|
||||
status_code = 200;
|
||||
}
|
||||
std::string status("HTTP/1.1 ");
|
||||
status.append(base::IntToString(status_code));
|
||||
status.append(base::NumberToString(status_code));
|
||||
status.append(" ");
|
||||
status.append(
|
||||
net::GetHttpReasonPhrase(static_cast<net::HttpStatusCode>(status_code)));
|
||||
|
||||
@@ -37,13 +37,13 @@ void NodeDebugger::Start() {
|
||||
}
|
||||
|
||||
node::DebugOptions options;
|
||||
node::options_parser::DebugOptionsParser options_parser;
|
||||
std::vector<std::string> exec_args;
|
||||
std::vector<std::string> v8_args;
|
||||
std::vector<std::string> errors;
|
||||
|
||||
node::options_parser::DebugOptionsParser::instance.Parse(
|
||||
&args, &exec_args, &v8_args, &options,
|
||||
node::options_parser::kDisallowedInEnvironment, &errors);
|
||||
options_parser.Parse(&args, &exec_args, &v8_args, &options,
|
||||
node::options_parser::kDisallowedInEnvironment, &errors);
|
||||
|
||||
if (!errors.empty()) {
|
||||
// TODO(jeremy): what's the appropriate behaviour here?
|
||||
@@ -51,13 +51,6 @@ void NodeDebugger::Start() {
|
||||
<< base::JoinString(errors, " ");
|
||||
}
|
||||
|
||||
// Set process._debugWaitConnect if --inspect-brk was specified to stop
|
||||
// the debugger on the first line
|
||||
if (options.wait_for_connect()) {
|
||||
mate::Dictionary process(env_->isolate(), env_->process_object());
|
||||
process.Set("_breakFirstLine", true);
|
||||
}
|
||||
|
||||
const char* path = "";
|
||||
if (inspector->Start(path, options,
|
||||
std::make_shared<node::HostPort>(options.host_port),
|
||||
@@ -65,4 +58,10 @@ void NodeDebugger::Start() {
|
||||
DCHECK(env_->inspector_agent()->IsListening());
|
||||
}
|
||||
|
||||
void NodeDebugger::Stop() {
|
||||
auto* inspector = env_->inspector_agent();
|
||||
if (inspector && inspector->IsListening())
|
||||
inspector->Stop();
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -20,6 +20,7 @@ class NodeDebugger {
|
||||
~NodeDebugger();
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
node::Environment* env_;
|
||||
|
||||
@@ -79,7 +79,6 @@ PlatformNotificationService::~PlatformNotificationService() {}
|
||||
|
||||
void PlatformNotificationService::DisplayNotification(
|
||||
content::RenderProcessHost* render_process_host,
|
||||
content::BrowserContext* browser_context,
|
||||
const std::string& notification_id,
|
||||
const GURL& origin,
|
||||
const blink::PlatformNotificationData& notification_data,
|
||||
@@ -100,7 +99,6 @@ void PlatformNotificationService::DisplayNotification(
|
||||
}
|
||||
|
||||
void PlatformNotificationService::DisplayPersistentNotification(
|
||||
content::BrowserContext* browser_context,
|
||||
const std::string& notification_id,
|
||||
const GURL& service_worker_scope,
|
||||
const GURL& origin,
|
||||
@@ -108,11 +106,9 @@ void PlatformNotificationService::DisplayPersistentNotification(
|
||||
const blink::NotificationResources& notification_resources) {}
|
||||
|
||||
void PlatformNotificationService::ClosePersistentNotification(
|
||||
content::BrowserContext* browser_context,
|
||||
const std::string& notification_id) {}
|
||||
|
||||
void PlatformNotificationService::CloseNotification(
|
||||
content::BrowserContext* browser_context,
|
||||
const std::string& notification_id) {
|
||||
auto* presenter = browser_client_->GetNotificationPresenter();
|
||||
if (!presenter)
|
||||
@@ -121,25 +117,19 @@ void PlatformNotificationService::CloseNotification(
|
||||
}
|
||||
|
||||
void PlatformNotificationService::GetDisplayedNotifications(
|
||||
content::BrowserContext* browser_context,
|
||||
DisplayedNotificationsCallback callback) {}
|
||||
|
||||
int64_t PlatformNotificationService::ReadNextPersistentNotificationId(
|
||||
content::BrowserContext* browser_context) {
|
||||
int64_t PlatformNotificationService::ReadNextPersistentNotificationId() {
|
||||
// Electron doesn't support persistent notifications.
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PlatformNotificationService::RecordNotificationUkmEvent(
|
||||
content::BrowserContext* browser_context,
|
||||
const content::NotificationDatabaseData& data) {}
|
||||
|
||||
void PlatformNotificationService::ScheduleTrigger(
|
||||
content::BrowserContext* browser_context,
|
||||
base::Time timestamp) {}
|
||||
void PlatformNotificationService::ScheduleTrigger(base::Time timestamp) {}
|
||||
|
||||
base::Time PlatformNotificationService::ReadNextTriggerTimestamp(
|
||||
content::BrowserContext* browser_context) {
|
||||
base::Time PlatformNotificationService::ReadNextTriggerTimestamp() {
|
||||
return base::Time::Max();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/platform_notification_service.h"
|
||||
|
||||
namespace atom {
|
||||
@@ -25,34 +24,25 @@ class PlatformNotificationService
|
||||
// content::PlatformNotificationService:
|
||||
void DisplayNotification(
|
||||
content::RenderProcessHost* render_process_host,
|
||||
content::BrowserContext* browser_context,
|
||||
const std::string& notification_id,
|
||||
const GURL& origin,
|
||||
const blink::PlatformNotificationData& notification_data,
|
||||
const blink::NotificationResources& notification_resources) override;
|
||||
void DisplayPersistentNotification(
|
||||
content::BrowserContext* browser_context,
|
||||
const std::string& notification_id,
|
||||
const GURL& service_worker_scope,
|
||||
const GURL& origin,
|
||||
const blink::PlatformNotificationData& notification_data,
|
||||
const blink::NotificationResources& notification_resources) override;
|
||||
void ClosePersistentNotification(content::BrowserContext* browser_context,
|
||||
const std::string& notification_id) override;
|
||||
void CloseNotification(content::BrowserContext* browser_context,
|
||||
const std::string& notification_id) override;
|
||||
void ClosePersistentNotification(const std::string& notification_id) override;
|
||||
void CloseNotification(const std::string& notification_id) override;
|
||||
void GetDisplayedNotifications(
|
||||
content::BrowserContext* browser_context,
|
||||
DisplayedNotificationsCallback callback) override;
|
||||
int64_t ReadNextPersistentNotificationId(
|
||||
content::BrowserContext* browser_context) override;
|
||||
int64_t ReadNextPersistentNotificationId() override;
|
||||
void RecordNotificationUkmEvent(
|
||||
content::BrowserContext* browser_context,
|
||||
const content::NotificationDatabaseData& data) override;
|
||||
void ScheduleTrigger(content::BrowserContext* browser_context,
|
||||
base::Time timestamp) override;
|
||||
base::Time ReadNextTriggerTimestamp(
|
||||
content::BrowserContext* browser_context) override;
|
||||
void ScheduleTrigger(base::Time timestamp) override;
|
||||
base::Time ReadNextTriggerTimestamp() override;
|
||||
|
||||
private:
|
||||
AtomBrowserClient* browser_client_;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "atom/browser/notifications/win/windows_toast_notification.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/md5.h"
|
||||
#include "base/hash/md5.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/time/time.h"
|
||||
@@ -47,7 +47,7 @@ bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
|
||||
// static
|
||||
NotificationPresenter* NotificationPresenter::Create() {
|
||||
auto version = base::win::GetVersion();
|
||||
if (version < base::win::VERSION_WIN8)
|
||||
if (version < base::win::Version::WIN8)
|
||||
return new NotificationPresenterWin7;
|
||||
if (!WindowsToastNotification::Initialize())
|
||||
return nullptr;
|
||||
|
||||
@@ -112,13 +112,13 @@ class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
|
||||
|
||||
IFACEMETHODIMP Invoke(
|
||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||
IInspectable* args);
|
||||
IInspectable* args) override;
|
||||
IFACEMETHODIMP Invoke(
|
||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e);
|
||||
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) override;
|
||||
IFACEMETHODIMP Invoke(
|
||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e);
|
||||
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) override;
|
||||
|
||||
private:
|
||||
base::WeakPtr<Notification> notification_; // weak ref.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/shared_memory.h"
|
||||
#include "components/viz/common/resources/resource_format.h"
|
||||
#include "components/viz/common/resources/resource_sizes.h"
|
||||
#include "mojo/public/cpp/system/platform_handle.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/memory/shared_memory.h"
|
||||
#include "base/memory/shared_memory_mapping.h"
|
||||
#include "components/viz/host/host_display_client.h"
|
||||
#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "base/callback_helpers.h"
|
||||
#include "base/location.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/time/time.h"
|
||||
@@ -351,7 +352,7 @@ void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
|
||||
SetSize(new_bounds.size());
|
||||
}
|
||||
|
||||
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() const {
|
||||
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
|
||||
@@ -366,11 +367,11 @@ ui::TextInputClient* OffScreenRenderWidgetHostView::GetTextInputClient() {
|
||||
|
||||
void OffScreenRenderWidgetHostView::Focus() {}
|
||||
|
||||
bool OffScreenRenderWidgetHostView::HasFocus() const {
|
||||
bool OffScreenRenderWidgetHostView::HasFocus() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
|
||||
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() {
|
||||
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
|
||||
}
|
||||
|
||||
@@ -383,10 +384,10 @@ void OffScreenRenderWidgetHostView::Show() {
|
||||
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
||||
delegated_frame_host_->WasShown(
|
||||
GetLocalSurfaceIdAllocation().local_surface_id(),
|
||||
GetRootLayer()->bounds().size(), false);
|
||||
GetRootLayer()->bounds().size(), base::nullopt);
|
||||
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->WasShown(false);
|
||||
render_widget_host_->WasShown(base::nullopt);
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::Hide() {
|
||||
@@ -411,7 +412,7 @@ void OffScreenRenderWidgetHostView::EnsureSurfaceSynchronizedForWebTest() {
|
||||
SynchronizeVisualProperties();
|
||||
}
|
||||
|
||||
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() const {
|
||||
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() {
|
||||
if (IsPopupWidget())
|
||||
return popup_position_;
|
||||
|
||||
@@ -429,8 +430,7 @@ void OffScreenRenderWidgetHostView::SetBackgroundColor(SkColor color) {
|
||||
}
|
||||
}
|
||||
|
||||
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor()
|
||||
const {
|
||||
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor() {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ void OffScreenRenderWidgetHostView::UpdateBackgroundColor() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() const {
|
||||
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() {
|
||||
return size_;
|
||||
}
|
||||
|
||||
@@ -532,8 +532,7 @@ void OffScreenRenderWidgetHostView::TextInputStateChanged(
|
||||
|
||||
void OffScreenRenderWidgetHostView::ImeCancelComposition() {}
|
||||
|
||||
void OffScreenRenderWidgetHostView::RenderProcessGone(base::TerminationStatus,
|
||||
int) {
|
||||
void OffScreenRenderWidgetHostView::RenderProcessGone() {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
@@ -580,7 +579,7 @@ void OffScreenRenderWidgetHostView::CopyFromSurface(
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::GetScreenInfo(
|
||||
content::ScreenInfo* screen_info) const {
|
||||
content::ScreenInfo* screen_info) {
|
||||
screen_info->depth = 24;
|
||||
screen_info->depth_per_component = 8;
|
||||
screen_info->orientation_angle = 0;
|
||||
@@ -621,8 +620,7 @@ void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
|
||||
const gfx::Range&,
|
||||
const std::vector<gfx::Rect>&) {}
|
||||
|
||||
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize()
|
||||
const {
|
||||
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
|
||||
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
|
||||
current_device_scale_factor_);
|
||||
}
|
||||
|
||||
@@ -84,22 +84,22 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||
void InitAsChild(gfx::NativeView) override;
|
||||
void SetSize(const gfx::Size&) override;
|
||||
void SetBounds(const gfx::Rect&) override;
|
||||
gfx::NativeView GetNativeView(void) const override;
|
||||
gfx::NativeView GetNativeView(void) override;
|
||||
gfx::NativeViewAccessible GetNativeViewAccessible(void) override;
|
||||
ui::TextInputClient* GetTextInputClient() override;
|
||||
void Focus(void) override;
|
||||
bool HasFocus(void) const override;
|
||||
bool HasFocus(void) override;
|
||||
uint32_t GetCaptureSequenceNumber() const override;
|
||||
bool IsSurfaceAvailableForCopy(void) const override;
|
||||
bool IsSurfaceAvailableForCopy(void) override;
|
||||
void Show(void) override;
|
||||
void Hide(void) override;
|
||||
bool IsShowing(void) override;
|
||||
void EnsureSurfaceSynchronizedForWebTest() override;
|
||||
gfx::Rect GetViewBounds(void) const override;
|
||||
gfx::Size GetVisibleViewportSize() const override;
|
||||
gfx::Rect GetViewBounds(void) override;
|
||||
gfx::Size GetVisibleViewportSize() override;
|
||||
void SetInsets(const gfx::Insets&) override;
|
||||
void SetBackgroundColor(SkColor color) override;
|
||||
base::Optional<SkColor> GetBackgroundColor() const override;
|
||||
base::Optional<SkColor> GetBackgroundColor() override;
|
||||
void UpdateBackgroundColor() override;
|
||||
bool LockMouse(void) override;
|
||||
void UnlockMouse(void) override;
|
||||
@@ -131,7 +131,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||
void SetIsLoading(bool is_loading) override;
|
||||
void TextInputStateChanged(const content::TextInputState& params) override;
|
||||
void ImeCancelComposition(void) override;
|
||||
void RenderProcessGone(base::TerminationStatus, int) override;
|
||||
void RenderProcessGone() override;
|
||||
void Destroy(void) override;
|
||||
void SetTooltipText(const base::string16&) override;
|
||||
content::CursorManager* GetCursorManager() override;
|
||||
@@ -139,7 +139,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||
const gfx::Rect& src_rect,
|
||||
const gfx::Size& output_size,
|
||||
base::OnceCallback<void(const SkBitmap&)> callback) override;
|
||||
void GetScreenInfo(content::ScreenInfo* results) const override;
|
||||
void GetScreenInfo(content::ScreenInfo* results) override;
|
||||
void InitAsGuest(content::RenderWidgetHostView*,
|
||||
content::RenderWidgetHostViewGuest*) override;
|
||||
void TransformPointToRootSurface(gfx::PointF* point) override;
|
||||
@@ -149,7 +149,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||
CreateSyntheticGestureTarget() override;
|
||||
void ImeCompositionRangeChanged(const gfx::Range&,
|
||||
const std::vector<gfx::Rect>&) override;
|
||||
gfx::Size GetCompositorViewportPixelSize() const override;
|
||||
gfx::Size GetCompositorViewportPixelSize() override;
|
||||
|
||||
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
content::RenderWidgetHost*,
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>electron.icns</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>6.0.0-nightly.20190404</string>
|
||||
<string>6.0.0-beta.6</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>6.0.0-nightly.20190404</string>
|
||||
<string>6.0.0-beta.6</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -50,8 +50,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 6,0,0,20190404
|
||||
PRODUCTVERSION 6,0,0,20190404
|
||||
FILEVERSION 6,0,0,6
|
||||
PRODUCTVERSION 6,0,0,6
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface NSColor (Hex)
|
||||
- (NSString*)hexadecimalValue;
|
||||
- (NSString*)RGBAValue;
|
||||
+ (NSColor*)colorWithHexColorString:(NSString*)hex;
|
||||
@end
|
||||
|
||||
|
||||
@@ -8,17 +8,65 @@
|
||||
|
||||
@implementation NSColor (Hex)
|
||||
|
||||
- (NSString*)RGBAValue {
|
||||
double redFloatValue, greenFloatValue, blueFloatValue, alphaFloatValue;
|
||||
|
||||
NSColor* convertedColor =
|
||||
[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
|
||||
|
||||
if (convertedColor) {
|
||||
[convertedColor getRed:&redFloatValue
|
||||
green:&greenFloatValue
|
||||
blue:&blueFloatValue
|
||||
alpha:&alphaFloatValue];
|
||||
|
||||
int redIntValue = redFloatValue * 255.99999f;
|
||||
int greenIntValue = greenFloatValue * 255.99999f;
|
||||
int blueIntValue = blueFloatValue * 255.99999f;
|
||||
int alphaIntValue = alphaFloatValue * 255.99999f;
|
||||
|
||||
return
|
||||
[NSString stringWithFormat:@"%02x%02x%02x%02x", redIntValue,
|
||||
greenIntValue, blueIntValue, alphaIntValue];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString*)hexadecimalValue {
|
||||
double redFloatValue, greenFloatValue, blueFloatValue;
|
||||
|
||||
NSColor* convertedColor =
|
||||
[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
|
||||
|
||||
if (convertedColor) {
|
||||
[convertedColor getRed:&redFloatValue
|
||||
green:&greenFloatValue
|
||||
blue:&blueFloatValue
|
||||
alpha:NULL];
|
||||
|
||||
int redIntValue = redFloatValue * 255.99999f;
|
||||
int greenIntValue = greenFloatValue * 255.99999f;
|
||||
int blueIntValue = blueFloatValue * 255.99999f;
|
||||
|
||||
return [NSString stringWithFormat:@"#%02x%02x%02x", redIntValue,
|
||||
greenIntValue, blueIntValue];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSColor*)colorWithHexColorString:(NSString*)inColorString {
|
||||
unsigned colorCode = 0;
|
||||
unsigned char redByte, greenByte, blueByte;
|
||||
|
||||
if (inColorString) {
|
||||
NSScanner* scanner = [NSScanner scannerWithString:inColorString];
|
||||
(void)[scanner scanHexInt:&colorCode]; // ignore error
|
||||
}
|
||||
redByte = (unsigned char)(colorCode >> 16);
|
||||
greenByte = (unsigned char)(colorCode >> 8);
|
||||
blueByte = (unsigned char)(colorCode); // masks off high bits
|
||||
|
||||
unsigned char redByte = (unsigned char)(colorCode >> 16);
|
||||
unsigned char greenByte = (unsigned char)(colorCode >> 8);
|
||||
unsigned char blueByte = (unsigned char)(colorCode); // masks off high bits
|
||||
|
||||
return [NSColor colorWithCalibratedRed:(CGFloat)redByte / 0xff
|
||||
green:(CGFloat)greenByte / 0xff
|
||||
|
||||
@@ -21,7 +21,7 @@ class AtomNativeWidgetMac : public views::NativeWidgetMac {
|
||||
protected:
|
||||
// NativeWidgetMac:
|
||||
NativeWidgetMacNSWindow* CreateNSWindow(
|
||||
const views_bridge_mac::mojom::CreateWindowParams* params) override;
|
||||
const remote_cocoa::mojom::CreateWindowParams* params) override;
|
||||
|
||||
private:
|
||||
NativeWindowMac* shell_;
|
||||
|
||||
@@ -19,9 +19,9 @@ AtomNativeWidgetMac::AtomNativeWidgetMac(
|
||||
AtomNativeWidgetMac::~AtomNativeWidgetMac() {}
|
||||
|
||||
NativeWidgetMacNSWindow* AtomNativeWidgetMac::CreateNSWindow(
|
||||
const views_bridge_mac::mojom::CreateWindowParams* params) {
|
||||
return [[[AtomNSWindow alloc] initWithShell:shell_ styleMask:style_mask_]
|
||||
autorelease];
|
||||
const remote_cocoa::mojom::CreateWindowParams* params) {
|
||||
return [[[AtomNSWindow alloc] initWithShell:shell_
|
||||
styleMask:style_mask_] autorelease];
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#define ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_
|
||||
|
||||
#include "atom/browser/ui/cocoa/event_dispatching_window.h"
|
||||
#include "components/remote_cocoa/app_shim/native_widget_mac_nswindow.h"
|
||||
#include "ui/views/widget/native_widget_mac.h"
|
||||
#include "ui/views_bridge_mac/native_widget_mac_nswindow.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <Quartz/Quartz.h>
|
||||
|
||||
#include "ui/views_bridge_mac/views_nswindow_delegate.h" // nogncheck
|
||||
#include "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
|
||||
|
||||
namespace atom {
|
||||
class NativeWindowMac;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
||||
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
|
||||
#include "base/mac/mac_util.h"
|
||||
#include "components/remote_cocoa/app_shim/bridged_native_widget_impl.h"
|
||||
#include "ui/views/cocoa/bridged_native_widget_host_impl.h"
|
||||
#include "ui/views/widget/native_widget_mac.h"
|
||||
#include "ui/views_bridge_mac/bridged_native_widget_impl.h"
|
||||
|
||||
@implementation AtomNSWindowDelegate
|
||||
|
||||
|
||||
@@ -23,9 +23,7 @@ const char kChromeUIDevToolsHost[] = "devtools";
|
||||
const char kChromeUIDevToolsBundledPath[] = "bundled";
|
||||
|
||||
std::string PathWithoutParams(const std::string& path) {
|
||||
return GURL(std::string("chrome-devtools://devtools/") + path)
|
||||
.path()
|
||||
.substr(1);
|
||||
return GURL(std::string("devtools://devtools/") + path).path().substr(1);
|
||||
}
|
||||
|
||||
std::string GetMimeTypeForPath(const std::string& path) {
|
||||
|
||||
@@ -97,7 +97,7 @@ void RunOpenDialogInNewThread(const RunState& run_state,
|
||||
bool result = ShowOpenDialogSync(settings, &paths);
|
||||
run_state.ui_task_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&OnDialogOpened, std::move(promise), result, paths));
|
||||
base::BindOnce(&OnDialogOpened, std::move(promise), !result, paths));
|
||||
run_state.ui_task_runner->DeleteSoon(FROM_HERE, run_state.dialog_thread);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void RunSaveDialogInNewThread(const RunState& run_state,
|
||||
bool result = ShowSaveDialogSync(settings, &path);
|
||||
run_state.ui_task_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&OnSaveDialogDone, std::move(promise), result, path));
|
||||
base::BindOnce(&OnSaveDialogDone, std::move(promise), !result, path));
|
||||
run_state.ui_task_runner->DeleteSoon(FROM_HERE, run_state.dialog_thread);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ void ShowSaveDialog(const DialogSettings& settings,
|
||||
RunState run_state;
|
||||
if (!CreateDialogThread(&run_state)) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(promise.isolate());
|
||||
dict.Set("canceled", false);
|
||||
dict.Set("canceled", true);
|
||||
dict.Set("filePath", base::FilePath());
|
||||
promise.Resolve(dict.GetHandle());
|
||||
} else {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "third_party/blink/public/common/logging/logging_utils.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
|
||||
@@ -53,14 +54,14 @@ const double kPresetZoomFactors[] = {0.25, 0.333, 0.5, 0.666, 0.75, 0.9,
|
||||
2.5, 3.0, 4.0, 5.0};
|
||||
|
||||
const char kChromeUIDevToolsURL[] =
|
||||
"chrome-devtools://devtools/bundled/devtools_app.html?"
|
||||
"devtools://devtools/bundled/devtools_app.html?"
|
||||
"remoteBase=%s&"
|
||||
"can_dock=%s&"
|
||||
"toolbarColor=rgba(223,223,223,1)&"
|
||||
"textColor=rgba(0,0,0,1)&"
|
||||
"experiments=true";
|
||||
const char kChromeUIDevToolsRemoteFrontendBase[] =
|
||||
"https://chrome-devtools-frontend.appspot.com/";
|
||||
"https://devtools-frontend.appspot.com/";
|
||||
const char kChromeUIDevToolsRemoteFrontendPath[] = "serve_file";
|
||||
|
||||
const char kDevToolsBoundsPref[] = "electron.devtools.bounds";
|
||||
@@ -779,11 +780,13 @@ void InspectableWebContentsImpl::WebContentsDestroyed() {
|
||||
|
||||
bool InspectableWebContentsImpl::DidAddMessageToConsole(
|
||||
content::WebContents* source,
|
||||
int32_t level,
|
||||
blink::mojom::ConsoleMessageLevel level,
|
||||
const base::string16& message,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) {
|
||||
logging::LogMessage("CONSOLE", line_no, level).stream()
|
||||
logging::LogMessage("CONSOLE", line_no,
|
||||
blink::ConsoleMessageLevelToLogSeverity(level))
|
||||
.stream()
|
||||
<< "\"" << message << "\", source: " << source_id << " (" << line_no
|
||||
<< ")";
|
||||
return true;
|
||||
|
||||
@@ -143,6 +143,9 @@ class InspectableWebContentsImpl
|
||||
int boundary_value) override {}
|
||||
void ReadyForTest() override {}
|
||||
void SetOpenNewWindowForPopups(bool value) override {}
|
||||
void RecordPerformanceHistogram(const std::string& name,
|
||||
double duration) override {}
|
||||
void RecordUserMetricsAction(const std::string& name) override {}
|
||||
|
||||
// content::DevToolsFrontendHostDelegate:
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||
@@ -165,7 +168,7 @@ class InspectableWebContentsImpl
|
||||
|
||||
// content::WebContentsDelegate:
|
||||
bool DidAddMessageToConsole(content::WebContents* source,
|
||||
int32_t level,
|
||||
blink::mojom::ConsoleMessageLevel level,
|
||||
const base::string16& message,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) override;
|
||||
|
||||
@@ -150,10 +150,10 @@ void AutofillPopupView::OnSelectedRowChanged(
|
||||
|
||||
if (current_row_selection) {
|
||||
int selected = current_row_selection.value_or(-1);
|
||||
if (selected == -1 || selected >= child_count())
|
||||
if (selected == -1 || static_cast<size_t>(selected) >= children().size())
|
||||
return;
|
||||
child_at(selected)->NotifyAccessibilityEvent(ax::mojom::Event::kSelection,
|
||||
true);
|
||||
children().at(selected)->NotifyAccessibilityEvent(
|
||||
ax::mojom::Event::kSelection, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,8 @@ void AutofillPopupView::DoUpdateBoundsAndRedrawPopup() {
|
||||
}
|
||||
|
||||
void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
|
||||
if (!popup_ || popup_->GetLineCount() != child_count())
|
||||
if (!popup_ ||
|
||||
static_cast<size_t>(popup_->GetLineCount()) != children().size())
|
||||
return;
|
||||
gfx::Canvas* draw_canvas = canvas;
|
||||
SkBitmap bitmap;
|
||||
|
||||
@@ -212,7 +212,7 @@ void InspectableWebContentsViewViews::SetTitle(const base::string16& title) {
|
||||
}
|
||||
|
||||
void InspectableWebContentsViewViews::Layout() {
|
||||
if (!devtools_web_view_->visible()) {
|
||||
if (!devtools_web_view_->GetVisible()) {
|
||||
contents_web_view_->SetBoundsRect(GetContentsBounds());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ const char* MenuBar::GetClassName() const {
|
||||
return kViewClassName;
|
||||
}
|
||||
|
||||
void MenuBar::OnMenuButtonClicked(views::MenuButton* source,
|
||||
void MenuBar::OnMenuButtonClicked(views::Button* source,
|
||||
const gfx::Point& point,
|
||||
const ui::Event* event) {
|
||||
// Hide the accelerator when a submenu is activated.
|
||||
@@ -286,9 +286,8 @@ void MenuBar::OnMenuButtonClicked(views::MenuButton* source,
|
||||
menu_delegate->AddObserver(this);
|
||||
}
|
||||
|
||||
void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
|
||||
if (!theme)
|
||||
theme = ui::NativeTheme::GetInstanceForNativeUi();
|
||||
void MenuBar::RefreshColorCache() {
|
||||
const ui::NativeTheme* theme = GetNativeTheme();
|
||||
if (theme) {
|
||||
#if defined(USE_X11)
|
||||
background_color_ = libgtkui::GetBgColor("GtkMenuBar#menubar");
|
||||
@@ -306,8 +305,8 @@ void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void MenuBar::OnNativeThemeChanged(const ui::NativeTheme* theme) {
|
||||
RefreshColorCache(theme);
|
||||
void MenuBar::OnThemeChanged() {
|
||||
RefreshColorCache();
|
||||
UpdateViewColors();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
#include "ui/views/view.h"
|
||||
|
||||
namespace views {
|
||||
class Button;
|
||||
class MenuButton;
|
||||
}
|
||||
} // namespace views
|
||||
|
||||
namespace atom {
|
||||
|
||||
@@ -78,10 +79,10 @@ class MenuBar : public views::AccessiblePaneView,
|
||||
const char* GetClassName() const override;
|
||||
|
||||
// views::MenuButtonListener:
|
||||
void OnMenuButtonClicked(views::MenuButton* source,
|
||||
void OnMenuButtonClicked(views::Button* source,
|
||||
const gfx::Point& point,
|
||||
const ui::Event* event) override;
|
||||
void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
|
||||
void OnThemeChanged() override;
|
||||
|
||||
private:
|
||||
friend class MenuBarColorUpdater;
|
||||
@@ -89,7 +90,7 @@ class MenuBar : public views::AccessiblePaneView,
|
||||
void RebuildChildren();
|
||||
void UpdateViewColors();
|
||||
|
||||
void RefreshColorCache(const ui::NativeTheme* theme = nullptr);
|
||||
void RefreshColorCache();
|
||||
SkColor background_color_;
|
||||
#if defined(USE_X11)
|
||||
SkColor enabled_color_;
|
||||
|
||||
@@ -22,7 +22,7 @@ MenuDelegate::MenuDelegate(MenuBar* menu_bar)
|
||||
MenuDelegate::~MenuDelegate() {}
|
||||
|
||||
void MenuDelegate::RunMenu(AtomMenuModel* model,
|
||||
views::MenuButton* button,
|
||||
views::Button* button,
|
||||
ui::MenuSourceType source_type) {
|
||||
gfx::Point screen_loc;
|
||||
views::View::ConvertPointToScreen(button, &screen_loc);
|
||||
@@ -43,8 +43,10 @@ void MenuDelegate::RunMenu(AtomMenuModel* model,
|
||||
menu_runner_.reset(new views::MenuRunner(
|
||||
item,
|
||||
views::MenuRunner::CONTEXT_MENU | views::MenuRunner::HAS_MNEMONICS));
|
||||
menu_runner_->RunMenuAt(button->GetWidget()->GetTopLevelWidget(), button,
|
||||
bounds, views::MENU_ANCHOR_TOPRIGHT, source_type);
|
||||
menu_runner_->RunMenuAt(
|
||||
button->GetWidget()->GetTopLevelWidget(),
|
||||
static_cast<views::MenuButton*>(button)->button_controller(), bounds,
|
||||
views::MenuAnchorPosition::kTopRight, source_type);
|
||||
}
|
||||
|
||||
void MenuDelegate::ExecuteCommand(int id) {
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
namespace views {
|
||||
class MenuRunner;
|
||||
}
|
||||
class Button;
|
||||
} // namespace views
|
||||
|
||||
namespace atom {
|
||||
|
||||
@@ -25,7 +26,7 @@ class MenuDelegate : public views::MenuDelegate {
|
||||
~MenuDelegate() override;
|
||||
|
||||
void RunMenu(AtomMenuModel* model,
|
||||
views::MenuButton* button,
|
||||
views::Button* button,
|
||||
ui::MenuSourceType source_type);
|
||||
|
||||
class Observer {
|
||||
|
||||
@@ -92,10 +92,10 @@ void RootView::SetMenuBarVisibility(bool visible) {
|
||||
|
||||
menu_bar_visible_ = visible;
|
||||
if (visible) {
|
||||
DCHECK_EQ(child_count(), 1);
|
||||
DCHECK_EQ(children().size(), 1ul);
|
||||
AddChildView(menu_bar_.get());
|
||||
} else {
|
||||
DCHECK_EQ(child_count(), 2);
|
||||
DCHECK_EQ(children().size(), 2ul);
|
||||
RemoveChildView(menu_bar_.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,32 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/win/atom_desktop_native_widget_aura.h"
|
||||
|
||||
#include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h"
|
||||
#include "ui/views/corewm/tooltip_controller.h"
|
||||
#include "ui/wm/public/tooltip_client.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
AtomDesktopNativeWidgetAura::AtomDesktopNativeWidgetAura(
|
||||
views::internal::NativeWidgetDelegate* delegate)
|
||||
: views::DesktopNativeWidgetAura(delegate) {
|
||||
NativeWindowViews* native_window_view)
|
||||
: views::DesktopNativeWidgetAura(native_window_view->widget()),
|
||||
native_window_view_(native_window_view) {
|
||||
GetNativeWindow()->SetName("AtomDesktopNativeWidgetAura");
|
||||
// This is to enable the override of OnWindowActivated
|
||||
wm::SetActivationChangeObserver(GetNativeWindow(), this);
|
||||
}
|
||||
|
||||
void AtomDesktopNativeWidgetAura::InitNativeWidget(
|
||||
const views::Widget::InitParams& params) {
|
||||
views::Widget::InitParams modified_params = params;
|
||||
desktop_window_tree_host_ = new AtomDesktopWindowTreeHostWin(
|
||||
native_window_view_,
|
||||
static_cast<views::DesktopNativeWidgetAura*>(params.native_widget));
|
||||
modified_params.desktop_window_tree_host = desktop_window_tree_host_;
|
||||
views::DesktopNativeWidgetAura::InitNativeWidget(modified_params);
|
||||
}
|
||||
|
||||
void AtomDesktopNativeWidgetAura::Activate() {
|
||||
// Activate can cause the focused window to be blurred so only
|
||||
// call when the window being activated is visible. This prevents
|
||||
|
||||
@@ -8,12 +8,18 @@
|
||||
#include "atom/browser/native_window_views.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
||||
|
||||
namespace views {
|
||||
class DesktopWindowTreeHost;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
||||
class AtomDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
|
||||
public:
|
||||
explicit AtomDesktopNativeWidgetAura(
|
||||
views::internal::NativeWidgetDelegate* delegate);
|
||||
explicit AtomDesktopNativeWidgetAura(NativeWindowViews* native_window_view);
|
||||
|
||||
// views::DesktopNativeWidgetAura:
|
||||
void InitNativeWidget(const views::Widget::InitParams& params) override;
|
||||
|
||||
// internal::NativeWidgetPrivate:
|
||||
void Activate() override;
|
||||
@@ -22,6 +28,12 @@ class AtomDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
|
||||
void OnWindowActivated(wm::ActivationChangeObserver::ActivationReason reason,
|
||||
aura::Window* gained_active,
|
||||
aura::Window* lost_active) override;
|
||||
|
||||
NativeWindowViews* native_window_view_;
|
||||
|
||||
// Owned by DesktopNativeWidgetAura.
|
||||
views::DesktopWindowTreeHost* desktop_window_tree_host_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomDesktopNativeWidgetAura);
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user