Merge pull request #14972 from electron/chromium-upgrade/69
feat: upgrade to Chromium 69.0.3497.106
This commit is contained in:
commit
cc0c6ad14a
190 changed files with 3650 additions and 7716 deletions
|
@ -28,6 +28,9 @@ env-release-build: &env-release-build
|
||||||
env-headless-testing: &env-headless-testing
|
env-headless-testing: &env-headless-testing
|
||||||
DISPLAY: ':99.0'
|
DISPLAY: ':99.0'
|
||||||
|
|
||||||
|
env-stack-dumping: &env-stack-dumping
|
||||||
|
ELECTRON_ENABLE_STACK_DUMPING: '1'
|
||||||
|
|
||||||
env-browsertests: &env-browsertests
|
env-browsertests: &env-browsertests
|
||||||
GN_EXTRA_ARGS: 'is_component_ffmpeg = false'
|
GN_EXTRA_ARGS: 'is_component_ffmpeg = false'
|
||||||
BUILD_TARGET: electron:chromium_browsertests
|
BUILD_TARGET: electron:chromium_browsertests
|
||||||
|
@ -606,7 +609,7 @@ steps-tests: &steps-tests
|
||||||
command: |
|
command: |
|
||||||
cd src
|
cd src
|
||||||
export ELECTRON_OUT_DIR=Default
|
export ELECTRON_OUT_DIR=Default
|
||||||
(cd electron && npm run test -- --ci --enable-logging)
|
(cd electron && npm run test -- --ci)
|
||||||
- run:
|
- run:
|
||||||
name: Check test results existence
|
name: Check test results existence
|
||||||
command: |
|
command: |
|
||||||
|
@ -944,6 +947,7 @@ jobs:
|
||||||
<<: *machine-linux-medium
|
<<: *machine-linux-medium
|
||||||
environment:
|
environment:
|
||||||
<<: *env-headless-testing
|
<<: *env-headless-testing
|
||||||
|
<<: *env-stack-dumping
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
linux-x64-release-tests:
|
linux-x64-release-tests:
|
||||||
|
@ -965,6 +969,7 @@ jobs:
|
||||||
environment:
|
environment:
|
||||||
<<: *env-ia32
|
<<: *env-ia32
|
||||||
<<: *env-headless-testing
|
<<: *env-headless-testing
|
||||||
|
<<: *env-stack-dumping
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
linux-ia32-release-tests:
|
linux-ia32-release-tests:
|
||||||
|
@ -985,10 +990,14 @@ jobs:
|
||||||
|
|
||||||
osx-testing-tests:
|
osx-testing-tests:
|
||||||
<<: *machine-mac
|
<<: *machine-mac
|
||||||
|
environment:
|
||||||
|
<<: *env-stack-dumping
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
mas-testing-tests:
|
mas-testing-tests:
|
||||||
<<: *machine-mac
|
<<: *machine-mac
|
||||||
|
environment:
|
||||||
|
<<: *env-stack-dumping
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
# Layer 4: Summary.
|
# Layer 4: Summary.
|
||||||
|
@ -1077,14 +1086,14 @@ workflows:
|
||||||
- mas-testing
|
- mas-testing
|
||||||
|
|
||||||
nightly-release-test:
|
nightly-release-test:
|
||||||
triggers:
|
# triggers:
|
||||||
- schedule:
|
# - schedule:
|
||||||
cron: "0 0 * * *"
|
# cron: "0 0 * * *"
|
||||||
filters:
|
# filters:
|
||||||
branches:
|
# branches:
|
||||||
only:
|
# only:
|
||||||
- master
|
# - master
|
||||||
- *chromium-upgrade-branches
|
# - *chromium-upgrade-branches
|
||||||
jobs:
|
jobs:
|
||||||
- linux-checkout
|
- linux-checkout
|
||||||
|
|
||||||
|
|
4
BUILD.gn
4
BUILD.gn
|
@ -216,8 +216,8 @@ static_library("electron_lib") {
|
||||||
"//content/public/app:both",
|
"//content/public/app:both",
|
||||||
"//content/public/child",
|
"//content/public/child",
|
||||||
"//content/public/common:service_names",
|
"//content/public/common:service_names",
|
||||||
"//device/geolocation",
|
|
||||||
"//gin",
|
"//gin",
|
||||||
|
"//media/mojo/interfaces",
|
||||||
"//net:net_resources",
|
"//net:net_resources",
|
||||||
"//ppapi/host",
|
"//ppapi/host",
|
||||||
"//ppapi/proxy",
|
"//ppapi/proxy",
|
||||||
|
@ -693,7 +693,6 @@ if (is_mac) {
|
||||||
":electron_lib",
|
":electron_lib",
|
||||||
":js2asar",
|
":js2asar",
|
||||||
":packed_resources",
|
":packed_resources",
|
||||||
"//build/config:exe_and_shlib_deps",
|
|
||||||
"//content:sandbox_helper_win",
|
"//content:sandbox_helper_win",
|
||||||
"//ui/strings",
|
"//ui/strings",
|
||||||
]
|
]
|
||||||
|
@ -798,7 +797,6 @@ group("chromium_unittests") {
|
||||||
"//third_party/blink/public:all_blink",
|
"//third_party/blink/public:all_blink",
|
||||||
"//third_party/blink/public:test_support",
|
"//third_party/blink/public:test_support",
|
||||||
"//third_party/leveldatabase:env_chromium_unittests",
|
"//third_party/leveldatabase:env_chromium_unittests",
|
||||||
"//tools/gn:gn_unittests",
|
|
||||||
"//ui/base:ui_base_unittests",
|
"//ui/base:ui_base_unittests",
|
||||||
"//ui/compositor:compositor_unittests",
|
"//ui/compositor:compositor_unittests",
|
||||||
"//ui/display:display_unittests",
|
"//ui/display:display_unittests",
|
||||||
|
|
40
DEPS
40
DEPS
|
@ -1,6 +1,18 @@
|
||||||
|
gclient_gn_args_file = 'src/build/config/gclient_args.gni'
|
||||||
|
gclient_gn_args = [
|
||||||
|
'build_with_chromium',
|
||||||
|
'checkout_android',
|
||||||
|
'checkout_android_native_support',
|
||||||
|
'checkout_libaom',
|
||||||
|
'checkout_nacl',
|
||||||
|
'checkout_oculus_sdk'
|
||||||
|
]
|
||||||
|
|
||||||
vars = {
|
vars = {
|
||||||
'chromium_version': '68.0.3440.128',
|
'chromium_version':
|
||||||
'node_version': '18a9880b70039f5d41ee860a95fe84e5ef928973',
|
'69.0.3497.106',
|
||||||
|
'node_version':
|
||||||
|
'5331c9dc72e0db379a675efdb98f6a67bf7f23f0',
|
||||||
|
|
||||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||||
'pyyaml_version': '3.12',
|
'pyyaml_version': '3.12',
|
||||||
|
@ -15,16 +27,25 @@ vars = {
|
||||||
# Python interface to Amazon Web Services. Is used for releases only.
|
# Python interface to Amazon Web Services. Is used for releases only.
|
||||||
'checkout_boto': False,
|
'checkout_boto': False,
|
||||||
|
|
||||||
'checkout_nacl': False,
|
|
||||||
'checkout_libaom': True,
|
|
||||||
'checkout_oculus_sdk': False,
|
|
||||||
|
|
||||||
# Python "requests" module is used for releases only.
|
# Python "requests" module is used for releases only.
|
||||||
'checkout_requests': False,
|
'checkout_requests': False,
|
||||||
|
|
||||||
# It is always needed for normal Electron builds,
|
# It is always needed for normal Electron builds,
|
||||||
# but might be impossible for custom in-house builds.
|
# but might be impossible for custom in-house builds.
|
||||||
'download_external_binaries': True,
|
'download_external_binaries': True,
|
||||||
|
|
||||||
|
'checkout_nacl':
|
||||||
|
False,
|
||||||
|
'checkout_libaom':
|
||||||
|
True,
|
||||||
|
'checkout_oculus_sdk':
|
||||||
|
False,
|
||||||
|
'build_with_chromium':
|
||||||
|
True,
|
||||||
|
'checkout_android':
|
||||||
|
False,
|
||||||
|
'checkout_android_native_support':
|
||||||
|
False,
|
||||||
}
|
}
|
||||||
|
|
||||||
deps = {
|
deps = {
|
||||||
|
@ -100,10 +121,3 @@ hooks = [
|
||||||
recursedeps = [
|
recursedeps = [
|
||||||
'src',
|
'src',
|
||||||
]
|
]
|
||||||
|
|
||||||
gclient_gn_args = [
|
|
||||||
'checkout_libaom',
|
|
||||||
'checkout_nacl',
|
|
||||||
'checkout_oculus_sdk',
|
|
||||||
]
|
|
||||||
gclient_gn_args_file = 'src/build/config/gclient_args.gni'
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace {
|
||||||
bool IsWidevineAvailable(
|
bool IsWidevineAvailable(
|
||||||
base::FilePath* cdm_path,
|
base::FilePath* cdm_path,
|
||||||
std::vector<media::VideoCodec>* codecs_supported,
|
std::vector<media::VideoCodec>* codecs_supported,
|
||||||
bool* supports_persistent_license,
|
base::flat_set<media::CdmSessionType>* session_types_supported,
|
||||||
base::flat_set<media::EncryptionMode>* modes_supported) {
|
base::flat_set<media::EncryptionMode>* modes_supported) {
|
||||||
static enum {
|
static enum {
|
||||||
NOT_CHECKED,
|
NOT_CHECKED,
|
||||||
|
@ -71,12 +71,11 @@ bool IsWidevineAvailable(
|
||||||
codecs_supported->push_back(media::VideoCodec::kCodecH264);
|
codecs_supported->push_back(media::VideoCodec::kCodecH264);
|
||||||
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||||
|
|
||||||
// TODO(crbug.com/767941): Push persistent-license support info here once
|
// TODO(crbug.com/767941): Push persistent-license support info here once
|
||||||
// we check in a new CDM that supports it on Linux.
|
// we check in a new CDM that supports it on Linux.
|
||||||
|
session_types_supported->insert(media::CdmSessionType::kTemporary);
|
||||||
#if defined(OS_CHROMEOS)
|
#if defined(OS_CHROMEOS)
|
||||||
*supports_persistent_license = true;
|
session_types_supported->insert(media::CdmSessionType::kPersistentLicense);
|
||||||
#else
|
|
||||||
*supports_persistent_license = false;
|
|
||||||
#endif // defined(OS_CHROMEOS)
|
#endif // defined(OS_CHROMEOS)
|
||||||
|
|
||||||
modes_supported->insert(media::EncryptionMode::kCenc);
|
modes_supported->insert(media::EncryptionMode::kCenc);
|
||||||
|
@ -211,8 +210,8 @@ void AtomContentClient::AddAdditionalSchemes(Schemes* schemes) {
|
||||||
|
|
||||||
void AtomContentClient::AddPepperPlugins(
|
void AtomContentClient::AddPepperPlugins(
|
||||||
std::vector<content::PepperPluginInfo>* plugins) {
|
std::vector<content::PepperPluginInfo>* plugins) {
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
||||||
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
|
#if BUILDFLAG(ENABLE_PEPPER_FLASH)
|
||||||
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
AddPepperFlashFromCommandLine(command_line, plugins);
|
AddPepperFlashFromCommandLine(command_line, plugins);
|
||||||
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
|
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
|
||||||
ComputeBuiltInPlugins(plugins);
|
ComputeBuiltInPlugins(plugins);
|
||||||
|
@ -225,10 +224,10 @@ void AtomContentClient::AddContentDecryptionModules(
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
base::FilePath cdm_path;
|
base::FilePath cdm_path;
|
||||||
std::vector<media::VideoCodec> video_codecs_supported;
|
std::vector<media::VideoCodec> video_codecs_supported;
|
||||||
bool supports_persistent_license = false;
|
base::flat_set<media::CdmSessionType> session_types_supported;
|
||||||
base::flat_set<media::EncryptionMode> encryption_modes_supported;
|
base::flat_set<media::EncryptionMode> encryption_modes_supported;
|
||||||
if (IsWidevineAvailable(&cdm_path, &video_codecs_supported,
|
if (IsWidevineAvailable(&cdm_path, &video_codecs_supported,
|
||||||
&supports_persistent_license,
|
&session_types_supported,
|
||||||
&encryption_modes_supported)) {
|
&encryption_modes_supported)) {
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
auto cdm_version_string =
|
auto cdm_version_string =
|
||||||
|
@ -239,11 +238,13 @@ void AtomContentClient::AddContentDecryptionModules(
|
||||||
const base::Version version(cdm_version_string);
|
const base::Version version(cdm_version_string);
|
||||||
DCHECK(version.IsValid());
|
DCHECK(version.IsValid());
|
||||||
|
|
||||||
|
content::CdmCapability capability(
|
||||||
|
video_codecs_supported, encryption_modes_supported,
|
||||||
|
session_types_supported, base::flat_set<media::CdmProxy::Protocol>());
|
||||||
|
|
||||||
cdms->push_back(content::CdmInfo(
|
cdms->push_back(content::CdmInfo(
|
||||||
kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path,
|
kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path,
|
||||||
kWidevineCdmFileSystemId, video_codecs_supported,
|
kWidevineCdmFileSystemId, capability, kWidevineKeySystem, false));
|
||||||
supports_persistent_license, encryption_modes_supported,
|
|
||||||
kWidevineKeySystem, false));
|
|
||||||
}
|
}
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include "atom/common/common_message_generator.h"
|
#include "atom/common/common_message_generator.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
#include "atom/app/atom_main_delegate_mac.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -158,6 +162,12 @@ void AtomMainDelegate::PreSandboxStartup() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomMainDelegate::PreContentInitialization() {
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
RegisterAtomCrApp();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
|
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
|
||||||
browser_client_.reset(new AtomBrowserClient);
|
browser_client_.reset(new AtomBrowserClient);
|
||||||
return browser_client_.get();
|
return browser_client_.get();
|
||||||
|
|
|
@ -22,6 +22,7 @@ class AtomMainDelegate : public brightray::MainDelegate {
|
||||||
// content::ContentMainDelegate:
|
// content::ContentMainDelegate:
|
||||||
bool BasicStartupComplete(int* exit_code) override;
|
bool BasicStartupComplete(int* exit_code) override;
|
||||||
void PreSandboxStartup() override;
|
void PreSandboxStartup() override;
|
||||||
|
void PreContentInitialization() override;
|
||||||
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
||||||
content::ContentRendererClient* CreateContentRendererClient() override;
|
content::ContentRendererClient* CreateContentRendererClient() override;
|
||||||
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
||||||
|
|
15
atom/app/atom_main_delegate_mac.h
Normal file
15
atom/app/atom_main_delegate_mac.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2013 Slack Technologies, Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef ATOM_APP_ATOM_MAIN_DELEGATE_MAC_H_
|
||||||
|
#define ATOM_APP_ATOM_MAIN_DELEGATE_MAC_H_
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
// Initializes NSApplication.
|
||||||
|
void RegisterAtomCrApp();
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
||||||
|
#endif // ATOM_APP_ATOM_MAIN_DELEGATE_MAC_H_
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "atom/app/atom_main_delegate.h"
|
#include "atom/app/atom_main_delegate.h"
|
||||||
|
|
||||||
|
#include "atom/browser/mac/atom_application.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/mac/bundle_locations.h"
|
#include "base/mac/bundle_locations.h"
|
||||||
|
@ -63,4 +64,9 @@ void AtomMainDelegate::SetUpBundleOverrides() {
|
||||||
base::mac::SetBaseBundleID(base_bundle_id.c_str());
|
base::mac::SetBaseBundleID(base_bundle_id.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegisterAtomCrApp() {
|
||||||
|
// Force the NSApplication subclass to be used.
|
||||||
|
[AtomApplication sharedApplication];
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -51,7 +51,7 @@ int NodeMain(int argc, char* argv[]) {
|
||||||
base::TaskScheduler::CreateAndStartWithDefaultParams("Electron");
|
base::TaskScheduler::CreateAndStartWithDefaultParams("Electron");
|
||||||
|
|
||||||
// Initialize gin::IsolateHolder.
|
// Initialize gin::IsolateHolder.
|
||||||
JavascriptEnvironment gin_env;
|
JavascriptEnvironment gin_env(loop);
|
||||||
|
|
||||||
// Explicitly register electron's builtin modules.
|
// Explicitly register electron's builtin modules.
|
||||||
NodeBindings::RegisterBuiltinModules();
|
NodeBindings::RegisterBuiltinModules();
|
||||||
|
@ -100,6 +100,7 @@ int NodeMain(int argc, char* argv[]) {
|
||||||
node::RunAtExit(env);
|
node::RunAtExit(env);
|
||||||
gin_env.platform()->DrainTasks(env->isolate());
|
gin_env.platform()->DrainTasks(env->isolate());
|
||||||
gin_env.platform()->CancelPendingDelayedTasks(env->isolate());
|
gin_env.platform()->CancelPendingDelayedTasks(env->isolate());
|
||||||
|
gin_env.platform()->UnregisterIsolate(env->isolate());
|
||||||
|
|
||||||
node::FreeEnvironment(env);
|
node::FreeEnvironment(env);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ v8::Local<v8::Promise> App::GetGPUInfo(v8::Isolate* isolate,
|
||||||
|
|
||||||
auto* const info_mgr = GPUInfoManager::GetInstance();
|
auto* const info_mgr = GPUInfoManager::GetInstance();
|
||||||
if (info_type == "complete") {
|
if (info_type == "complete") {
|
||||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
info_mgr->FetchCompleteInfo(promise);
|
info_mgr->FetchCompleteInfo(promise);
|
||||||
#else
|
#else
|
||||||
info_mgr->FetchBasicInfo(promise);
|
info_mgr->FetchBasicInfo(promise);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "atom/common/native_mate_converters/callback.h"
|
#include "atom/common/native_mate_converters/callback.h"
|
||||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
|
#include "base/logging.h"
|
||||||
#include "components/net_log/chrome_net_log.h"
|
#include "components/net_log/chrome_net_log.h"
|
||||||
#include "content/public/browser/storage_partition.h"
|
#include "content/public/browser/storage_partition.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
|
@ -103,11 +104,13 @@ void NetLog::StopLogging(mate::Arguments* args) {
|
||||||
|
|
||||||
void NetLog::OnNewState(const base::DictionaryValue& state) {
|
void NetLog::OnNewState(const base::DictionaryValue& state) {
|
||||||
net_log_state_ = state.CreateDeepCopy();
|
net_log_state_ = state.CreateDeepCopy();
|
||||||
|
auto logging_state = GetLoggingState();
|
||||||
|
LOG(INFO) << "Got new state: " << logging_state;
|
||||||
|
|
||||||
if (stop_callback_queue_.empty())
|
if (stop_callback_queue_.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetLoggingState() == "NOT_LOGGING") {
|
if (logging_state == "NOT_LOGGING") {
|
||||||
for (auto& callback : stop_callback_queue_) {
|
for (auto& callback : stop_callback_queue_) {
|
||||||
if (!callback.is_null())
|
if (!callback.is_null())
|
||||||
net_log_writer_->GetFilePathToCompletedLog(callback);
|
net_log_writer_->GetFilePathToCompletedLog(callback);
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||||
#include "atom/common/native_mate_converters/net_converter.h"
|
#include "atom/common/native_mate_converters/net_converter.h"
|
||||||
#include "atom/common/native_mate_converters/value_converter.h"
|
#include "atom/common/native_mate_converters/value_converter.h"
|
||||||
#include "atom/common/node_includes.h"
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/guid.h"
|
#include "base/guid.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
|
@ -56,10 +55,10 @@
|
||||||
#include "net/url_request/static_http_user_agent_settings.h"
|
#include "net/url_request/static_http_user_agent_settings.h"
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
#include "services/network/throttling/network_conditions.h"
|
|
||||||
#include "services/network/throttling/throttling_controller.h"
|
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
|
|
||||||
|
#include "atom/common/node_includes.h"
|
||||||
|
|
||||||
using atom::api::Cookies;
|
using atom::api::Cookies;
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
using content::StoragePartition;
|
using content::StoragePartition;
|
||||||
|
@ -353,18 +352,6 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
|
||||||
false, std::vector<download::DownloadItem::ReceivedSlice>());
|
false, std::vector<download::DownloadItem::ReceivedSlice>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDevToolsNetworkEmulationClientIdInIO(
|
|
||||||
net::URLRequestContextGetter* url_request_context_getter,
|
|
||||||
const std::string& client_id) {
|
|
||||||
if (!url_request_context_getter)
|
|
||||||
return;
|
|
||||||
net::URLRequestContext* context =
|
|
||||||
url_request_context_getter->GetURLRequestContext();
|
|
||||||
AtomNetworkDelegate* network_delegate =
|
|
||||||
static_cast<AtomNetworkDelegate*>(context->network_delegate());
|
|
||||||
network_delegate->SetDevToolsNetworkEmulationClientId(client_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DestroyGlobalHandle(v8::Isolate* isolate,
|
void DestroyGlobalHandle(v8::Isolate* isolate,
|
||||||
const v8::Global<v8::Value>& global_handle) {
|
const v8::Global<v8::Value>& global_handle) {
|
||||||
v8::Locker locker(isolate);
|
v8::Locker locker(isolate);
|
||||||
|
@ -385,7 +372,7 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Session::Session(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
Session::Session(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
||||||
: devtools_network_emulation_client_id_(base::GenerateGUID()),
|
: network_emulation_token_(base::UnguessableToken::Create()),
|
||||||
browser_context_(browser_context) {
|
browser_context_(browser_context) {
|
||||||
// Observe DownloadManager to get download notifications.
|
// Observe DownloadManager to get download notifications.
|
||||||
content::BrowserContext::GetDownloadManager(browser_context)
|
content::BrowserContext::GetDownloadManager(browser_context)
|
||||||
|
@ -503,42 +490,43 @@ void Session::SetDownloadPath(const base::FilePath& path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
|
void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
|
||||||
std::unique_ptr<network::NetworkConditions> conditions;
|
auto conditions = network::mojom::NetworkConditions::New();
|
||||||
bool offline = false;
|
|
||||||
double latency = 0.0, download_throughput = 0.0, upload_throughput = 0.0;
|
options.Get("offline", &conditions->offline);
|
||||||
if (options.Get("offline", &offline) && offline) {
|
options.Get("downloadThroughput", &conditions->download_throughput);
|
||||||
conditions.reset(new network::NetworkConditions(offline));
|
options.Get("uploadThroughput", &conditions->upload_throughput);
|
||||||
} else {
|
double latency = 0.0;
|
||||||
options.Get("latency", &latency);
|
if (options.Get("latency", &latency) && latency) {
|
||||||
options.Get("downloadThroughput", &download_throughput);
|
conditions->latency = base::TimeDelta::FromMillisecondsD(latency);
|
||||||
options.Get("uploadThroughput", &upload_throughput);
|
|
||||||
conditions.reset(new network::NetworkConditions(
|
|
||||||
false, latency, download_throughput, upload_throughput));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
network::ThrottlingController::SetConditions(
|
auto* network_context = content::BrowserContext::GetDefaultStoragePartition(
|
||||||
devtools_network_emulation_client_id_, std::move(conditions));
|
browser_context_.get())
|
||||||
BrowserThread::PostTask(
|
->GetNetworkContext();
|
||||||
BrowserThread::IO, FROM_HERE,
|
network_context->SetNetworkConditions(network_emulation_token_,
|
||||||
base::BindOnce(&SetDevToolsNetworkEmulationClientIdInIO,
|
std::move(conditions));
|
||||||
base::RetainedRef(browser_context_->GetRequestContext()),
|
|
||||||
devtools_network_emulation_client_id_));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::DisableNetworkEmulation() {
|
void Session::DisableNetworkEmulation() {
|
||||||
auto conditions = std::make_unique<network::NetworkConditions>();
|
auto* network_context = content::BrowserContext::GetDefaultStoragePartition(
|
||||||
network::ThrottlingController::SetConditions(
|
browser_context_.get())
|
||||||
devtools_network_emulation_client_id_, std::move(conditions));
|
->GetNetworkContext();
|
||||||
BrowserThread::PostTask(
|
network_context->SetNetworkConditions(
|
||||||
BrowserThread::IO, FROM_HERE,
|
network_emulation_token_, network::mojom::NetworkConditions::New());
|
||||||
base::BindOnce(&SetDevToolsNetworkEmulationClientIdInIO,
|
}
|
||||||
base::RetainedRef(browser_context_->GetRequestContext()),
|
|
||||||
std::string()));
|
void WrapVerifyProc(base::Callback<void(const VerifyRequestParams& request,
|
||||||
|
base::Callback<void(int)>)> proc,
|
||||||
|
const VerifyRequestParams& request,
|
||||||
|
base::OnceCallback<void(int)> cb) {
|
||||||
|
proc.Run(request, base::AdaptCallbackForRepeating(std::move(cb)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
AtomCertVerifier::VerifyProc proc;
|
base::Callback<void(const VerifyRequestParams& request,
|
||||||
|
base::Callback<void(int)>)>
|
||||||
|
proc;
|
||||||
if (!(val->IsNull() || mate::ConvertFromV8(args->isolate(), val, &proc))) {
|
if (!(val->IsNull() || mate::ConvertFromV8(args->isolate(), val, &proc))) {
|
||||||
args->ThrowError("Must pass null or function");
|
args->ThrowError("Must pass null or function");
|
||||||
return;
|
return;
|
||||||
|
@ -548,7 +536,7 @@ void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
||||||
BrowserThread::IO, FROM_HERE,
|
BrowserThread::IO, FROM_HERE,
|
||||||
base::BindOnce(&SetCertVerifyProcInIO,
|
base::BindOnce(&SetCertVerifyProcInIO,
|
||||||
WrapRefCounted(browser_context_->GetRequestContext()),
|
WrapRefCounted(browser_context_->GetRequestContext()),
|
||||||
proc));
|
base::Bind(&WrapVerifyProc, proc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
|
void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
|
||||||
|
@ -559,7 +547,7 @@ void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
||||||
browser_context()->GetPermissionManager());
|
browser_context()->GetPermissionControllerDelegate());
|
||||||
permission_manager->SetPermissionRequestHandler(handler);
|
permission_manager->SetPermissionRequestHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +559,7 @@ void Session::SetPermissionCheckHandler(v8::Local<v8::Value> val,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
||||||
browser_context()->GetPermissionManager());
|
browser_context()->GetPermissionControllerDelegate());
|
||||||
permission_manager->SetPermissionCheckHandler(handler);
|
permission_manager->SetPermissionCheckHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,8 +107,8 @@ class Session : public mate::TrackableObject<Session>,
|
||||||
v8::Global<v8::Value> web_request_;
|
v8::Global<v8::Value> web_request_;
|
||||||
v8::Global<v8::Value> net_log_;
|
v8::Global<v8::Value> net_log_;
|
||||||
|
|
||||||
// The X-DevTools-Emulate-Network-Conditions-Client-Id.
|
// The client id to enable the network throttler.
|
||||||
std::string devtools_network_emulation_client_id_;
|
base::UnguessableToken network_emulation_token_;
|
||||||
|
|
||||||
scoped_refptr<AtomBrowserContext> browser_context_;
|
scoped_refptr<AtomBrowserContext> browser_context_;
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
|
||||||
auto* relay =
|
auto* relay =
|
||||||
NativeWindowRelay::FromWebContents(embedder_->web_contents());
|
NativeWindowRelay::FromWebContents(embedder_->web_contents());
|
||||||
if (relay)
|
if (relay)
|
||||||
owner_window = relay->window.get();
|
owner_window = relay->GetNativeWindow();
|
||||||
}
|
}
|
||||||
if (owner_window)
|
if (owner_window)
|
||||||
SetOwnerWindow(owner_window);
|
SetOwnerWindow(owner_window);
|
||||||
|
@ -587,8 +587,8 @@ void WebContents::BeforeUnloadFired(content::WebContents* tab,
|
||||||
*proceed_to_fire_unload = true;
|
*proceed_to_fire_unload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::MoveContents(content::WebContents* source,
|
void WebContents::SetContentsBounds(content::WebContents* source,
|
||||||
const gfx::Rect& pos) {
|
const gfx::Rect& pos) {
|
||||||
Emit("move", pos);
|
Emit("move", pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,10 +612,6 @@ void WebContents::UpdateTargetURL(content::WebContents* source,
|
||||||
Emit("update-target-url", url);
|
Emit("update-target-url", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContents::IsPopupOrPanel(const content::WebContents* source) const {
|
|
||||||
return type_ == BROWSER_WINDOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebContents::HandleKeyboardEvent(
|
void WebContents::HandleKeyboardEvent(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
const content::NativeWebKeyboardEvent& event) {
|
const content::NativeWebKeyboardEvent& event) {
|
||||||
|
@ -671,7 +667,8 @@ void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
|
||||||
|
|
||||||
void WebContents::RendererUnresponsive(
|
void WebContents::RendererUnresponsive(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
content::RenderWidgetHost* render_widget_host) {
|
content::RenderWidgetHost* render_widget_host,
|
||||||
|
base::RepeatingClosure hang_monitor_restarter) {
|
||||||
Emit("unresponsive");
|
Emit("unresponsive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,10 +731,10 @@ bool WebContents::CheckMediaAccessPermission(
|
||||||
void WebContents::RequestMediaAccessPermission(
|
void WebContents::RequestMediaAccessPermission(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
const content::MediaStreamRequest& request,
|
const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& callback) {
|
content::MediaResponseCallback callback) {
|
||||||
auto* permission_helper =
|
auto* permission_helper =
|
||||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||||
permission_helper->RequestMediaAccessPermission(request, callback);
|
permission_helper->RequestMediaAccessPermission(request, std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::RequestToLockMouse(content::WebContents* web_contents,
|
void WebContents::RequestToLockMouse(content::WebContents* web_contents,
|
||||||
|
@ -988,7 +985,8 @@ void WebContents::DevToolsOpened() {
|
||||||
|
|
||||||
// Inherit owner window in devtools when it doesn't have one.
|
// Inherit owner window in devtools when it doesn't have one.
|
||||||
auto* devtools = managed_web_contents()->GetDevToolsWebContents();
|
auto* devtools = managed_web_contents()->GetDevToolsWebContents();
|
||||||
bool has_window = devtools->GetUserData(NativeWindowRelay::UserDataKey());
|
bool has_window =
|
||||||
|
devtools->GetUserData(NativeWindowRelay::kNativeWindowRelayUserDataKey);
|
||||||
if (owner_window() && !has_window)
|
if (owner_window() && !has_window)
|
||||||
handle->SetOwnerWindow(devtools, owner_window());
|
handle->SetOwnerWindow(devtools, owner_window());
|
||||||
|
|
||||||
|
@ -1823,7 +1821,8 @@ gfx::Size WebContents::GetSizeForNewRenderView(content::WebContents* wc) const {
|
||||||
if (IsOffScreen() && wc == web_contents()) {
|
if (IsOffScreen() && wc == web_contents()) {
|
||||||
auto* relay = NativeWindowRelay::FromWebContents(web_contents());
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents());
|
||||||
if (relay) {
|
if (relay) {
|
||||||
return relay->window->GetSize();
|
auto* owner_window = relay->GetNativeWindow();
|
||||||
|
return owner_window ? owner_window->GetSize() : gfx::Size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1916,7 +1915,7 @@ void WebContents::SetEmbedder(const WebContents* embedder) {
|
||||||
NativeWindow* owner_window = nullptr;
|
NativeWindow* owner_window = nullptr;
|
||||||
auto* relay = NativeWindowRelay::FromWebContents(embedder->web_contents());
|
auto* relay = NativeWindowRelay::FromWebContents(embedder->web_contents());
|
||||||
if (relay) {
|
if (relay) {
|
||||||
owner_window = relay->window.get();
|
owner_window = relay->GetNativeWindow();
|
||||||
}
|
}
|
||||||
if (owner_window)
|
if (owner_window)
|
||||||
SetOwnerWindow(owner_window);
|
SetOwnerWindow(owner_window);
|
||||||
|
@ -1961,7 +1960,7 @@ v8::Local<v8::Value> WebContents::Debugger(v8::Isolate* isolate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::GrantOriginAccess(const GURL& url) {
|
void WebContents::GrantOriginAccess(const GURL& url) {
|
||||||
content::ChildProcessSecurityPolicy::GetInstance()->GrantOrigin(
|
content::ChildProcessSecurityPolicy::GetInstance()->GrantCommitOrigin(
|
||||||
web_contents()->GetMainFrame()->GetProcess()->GetID(),
|
web_contents()->GetMainFrame()->GetProcess()->GetID(),
|
||||||
url::Origin::Create(url));
|
url::Origin::Create(url));
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,12 +314,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void BeforeUnloadFired(content::WebContents* tab,
|
void BeforeUnloadFired(content::WebContents* tab,
|
||||||
bool proceed,
|
bool proceed,
|
||||||
bool* proceed_to_fire_unload) override;
|
bool* proceed_to_fire_unload) override;
|
||||||
void MoveContents(content::WebContents* source,
|
void SetContentsBounds(content::WebContents* source,
|
||||||
const gfx::Rect& pos) override;
|
const gfx::Rect& pos) override;
|
||||||
void CloseContents(content::WebContents* source) override;
|
void CloseContents(content::WebContents* source) override;
|
||||||
void ActivateContents(content::WebContents* contents) override;
|
void ActivateContents(content::WebContents* contents) override;
|
||||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||||
bool IsPopupOrPanel(const content::WebContents* source) const override;
|
|
||||||
void HandleKeyboardEvent(
|
void HandleKeyboardEvent(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
const content::NativeWebKeyboardEvent& event) override;
|
const content::NativeWebKeyboardEvent& event) override;
|
||||||
|
@ -333,7 +332,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void ExitFullscreenModeForTab(content::WebContents* source) override;
|
void ExitFullscreenModeForTab(content::WebContents* source) override;
|
||||||
void RendererUnresponsive(
|
void RendererUnresponsive(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
content::RenderWidgetHost* render_widget_host) override;
|
content::RenderWidgetHost* render_widget_host,
|
||||||
|
base::RepeatingClosure hang_monitor_restarter) override;
|
||||||
void RendererResponsive(
|
void RendererResponsive(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
content::RenderWidgetHost* render_widget_host) override;
|
content::RenderWidgetHost* render_widget_host) override;
|
||||||
|
@ -351,7 +351,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void RequestMediaAccessPermission(
|
void RequestMediaAccessPermission(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
const content::MediaStreamRequest& request,
|
const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& callback) override;
|
content::MediaResponseCallback callback) override;
|
||||||
void RequestToLockMouse(content::WebContents* web_contents,
|
void RequestToLockMouse(content::WebContents* web_contents,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
bool last_unlocked_by_target) override;
|
bool last_unlocked_by_target) override;
|
||||||
|
|
|
@ -49,11 +49,9 @@ void CallNetworkDelegateMethod(
|
||||||
URLPatterns patterns,
|
URLPatterns patterns,
|
||||||
Listener listener) {
|
Listener listener) {
|
||||||
// Force creating network delegate.
|
// Force creating network delegate.
|
||||||
net::URLRequestContext* context =
|
url_request_context_getter->GetURLRequestContext();
|
||||||
url_request_context_getter->GetURLRequestContext();
|
|
||||||
// Then call the method.
|
// Then call the method.
|
||||||
AtomNetworkDelegate* network_delegate =
|
auto* network_delegate = url_request_context_getter->network_delegate();
|
||||||
static_cast<AtomNetworkDelegate*>(context->network_delegate());
|
|
||||||
(network_delegate->*method)(type, std::move(patterns), std::move(listener));
|
(network_delegate->*method)(type, std::move(patterns), std::move(listener));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,18 @@ void GPUInfoEnumerator::EndAuxAttributes() {
|
||||||
value_stack.pop();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<base::DictionaryValue> GPUInfoEnumerator::GetDictionary() {
|
std::unique_ptr<base::DictionaryValue> GPUInfoEnumerator::GetDictionary() {
|
||||||
return std::move(current);
|
return std::move(current);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
||||||
const char* kVideoEncodeAcceleratorSupportedProfileKey =
|
const char* kVideoEncodeAcceleratorSupportedProfileKey =
|
||||||
"videoEncodeAcceleratorSupportedProfile";
|
"videoEncodeAcceleratorSupportedProfile";
|
||||||
const char* kAuxAttributesKey = "auxAttributes";
|
const char* kAuxAttributesKey = "auxAttributes";
|
||||||
|
const char* kOverlayCapabilityKey = "overlayCapability";
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GPUInfoEnumerator();
|
GPUInfoEnumerator();
|
||||||
|
@ -41,6 +42,8 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
||||||
void EndVideoEncodeAcceleratorSupportedProfile() override;
|
void EndVideoEncodeAcceleratorSupportedProfile() override;
|
||||||
void BeginAuxAttributes() override;
|
void BeginAuxAttributes() override;
|
||||||
void EndAuxAttributes() override;
|
void EndAuxAttributes() override;
|
||||||
|
void BeginOverlayCapability() override;
|
||||||
|
void EndOverlayCapability() override;
|
||||||
std::unique_ptr<base::DictionaryValue> GetDictionary();
|
std::unique_ptr<base::DictionaryValue> GetDictionary();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -25,11 +25,9 @@ GPUInfoManager::~GPUInfoManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Based on
|
// Based on
|
||||||
// https://chromium.googlesource.com/chromium/src.git/+/66.0.3359.181/content/browser/gpu/gpu_data_manager_impl_private.cc#810
|
// https://chromium.googlesource.com/chromium/src.git/+/69.0.3497.106/content/browser/gpu/gpu_data_manager_impl_private.cc#838
|
||||||
bool GPUInfoManager::NeedsCompleteGpuInfoCollection() {
|
bool GPUInfoManager::NeedsCompleteGpuInfoCollection() {
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_WIN)
|
||||||
return gpu_data_manager_->GetGPUInfo().gl_vendor.empty();
|
|
||||||
#elif defined(OS_WIN)
|
|
||||||
const auto& gpu_info = gpu_data_manager_->GetGPUInfo();
|
const auto& gpu_info = gpu_data_manager_->GetGPUInfo();
|
||||||
return (gpu_info.dx_diagnostics.values.empty() &&
|
return (gpu_info.dx_diagnostics.values.empty() &&
|
||||||
gpu_info.dx_diagnostics.children.empty());
|
gpu_info.dx_diagnostics.children.empty());
|
||||||
|
|
|
@ -55,12 +55,12 @@
|
||||||
#include "content/public/common/service_names.mojom.h"
|
#include "content/public/common/service_names.mojom.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
#include "content/public/common/web_preferences.h"
|
#include "content/public/common/web_preferences.h"
|
||||||
#include "device/geolocation/public/cpp/location_provider.h"
|
|
||||||
#include "electron/buildflags/buildflags.h"
|
#include "electron/buildflags/buildflags.h"
|
||||||
#include "electron/grit/electron_resources.h"
|
#include "electron/grit/electron_resources.h"
|
||||||
#include "net/base/escape.h"
|
#include "net/base/escape.h"
|
||||||
#include "net/ssl/ssl_cert_request_info.h"
|
#include "net/ssl/ssl_cert_request_info.h"
|
||||||
#include "ppapi/host/ppapi_host.h"
|
#include "ppapi/host/ppapi_host.h"
|
||||||
|
#include "services/device/public/cpp/geolocation/location_provider.h"
|
||||||
#include "services/network/public/cpp/resource_request_body.h"
|
#include "services/network/public/cpp/resource_request_body.h"
|
||||||
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
|
@ -374,16 +374,6 @@ void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomBrowserClient::GetGeolocationRequestContext(
|
|
||||||
base::OnceCallback<void(scoped_refptr<net::URLRequestContextGetter>)>
|
|
||||||
callback) {
|
|
||||||
auto* io_thread = AtomBrowserMainParts::Get()->io_thread();
|
|
||||||
auto* context = io_thread->GetRequestContext();
|
|
||||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
|
||||||
FROM_HERE,
|
|
||||||
base::BindOnce(std::move(callback), base::RetainedRef(context)));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AtomBrowserClient::GetGeolocationApiKey() {
|
std::string AtomBrowserClient::GetGeolocationApiKey() {
|
||||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||||
std::string api_key;
|
std::string api_key;
|
||||||
|
@ -537,7 +527,8 @@ network::mojom::NetworkContextPtr AtomBrowserClient::CreateNetworkContext(
|
||||||
void AtomBrowserClient::RegisterOutOfProcessServices(
|
void AtomBrowserClient::RegisterOutOfProcessServices(
|
||||||
OutOfProcessServiceMap* services) {
|
OutOfProcessServiceMap* services) {
|
||||||
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
|
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
|
||||||
base::ASCIIToUTF16("V8 Proxy Resolver");
|
base::BindRepeating(&l10n_util::GetStringUTF16,
|
||||||
|
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<base::Value> AtomBrowserClient::GetServiceManifestOverlay(
|
std::unique_ptr<base::Value> AtomBrowserClient::GetServiceManifestOverlay(
|
||||||
|
|
|
@ -69,9 +69,6 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
||||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||||
int child_process_id) override;
|
int child_process_id) override;
|
||||||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
||||||
void GetGeolocationRequestContext(
|
|
||||||
base::OnceCallback<void(scoped_refptr<net::URLRequestContextGetter>)>
|
|
||||||
callback) override;
|
|
||||||
std::string GetGeolocationApiKey() override;
|
std::string GetGeolocationApiKey() override;
|
||||||
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||||
void AllowCertificateError(
|
void AllowCertificateError(
|
||||||
|
|
|
@ -72,7 +72,7 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
|
||||||
bool in_memory,
|
bool in_memory,
|
||||||
const base::DictionaryValue& options)
|
const base::DictionaryValue& options)
|
||||||
: base::RefCountedDeleteOnSequence<AtomBrowserContext>(
|
: base::RefCountedDeleteOnSequence<AtomBrowserContext>(
|
||||||
base::SequencedTaskRunnerHandle::Get()),
|
base::ThreadTaskRunnerHandle::Get()),
|
||||||
in_memory_pref_store_(nullptr),
|
in_memory_pref_store_(nullptr),
|
||||||
storage_policy_(new SpecialStoragePolicy),
|
storage_policy_(new SpecialStoragePolicy),
|
||||||
in_memory_(in_memory),
|
in_memory_(in_memory),
|
||||||
|
@ -234,7 +234,8 @@ content::BrowserPluginGuestManager* AtomBrowserContext::GetGuestManager() {
|
||||||
return guest_manager_.get();
|
return guest_manager_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
content::PermissionManager* AtomBrowserContext::GetPermissionManager() {
|
content::PermissionControllerDelegate*
|
||||||
|
AtomBrowserContext::GetPermissionControllerDelegate() {
|
||||||
if (!permission_manager_.get())
|
if (!permission_manager_.get())
|
||||||
permission_manager_.reset(new AtomPermissionManager);
|
permission_manager_.reset(new AtomPermissionManager);
|
||||||
return permission_manager_.get();
|
return permission_manager_.get();
|
||||||
|
|
|
@ -81,7 +81,8 @@ class AtomBrowserContext
|
||||||
std::string GetMediaDeviceIDSalt() override;
|
std::string GetMediaDeviceIDSalt() override;
|
||||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||||
content::PermissionManager* GetPermissionManager() override;
|
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
|
||||||
|
override;
|
||||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||||
net::URLRequestContextGetter* CreateRequestContext(
|
net::URLRequestContextGetter* CreateRequestContext(
|
||||||
content::ProtocolHandlerMap* protocol_handlers,
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include "atom/browser/api/trackable_object.h"
|
#include "atom/browser/api/trackable_object.h"
|
||||||
#include "atom/browser/atom_browser_client.h"
|
#include "atom/browser/atom_browser_client.h"
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/bridge_task_runner.h"
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "atom/browser/io_thread.h"
|
#include "atom/browser/io_thread.h"
|
||||||
#include "atom/browser/javascript_environment.h"
|
#include "atom/browser/javascript_environment.h"
|
||||||
|
@ -73,7 +72,6 @@ AtomBrowserMainParts::AtomBrowserMainParts(
|
||||||
browser_(new Browser),
|
browser_(new Browser),
|
||||||
node_bindings_(NodeBindings::Create(NodeBindings::BROWSER)),
|
node_bindings_(NodeBindings::Create(NodeBindings::BROWSER)),
|
||||||
atom_bindings_(new AtomBindings(uv_default_loop())),
|
atom_bindings_(new AtomBindings(uv_default_loop())),
|
||||||
gc_timer_(true, true),
|
|
||||||
main_function_params_(params) {
|
main_function_params_(params) {
|
||||||
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
|
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
|
||||||
self_ = this;
|
self_ = this;
|
||||||
|
@ -136,18 +134,15 @@ int AtomBrowserMainParts::PreEarlyInitialization() {
|
||||||
void AtomBrowserMainParts::PostEarlyInitialization() {
|
void AtomBrowserMainParts::PostEarlyInitialization() {
|
||||||
brightray::BrowserMainParts::PostEarlyInitialization();
|
brightray::BrowserMainParts::PostEarlyInitialization();
|
||||||
|
|
||||||
// Temporary set the bridge_task_runner_ as current thread's task runner,
|
// A workaround was previously needed because there was no ThreadTaskRunner
|
||||||
// so we can fool gin::PerIsolateData to use it as its task runner, instead
|
// set. If this check is failing we may need to re-add that workaround
|
||||||
// of getting current message loop's task runner, which is null for now.
|
DCHECK(base::ThreadTaskRunnerHandle::IsSet());
|
||||||
bridge_task_runner_ = new BridgeTaskRunner;
|
|
||||||
base::ThreadTaskRunnerHandle handle(bridge_task_runner_);
|
|
||||||
|
|
||||||
// The ProxyResolverV8 has setup a complete V8 environment, in order to
|
// The ProxyResolverV8 has setup a complete V8 environment, in order to
|
||||||
// avoid conflicts we only initialize our V8 environment after that.
|
// avoid conflicts we only initialize our V8 environment after that.
|
||||||
js_env_.reset(new JavascriptEnvironment);
|
js_env_.reset(new JavascriptEnvironment(node_bindings_->uv_loop()));
|
||||||
|
|
||||||
node_bindings_->Initialize();
|
node_bindings_->Initialize();
|
||||||
|
|
||||||
// Create the global environment.
|
// Create the global environment.
|
||||||
node::Environment* env = node_bindings_->CreateEnvironment(
|
node::Environment* env = node_bindings_->CreateEnvironment(
|
||||||
js_env_->context(), js_env_->platform());
|
js_env_->context(), js_env_->platform());
|
||||||
|
@ -222,8 +217,6 @@ void AtomBrowserMainParts::ToolkitInitialized() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
js_env_->OnMessageLoopCreated();
|
|
||||||
|
|
||||||
// Run user's main script before most things get initialized, so we can have
|
// Run user's main script before most things get initialized, so we can have
|
||||||
// a chance to setup everything.
|
// a chance to setup everything.
|
||||||
node_bindings_->PrepareMessageLoop();
|
node_bindings_->PrepareMessageLoop();
|
||||||
|
@ -244,8 +237,6 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
|
||||||
brightray::BrowserMainParts::PreMainMessageLoopRun();
|
brightray::BrowserMainParts::PreMainMessageLoopRun();
|
||||||
bridge_task_runner_->MessageLoopIsReady();
|
|
||||||
bridge_task_runner_ = nullptr;
|
|
||||||
|
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
libgtkui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());
|
libgtkui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());
|
||||||
|
@ -266,6 +257,11 @@ bool AtomBrowserMainParts::MainMessageLoopRun(int* result_code) {
|
||||||
return brightray::BrowserMainParts::MainMessageLoopRun(result_code);
|
return brightray::BrowserMainParts::MainMessageLoopRun(result_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomBrowserMainParts::PreDefaultMainMessageLoopRun(
|
||||||
|
base::OnceClosure quit_closure) {
|
||||||
|
Browser::SetMainMessageLoopQuitClosure(std::move(quit_closure));
|
||||||
|
}
|
||||||
|
|
||||||
void AtomBrowserMainParts::PostMainMessageLoopStart() {
|
void AtomBrowserMainParts::PostMainMessageLoopStart() {
|
||||||
brightray::BrowserMainParts::PostMainMessageLoopStart();
|
brightray::BrowserMainParts::PostMainMessageLoopStart();
|
||||||
#if defined(OS_POSIX)
|
#if defined(OS_POSIX)
|
||||||
|
|
|
@ -81,6 +81,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||||
void ToolkitInitialized() override;
|
void ToolkitInitialized() override;
|
||||||
void PreMainMessageLoopRun() override;
|
void PreMainMessageLoopRun() override;
|
||||||
bool MainMessageLoopRun(int* result_code) override;
|
bool MainMessageLoopRun(int* result_code) override;
|
||||||
|
void PreDefaultMainMessageLoopRun(base::OnceClosure quit_closure) override;
|
||||||
void PostMainMessageLoopStart() override;
|
void PostMainMessageLoopStart() override;
|
||||||
void PostMainMessageLoopRun() override;
|
void PostMainMessageLoopRun() override;
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
@ -108,10 +109,6 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||||
// A fake BrowserProcess object that used to feed the source code from chrome.
|
// A fake BrowserProcess object that used to feed the source code from chrome.
|
||||||
std::unique_ptr<BrowserProcess> fake_browser_process_;
|
std::unique_ptr<BrowserProcess> fake_browser_process_;
|
||||||
|
|
||||||
// The gin::PerIsolateData requires a task runner to create, so we feed it
|
|
||||||
// with a task runner that will post all work to main loop.
|
|
||||||
scoped_refptr<BridgeTaskRunner> bridge_task_runner_;
|
|
||||||
|
|
||||||
// Pointer to exit code.
|
// Pointer to exit code.
|
||||||
int* exit_code_ = nullptr;
|
int* exit_code_ = nullptr;
|
||||||
|
|
||||||
|
@ -125,7 +122,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||||
std::unique_ptr<net_log::ChromeNetLog> net_log_;
|
std::unique_ptr<net_log::ChromeNetLog> net_log_;
|
||||||
std::unique_ptr<IconManager> icon_manager_;
|
std::unique_ptr<IconManager> icon_manager_;
|
||||||
|
|
||||||
base::Timer gc_timer_;
|
base::RepeatingTimer gc_timer_;
|
||||||
|
|
||||||
// List of callbacks should be executed before destroying JS env.
|
// List of callbacks should be executed before destroying JS env.
|
||||||
std::list<base::OnceClosure> destructors_;
|
std::list<base::OnceClosure> destructors_;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
|
|
||||||
#include "atom/browser/mac/atom_application.h"
|
|
||||||
#include "atom/browser/mac/atom_application_delegate.h"
|
#include "atom/browser/mac/atom_application_delegate.h"
|
||||||
#include "base/mac/bundle_locations.h"
|
#include "base/mac/bundle_locations.h"
|
||||||
#include "base/mac/foundation_util.h"
|
#include "base/mac/foundation_util.h"
|
||||||
|
@ -13,9 +12,6 @@
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
||||||
// Force the NSApplication subclass to be used.
|
|
||||||
[AtomApplication sharedApplication];
|
|
||||||
|
|
||||||
// Set our own application delegate.
|
// Set our own application delegate.
|
||||||
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
|
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
|
||||||
[NSApp setDelegate:delegate];
|
[NSApp setDelegate:delegate];
|
||||||
|
|
|
@ -86,7 +86,7 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
|
||||||
auto* relay =
|
auto* relay =
|
||||||
web_contents ? NativeWindowRelay::FromWebContents(web_contents) : nullptr;
|
web_contents ? NativeWindowRelay::FromWebContents(web_contents) : nullptr;
|
||||||
if (relay)
|
if (relay)
|
||||||
window = relay->window.get();
|
window = relay->GetNativeWindow();
|
||||||
|
|
||||||
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
||||||
bool offscreen =
|
bool offscreen =
|
||||||
|
|
|
@ -72,7 +72,7 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
|
||||||
if (web_preferences && !web_preferences->IsEnabled(options::kOffscreen)) {
|
if (web_preferences && !web_preferences->IsEnabled(options::kOffscreen)) {
|
||||||
auto* relay = NativeWindowRelay::FromWebContents(web_contents);
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents);
|
||||||
if (relay)
|
if (relay)
|
||||||
window = relay->window.get();
|
window = relay->GetNativeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
atom::ShowMessageBox(
|
atom::ShowMessageBox(
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
#include "atom/browser/web_contents_preferences.h"
|
#include "atom/browser/web_contents_preferences.h"
|
||||||
#include "content/public/browser/child_process_security_policy.h"
|
#include "content/public/browser/child_process_security_policy.h"
|
||||||
|
#include "content/public/browser/permission_controller.h"
|
||||||
#include "content/public/browser/permission_type.h"
|
#include "content/public/browser/permission_type.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
|
@ -111,7 +112,8 @@ int AtomPermissionManager::RequestPermission(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
const StatusCallback& response_callback) {
|
const base::Callback<void(blink::mojom::PermissionStatus)>&
|
||||||
|
response_callback) {
|
||||||
return RequestPermissionWithDetails(permission, render_frame_host,
|
return RequestPermissionWithDetails(permission, render_frame_host,
|
||||||
requesting_origin, user_gesture, nullptr,
|
requesting_origin, user_gesture, nullptr,
|
||||||
response_callback);
|
response_callback);
|
||||||
|
@ -150,7 +152,7 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
|
||||||
const StatusesCallback& response_callback) {
|
const StatusesCallback& response_callback) {
|
||||||
if (permissions.empty()) {
|
if (permissions.empty()) {
|
||||||
response_callback.Run(std::vector<blink::mojom::PermissionStatus>());
|
response_callback.Run(std::vector<blink::mojom::PermissionStatus>());
|
||||||
return kNoPendingOperation;
|
return content::PermissionController::kNoPendingOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request_handler_.is_null()) {
|
if (request_handler_.is_null()) {
|
||||||
|
@ -168,7 +170,7 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
|
||||||
statuses.push_back(blink::mojom::PermissionStatus::GRANTED);
|
statuses.push_back(blink::mojom::PermissionStatus::GRANTED);
|
||||||
}
|
}
|
||||||
response_callback.Run(statuses);
|
response_callback.Run(statuses);
|
||||||
return kNoPendingOperation;
|
return content::PermissionController::kNoPendingOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* web_contents =
|
auto* web_contents =
|
||||||
|
@ -222,7 +224,7 @@ int AtomPermissionManager::SubscribePermissionStatusChange(
|
||||||
content::PermissionType permission,
|
content::PermissionType permission,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
const GURL& embedding_origin,
|
const GURL& embedding_origin,
|
||||||
const StatusCallback& callback) {
|
const base::Callback<void(blink::mojom::PermissionStatus)>& callback) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/containers/id_map.h"
|
#include "base/containers/id_map.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "content/public/browser/permission_manager.h"
|
#include "content/public/browser/permission_controller_delegate.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
class WebContents;
|
class WebContents;
|
||||||
|
@ -20,7 +20,7 @@ class WebContents;
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class AtomPermissionManager : public content::PermissionManager {
|
class AtomPermissionManager : public content::PermissionControllerDelegate {
|
||||||
public:
|
public:
|
||||||
AtomPermissionManager();
|
AtomPermissionManager();
|
||||||
~AtomPermissionManager() override;
|
~AtomPermissionManager() override;
|
||||||
|
@ -41,7 +41,7 @@ class AtomPermissionManager : public content::PermissionManager {
|
||||||
void SetPermissionRequestHandler(const RequestHandler& handler);
|
void SetPermissionRequestHandler(const RequestHandler& handler);
|
||||||
void SetPermissionCheckHandler(const CheckHandler& handler);
|
void SetPermissionCheckHandler(const CheckHandler& handler);
|
||||||
|
|
||||||
// content::PermissionManager:
|
// content::PermissionControllerDelegate:
|
||||||
int RequestPermission(
|
int RequestPermission(
|
||||||
content::PermissionType permission,
|
content::PermissionType permission,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
|
@ -55,7 +55,7 @@ class AtomPermissionManager : public content::PermissionManager {
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
const base::DictionaryValue* details,
|
const base::DictionaryValue* details,
|
||||||
const base::Callback<void(blink::mojom::PermissionStatus)>& callback);
|
const StatusCallback& callback);
|
||||||
int RequestPermissions(
|
int RequestPermissions(
|
||||||
const std::vector<content::PermissionType>& permissions,
|
const std::vector<content::PermissionType>& permissions,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
|
@ -87,7 +87,7 @@ class AtomPermissionManager : public content::PermissionManager {
|
||||||
int permission_id,
|
int permission_id,
|
||||||
blink::mojom::PermissionStatus status);
|
blink::mojom::PermissionStatus status);
|
||||||
|
|
||||||
// content::PermissionManager:
|
// content::PermissionControllerDelegate:
|
||||||
void ResetPermission(content::PermissionType permission,
|
void ResetPermission(content::PermissionType permission,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
const GURL& embedding_origin) override;
|
const GURL& embedding_origin) override;
|
||||||
|
|
|
@ -32,11 +32,11 @@ void AtomSpeechRecognitionManagerDelegate::OnRecognitionEnd(int session_id) {}
|
||||||
|
|
||||||
void AtomSpeechRecognitionManagerDelegate::OnRecognitionResults(
|
void AtomSpeechRecognitionManagerDelegate::OnRecognitionResults(
|
||||||
int session_id,
|
int session_id,
|
||||||
const content::SpeechRecognitionResults& result) {}
|
const std::vector<blink::mojom::SpeechRecognitionResultPtr>& results) {}
|
||||||
|
|
||||||
void AtomSpeechRecognitionManagerDelegate::OnRecognitionError(
|
void AtomSpeechRecognitionManagerDelegate::OnRecognitionError(
|
||||||
int session_id,
|
int session_id,
|
||||||
const content::SpeechRecognitionError& error) {}
|
const blink::mojom::SpeechRecognitionError& error) {}
|
||||||
|
|
||||||
void AtomSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
|
void AtomSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
|
||||||
int session_id,
|
int session_id,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
|
#define ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/public/browser/speech_recognition_event_listener.h"
|
#include "content/public/browser/speech_recognition_event_listener.h"
|
||||||
|
@ -30,10 +31,10 @@ class AtomSpeechRecognitionManagerDelegate
|
||||||
void OnRecognitionEnd(int session_id) override;
|
void OnRecognitionEnd(int session_id) override;
|
||||||
void OnRecognitionResults(
|
void OnRecognitionResults(
|
||||||
int session_id,
|
int session_id,
|
||||||
const content::SpeechRecognitionResults& result) override;
|
const std::vector<blink::mojom::SpeechRecognitionResultPtr>&) override;
|
||||||
void OnRecognitionError(
|
void OnRecognitionError(
|
||||||
int session_id,
|
int session_id,
|
||||||
const content::SpeechRecognitionError& error) override;
|
const blink::mojom::SpeechRecognitionError& error) override;
|
||||||
void OnAudioLevelsChange(int session_id,
|
void OnAudioLevelsChange(int session_id,
|
||||||
float volume,
|
float volume,
|
||||||
float noise_volume) override;
|
float noise_volume) override;
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool AtomWebUIControllerFactory::UseWebUIBindingsForURL(
|
||||||
return UseWebUIForURL(browser_context, url);
|
return UseWebUIForURL(browser_context, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
content::WebUIController*
|
std::unique_ptr<content::WebUIController>
|
||||||
AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
|
AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
|
||||||
const GURL& url) const {
|
const GURL& url) const {
|
||||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
|
@ -78,7 +78,7 @@ AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
|
||||||
return new PdfViewerUI(browser_context, web_ui, src);
|
return new PdfViewerUI(browser_context, web_ui, src);
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||||
return nullptr;
|
return std::unique_ptr<content::WebUIController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -5,8 +5,11 @@
|
||||||
#ifndef ATOM_BROWSER_ATOM_WEB_UI_CONTROLLER_FACTORY_H_
|
#ifndef ATOM_BROWSER_ATOM_WEB_UI_CONTROLLER_FACTORY_H_
|
||||||
#define ATOM_BROWSER_ATOM_WEB_UI_CONTROLLER_FACTORY_H_
|
#define ATOM_BROWSER_ATOM_WEB_UI_CONTROLLER_FACTORY_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/singleton.h"
|
#include "base/memory/singleton.h"
|
||||||
|
#include "content/public/browser/web_ui_controller.h"
|
||||||
#include "content/public/browser/web_ui_controller_factory.h"
|
#include "content/public/browser/web_ui_controller_factory.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -25,7 +28,7 @@ class AtomWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||||
const GURL& url) const override;
|
const GURL& url) const override;
|
||||||
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
|
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
|
||||||
const GURL& url) const override;
|
const GURL& url) const override;
|
||||||
content::WebUIController* CreateWebUIControllerForURL(
|
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
|
||||||
content::WebUI* web_ui,
|
content::WebUI* web_ui,
|
||||||
const GURL& url) const override;
|
const GURL& url) const override;
|
||||||
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
// Copyright (c) 2015 GitHub, Inc.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "atom/browser/bridge_task_runner.h"
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include "base/message_loop/message_loop.h"
|
|
||||||
|
|
||||||
namespace atom {
|
|
||||||
|
|
||||||
BridgeTaskRunner::BridgeTaskRunner() = default;
|
|
||||||
BridgeTaskRunner::~BridgeTaskRunner() = default;
|
|
||||||
|
|
||||||
void BridgeTaskRunner::MessageLoopIsReady() {
|
|
||||||
auto message_loop = base::MessageLoop::current();
|
|
||||||
CHECK(message_loop);
|
|
||||||
for (TaskPair& task : tasks_) {
|
|
||||||
message_loop->task_runner()->PostDelayedTask(
|
|
||||||
std::get<0>(task), std::move(std::get<1>(task)), std::get<2>(task));
|
|
||||||
}
|
|
||||||
for (TaskPair& task : non_nestable_tasks_) {
|
|
||||||
message_loop->task_runner()->PostNonNestableDelayedTask(
|
|
||||||
std::get<0>(task), std::move(std::get<1>(task)), std::get<2>(task));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BridgeTaskRunner::PostDelayedTask(const base::Location& from_here,
|
|
||||||
base::OnceClosure task,
|
|
||||||
base::TimeDelta delay) {
|
|
||||||
auto message_loop = base::MessageLoop::current();
|
|
||||||
if (!message_loop) {
|
|
||||||
tasks_.push_back(std::make_tuple(from_here, std::move(task), delay));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return message_loop->task_runner()->PostDelayedTask(from_here,
|
|
||||||
std::move(task), delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BridgeTaskRunner::RunsTasksInCurrentSequence() const {
|
|
||||||
auto message_loop = base::MessageLoop::current();
|
|
||||||
if (!message_loop)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return message_loop->task_runner()->RunsTasksInCurrentSequence();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BridgeTaskRunner::PostNonNestableDelayedTask(
|
|
||||||
const base::Location& from_here,
|
|
||||||
base::OnceClosure task,
|
|
||||||
base::TimeDelta delay) {
|
|
||||||
auto message_loop = base::MessageLoop::current();
|
|
||||||
if (!message_loop) {
|
|
||||||
non_nestable_tasks_.push_back(
|
|
||||||
std::make_tuple(from_here, std::move(task), delay));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return message_loop->task_runner()->PostNonNestableDelayedTask(
|
|
||||||
from_here, std::move(task), delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace atom
|
|
|
@ -1,48 +0,0 @@
|
||||||
// Copyright (c) 2015 GitHub, Inc.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#ifndef ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_
|
|
||||||
#define ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_
|
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "base/location.h"
|
|
||||||
#include "base/single_thread_task_runner.h"
|
|
||||||
#include "base/tuple.h"
|
|
||||||
|
|
||||||
namespace atom {
|
|
||||||
|
|
||||||
// Post all tasks to the current message loop's task runner if available,
|
|
||||||
// otherwise delay the work until message loop is ready.
|
|
||||||
class BridgeTaskRunner : public base::SingleThreadTaskRunner {
|
|
||||||
public:
|
|
||||||
BridgeTaskRunner();
|
|
||||||
|
|
||||||
// Called when message loop is ready.
|
|
||||||
void MessageLoopIsReady();
|
|
||||||
|
|
||||||
// base::SingleThreadTaskRunner:
|
|
||||||
bool PostDelayedTask(const base::Location& from_here,
|
|
||||||
base::OnceClosure task,
|
|
||||||
base::TimeDelta delay) override;
|
|
||||||
bool RunsTasksInCurrentSequence() const override;
|
|
||||||
bool PostNonNestableDelayedTask(const base::Location& from_here,
|
|
||||||
base::OnceClosure task,
|
|
||||||
base::TimeDelta delay) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
using TaskPair =
|
|
||||||
std::tuple<base::Location, base::OnceClosure, base::TimeDelta>;
|
|
||||||
~BridgeTaskRunner() override;
|
|
||||||
|
|
||||||
std::vector<TaskPair> tasks_;
|
|
||||||
std::vector<TaskPair> non_nestable_tasks_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(BridgeTaskRunner);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace atom
|
|
||||||
|
|
||||||
#endif // ATOM_BROWSER_BRIDGE_TASK_RUNNER_H_
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
#include "atom/browser/browser_observer.h"
|
#include "atom/browser/browser_observer.h"
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
#include "atom/browser/window_list.h"
|
#include "atom/browser/window_list.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
|
#include "base/no_destructor.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
|
@ -23,6 +25,9 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
// Null until/unless the default main message loop is running.
|
||||||
|
base::NoDestructor<base::OnceClosure> g_quit_main_message_loop;
|
||||||
|
|
||||||
Browser::LoginItemSettings::LoginItemSettings() = default;
|
Browser::LoginItemSettings::LoginItemSettings() = default;
|
||||||
Browser::LoginItemSettings::~LoginItemSettings() = default;
|
Browser::LoginItemSettings::~LoginItemSettings() = default;
|
||||||
Browser::LoginItemSettings::LoginItemSettings(const LoginItemSettings& other) =
|
Browser::LoginItemSettings::LoginItemSettings(const LoginItemSettings& other) =
|
||||||
|
@ -90,9 +95,8 @@ void Browser::Shutdown() {
|
||||||
for (BrowserObserver& observer : observers_)
|
for (BrowserObserver& observer : observers_)
|
||||||
observer.OnQuit();
|
observer.OnQuit();
|
||||||
|
|
||||||
if (base::ThreadTaskRunnerHandle::IsSet()) {
|
if (*g_quit_main_message_loop) {
|
||||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
std::move(*g_quit_main_message_loop).Run();
|
||||||
FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated());
|
|
||||||
} else {
|
} else {
|
||||||
// There is no message loop available so we are in early stage.
|
// There is no message loop available so we are in early stage.
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -191,6 +195,10 @@ void Browser::PreMainMessageLoopRun() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Browser::SetMainMessageLoopQuitClosure(base::OnceClosure quit_closure) {
|
||||||
|
*g_quit_main_message_loop = std::move(quit_closure);
|
||||||
|
}
|
||||||
|
|
||||||
void Browser::NotifyAndShutdown() {
|
void Browser::NotifyAndShutdown() {
|
||||||
if (is_shutdown_)
|
if (is_shutdown_)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -239,6 +239,10 @@ class Browser : public WindowListObserver {
|
||||||
|
|
||||||
void PreMainMessageLoopRun();
|
void PreMainMessageLoopRun();
|
||||||
|
|
||||||
|
// Stores the supplied |quit_closure|, to be run when the last Browser
|
||||||
|
// instance is destroyed.
|
||||||
|
static void SetMainMessageLoopQuitClosure(base::OnceClosure quit_closure);
|
||||||
|
|
||||||
void AddObserver(BrowserObserver* obs) { observers_.AddObserver(obs); }
|
void AddObserver(BrowserObserver* obs) { observers_.AddObserver(obs); }
|
||||||
|
|
||||||
void RemoveObserver(BrowserObserver* obs) { observers_.RemoveObserver(obs); }
|
void RemoveObserver(BrowserObserver* obs) { observers_.RemoveObserver(obs); }
|
||||||
|
|
|
@ -189,24 +189,35 @@ void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
|
||||||
void CommonWebContentsDelegate::SetOwnerWindow(
|
void CommonWebContentsDelegate::SetOwnerWindow(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
NativeWindow* owner_window) {
|
NativeWindow* owner_window) {
|
||||||
owner_window_ = owner_window ? owner_window->GetWeakPtr() : nullptr;
|
|
||||||
auto relay = std::make_unique<NativeWindowRelay>(owner_window_);
|
|
||||||
auto* relay_key = relay->key;
|
|
||||||
if (owner_window) {
|
if (owner_window) {
|
||||||
|
owner_window_ = owner_window->GetWeakPtr();
|
||||||
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
|
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
|
||||||
autofill_popup_.reset(new AutofillPopup());
|
autofill_popup_.reset(new AutofillPopup());
|
||||||
#endif
|
#endif
|
||||||
web_contents->SetUserData(relay_key, std::move(relay));
|
NativeWindowRelay::CreateForWebContents(web_contents,
|
||||||
|
owner_window->GetWeakPtr());
|
||||||
} else {
|
} else {
|
||||||
web_contents->RemoveUserData(relay_key);
|
owner_window_ = nullptr;
|
||||||
relay.reset();
|
web_contents->RemoveUserData(
|
||||||
|
NativeWindowRelay::kNativeWindowRelayUserDataKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonWebContentsDelegate::ResetManagedWebContents(bool async) {
|
void CommonWebContentsDelegate::ResetManagedWebContents(bool async) {
|
||||||
if (async) {
|
if (async) {
|
||||||
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
|
// Browser context should be destroyed only after the WebContents,
|
||||||
web_contents_.release());
|
// this is guaranteed in the sync mode by the order of declaration,
|
||||||
|
// in the async version we maintain a reference until the WebContents
|
||||||
|
// is destroyed.
|
||||||
|
// //electron/patches/common/chromium/content_browser_main_loop.patch
|
||||||
|
// is required to get the right quit closure for the main message loop.
|
||||||
|
base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
|
||||||
|
FROM_HERE,
|
||||||
|
base::BindOnce([](scoped_refptr<AtomBrowserContext> browser_context,
|
||||||
|
std::unique_ptr<brightray::InspectableWebContents>
|
||||||
|
web_contents) { web_contents.reset(); },
|
||||||
|
base::RetainedRef(browser_context_),
|
||||||
|
std::move(web_contents_)));
|
||||||
} else {
|
} else {
|
||||||
web_contents_.reset();
|
web_contents_.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#define ATOM_BROWSER_FAKE_LOCATION_PROVIDER_H_
|
#define ATOM_BROWSER_FAKE_LOCATION_PROVIDER_H_
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "device/geolocation/public/cpp/location_provider.h"
|
#include "services/device/public/cpp/geolocation/location_provider.h"
|
||||||
#include "services/device/public/mojom/geoposition.mojom.h"
|
#include "services/device/public/mojom/geoposition.mojom.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "atom/browser/io_thread.h"
|
#include "atom/browser/io_thread.h"
|
||||||
|
#include "atom/common/options_switches.h"
|
||||||
|
|
||||||
#include "components/net_log/chrome_net_log.h"
|
#include "components/net_log/chrome_net_log.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
#include "content/public/browser/network_service_instance.h"
|
||||||
#include "net/proxy_resolution/proxy_resolution_service.h"
|
#include "net/proxy_resolution/proxy_resolution_service.h"
|
||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
#include "net/url_request/url_request_context_builder.h"
|
#include "net/url_request/url_request_context_builder.h"
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
|
#include "services/network/network_service.h"
|
||||||
|
|
||||||
#if defined(USE_NSS_CERTS)
|
#if defined(USE_NSS_CERTS)
|
||||||
#include "net/cert_net/nss_ocsp.h"
|
#include "net/cert_net/nss_ocsp.h"
|
||||||
|
@ -24,6 +27,33 @@ using content::BrowserThread;
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
network::mojom::HttpAuthStaticParamsPtr CreateHttpAuthStaticParams() {
|
||||||
|
network::mojom::HttpAuthStaticParamsPtr auth_static_params =
|
||||||
|
network::mojom::HttpAuthStaticParams::New();
|
||||||
|
|
||||||
|
auth_static_params->supported_schemes = {"basic", "digest", "ntlm",
|
||||||
|
"negotiate"};
|
||||||
|
|
||||||
|
return auth_static_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams(
|
||||||
|
const base::CommandLine& command_line) {
|
||||||
|
network::mojom::HttpAuthDynamicParamsPtr auth_dynamic_params =
|
||||||
|
network::mojom::HttpAuthDynamicParams::New();
|
||||||
|
|
||||||
|
auth_dynamic_params->server_whitelist =
|
||||||
|
command_line.GetSwitchValueASCII(switches::kAuthServerWhitelist);
|
||||||
|
auth_dynamic_params->delegate_whitelist = command_line.GetSwitchValueASCII(
|
||||||
|
switches::kAuthNegotiateDelegateWhitelist);
|
||||||
|
|
||||||
|
return auth_dynamic_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
IOThread::IOThread(net_log::ChromeNetLog* net_log) : net_log_(net_log) {
|
IOThread::IOThread(net_log::ChromeNetLog* net_log) : net_log_(net_log) {
|
||||||
BrowserThread::SetIOThreadDelegate(this);
|
BrowserThread::SetIOThreadDelegate(this);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +63,14 @@ IOThread::~IOThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOThread::Init() {
|
void IOThread::Init() {
|
||||||
|
// Create the network service, so that shared host resolver
|
||||||
|
// gets created which is required to set the auth preferences below.
|
||||||
|
auto& command_line = *base::CommandLine::ForCurrentProcess();
|
||||||
|
auto* network_service = content::GetNetworkServiceImpl();
|
||||||
|
network_service->SetUpHttpAuth(CreateHttpAuthStaticParams());
|
||||||
|
network_service->ConfigureHttpAuthPrefs(
|
||||||
|
CreateHttpAuthDynamicParams(command_line));
|
||||||
|
|
||||||
net::URLRequestContextBuilder builder;
|
net::URLRequestContextBuilder builder;
|
||||||
// TODO(deepak1556): We need to respoect user proxy configurations,
|
// TODO(deepak1556): We need to respoect user proxy configurations,
|
||||||
// the following initialization has to happen before any request
|
// the following initialization has to happen before any request
|
||||||
|
|
|
@ -19,10 +19,13 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
JavascriptEnvironment::JavascriptEnvironment()
|
JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
|
||||||
: initialized_(Initialize()),
|
: isolate_(Initialize(event_loop)),
|
||||||
isolate_holder_(base::ThreadTaskRunnerHandle::Get()),
|
isolate_holder_(base::ThreadTaskRunnerHandle::Get(),
|
||||||
isolate_(isolate_holder_.isolate()),
|
gin::IsolateHolder::kSingleThread,
|
||||||
|
gin::IsolateHolder::kAllowAtomicsWait,
|
||||||
|
gin::IsolateHolder::IsolateCreationMode::kNormal,
|
||||||
|
isolate_),
|
||||||
isolate_scope_(isolate_),
|
isolate_scope_(isolate_),
|
||||||
locker_(isolate_),
|
locker_(isolate_),
|
||||||
handle_scope_(isolate_),
|
handle_scope_(isolate_),
|
||||||
|
@ -31,15 +34,7 @@ JavascriptEnvironment::JavascriptEnvironment()
|
||||||
|
|
||||||
JavascriptEnvironment::~JavascriptEnvironment() = default;
|
JavascriptEnvironment::~JavascriptEnvironment() = default;
|
||||||
|
|
||||||
void JavascriptEnvironment::OnMessageLoopCreated() {
|
v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
|
||||||
isolate_holder_.AddRunMicrotasksObserver();
|
|
||||||
}
|
|
||||||
|
|
||||||
void JavascriptEnvironment::OnMessageLoopDestroying() {
|
|
||||||
isolate_holder_.RemoveRunMicrotasksObserver();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JavascriptEnvironment::Initialize() {
|
|
||||||
auto* cmd = base::CommandLine::ForCurrentProcess();
|
auto* cmd = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
// --js-flags.
|
// --js-flags.
|
||||||
|
@ -54,12 +49,21 @@ bool JavascriptEnvironment::Initialize() {
|
||||||
platform_ = node::CreatePlatform(
|
platform_ = node::CreatePlatform(
|
||||||
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
|
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
|
||||||
tracing_controller);
|
tracing_controller);
|
||||||
|
|
||||||
v8::V8::InitializePlatform(platform_);
|
v8::V8::InitializePlatform(platform_);
|
||||||
gin::IsolateHolder::Initialize(
|
gin::IsolateHolder::Initialize(
|
||||||
gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras,
|
gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras,
|
||||||
gin::ArrayBufferAllocator::SharedInstance(),
|
gin::ArrayBufferAllocator::SharedInstance(),
|
||||||
nullptr /* external_reference_table */, false /* create_v8_platform */);
|
nullptr /* external_reference_table */, false /* create_v8_platform */);
|
||||||
return true;
|
|
||||||
|
v8::Isolate* isolate = v8::Isolate::Allocate();
|
||||||
|
platform_->RegisterIsolate(isolate, event_loop);
|
||||||
|
|
||||||
|
return isolate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JavascriptEnvironment::OnMessageLoopDestroying() {
|
||||||
|
platform_->UnregisterIsolate(isolate_);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeEnvironment::NodeEnvironment(node::Environment* env) : env_(env) {}
|
NodeEnvironment::NodeEnvironment(node::Environment* env) : env_(env) {}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "gin/public/isolate_holder.h"
|
#include "gin/public/isolate_holder.h"
|
||||||
|
#include "uv.h" // NOLINT(build/include)
|
||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
class Environment;
|
class Environment;
|
||||||
|
@ -18,10 +19,9 @@ namespace atom {
|
||||||
// Manage the V8 isolate and context automatically.
|
// Manage the V8 isolate and context automatically.
|
||||||
class JavascriptEnvironment {
|
class JavascriptEnvironment {
|
||||||
public:
|
public:
|
||||||
JavascriptEnvironment();
|
explicit JavascriptEnvironment(uv_loop_t* event_loop);
|
||||||
~JavascriptEnvironment();
|
~JavascriptEnvironment();
|
||||||
|
|
||||||
void OnMessageLoopCreated();
|
|
||||||
void OnMessageLoopDestroying();
|
void OnMessageLoopDestroying();
|
||||||
|
|
||||||
node::MultiIsolatePlatform* platform() const { return platform_; }
|
node::MultiIsolatePlatform* platform() const { return platform_; }
|
||||||
|
@ -31,18 +31,16 @@ class JavascriptEnvironment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool Initialize();
|
v8::Isolate* Initialize(uv_loop_t* event_loop);
|
||||||
|
|
||||||
// Leaked on exit.
|
// Leaked on exit.
|
||||||
node::MultiIsolatePlatform* platform_;
|
node::MultiIsolatePlatform* platform_;
|
||||||
|
|
||||||
bool initialized_;
|
|
||||||
gin::IsolateHolder isolate_holder_;
|
|
||||||
v8::Isolate* isolate_;
|
v8::Isolate* isolate_;
|
||||||
|
gin::IsolateHolder isolate_holder_;
|
||||||
v8::Isolate::Scope isolate_scope_;
|
v8::Isolate::Scope isolate_scope_;
|
||||||
v8::Locker locker_;
|
v8::Locker locker_;
|
||||||
v8::HandleScope handle_scope_;
|
v8::HandleScope handle_scope_;
|
||||||
v8::UniquePersistent<v8::Context> context_;
|
v8::Global<v8::Context> context_;
|
||||||
v8::Context::Scope context_scope_;
|
v8::Context::Scope context_scope_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment);
|
DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment);
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace atom {
|
||||||
LoginHandler::LoginHandler(
|
LoginHandler::LoginHandler(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::AuthChallengeInfo& auth_info,
|
const net::AuthChallengeInfo& auth_info,
|
||||||
const net::NetworkDelegate::AuthCallback& callback,
|
net::NetworkDelegate::AuthCallback callback,
|
||||||
net::AuthCredentials* credentials,
|
net::AuthCredentials* credentials,
|
||||||
const content::ResourceRequestInfo* resource_request_info)
|
const content::ResourceRequestInfo* resource_request_info)
|
||||||
: credentials_(credentials),
|
: credentials_(credentials),
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
|
#include "base/sequenced_task_runner_helpers.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "content/public/browser/resource_request_info.h"
|
#include "content/public/browser/resource_request_info.h"
|
||||||
#include "net/base/network_delegate.h"
|
#include "net/base/network_delegate.h"
|
||||||
|
@ -23,7 +24,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
|
||||||
public:
|
public:
|
||||||
LoginHandler(net::URLRequest* request,
|
LoginHandler(net::URLRequest* request,
|
||||||
const net::AuthChallengeInfo& auth_info,
|
const net::AuthChallengeInfo& auth_info,
|
||||||
const net::NetworkDelegate::AuthCallback& callback,
|
net::NetworkDelegate::AuthCallback callback,
|
||||||
net::AuthCredentials* credentials,
|
net::AuthCredentials* credentials,
|
||||||
const content::ResourceRequestInfo* resource_request_info);
|
const content::ResourceRequestInfo* resource_request_info);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "ui/display/win/screen_win.h"
|
#include "ui/display/win/screen_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::NativeWindowRelay);
|
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -577,8 +575,22 @@ const views::Widget* NativeWindow::GetWidget() const {
|
||||||
return widget();
|
return widget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
const void* const NativeWindowRelay::kNativeWindowRelayUserDataKey =
|
||||||
|
&NativeWindowRelay::kNativeWindowRelayUserDataKey;
|
||||||
|
|
||||||
|
// static
|
||||||
|
void NativeWindowRelay::CreateForWebContents(
|
||||||
|
content::WebContents* web_contents,
|
||||||
|
base::WeakPtr<NativeWindow> window) {
|
||||||
|
DCHECK(web_contents);
|
||||||
|
DCHECK(!web_contents->GetUserData(kNativeWindowRelayUserDataKey));
|
||||||
|
web_contents->SetUserData(kNativeWindowRelayUserDataKey,
|
||||||
|
base::WrapUnique(new NativeWindowRelay(window)));
|
||||||
|
}
|
||||||
|
|
||||||
NativeWindowRelay::NativeWindowRelay(base::WeakPtr<NativeWindow> window)
|
NativeWindowRelay::NativeWindowRelay(base::WeakPtr<NativeWindow> window)
|
||||||
: key(UserDataKey()), window(window) {}
|
: native_window_(window) {}
|
||||||
|
|
||||||
NativeWindowRelay::~NativeWindowRelay() = default;
|
NativeWindowRelay::~NativeWindowRelay() = default;
|
||||||
|
|
||||||
|
|
|
@ -346,18 +346,20 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
class NativeWindowRelay
|
class NativeWindowRelay
|
||||||
: public content::WebContentsUserData<NativeWindowRelay> {
|
: public content::WebContentsUserData<NativeWindowRelay> {
|
||||||
public:
|
public:
|
||||||
explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window);
|
static const void* const kNativeWindowRelayUserDataKey;
|
||||||
|
|
||||||
|
static void CreateForWebContents(content::WebContents*,
|
||||||
|
base::WeakPtr<NativeWindow>);
|
||||||
|
|
||||||
~NativeWindowRelay() override;
|
~NativeWindowRelay() override;
|
||||||
|
|
||||||
static void* UserDataKey() {
|
NativeWindow* GetNativeWindow() const { return native_window_.get(); }
|
||||||
return content::WebContentsUserData<NativeWindowRelay>::UserDataKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
void* key;
|
|
||||||
base::WeakPtr<NativeWindow> window;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class content::WebContentsUserData<NativeWindow>;
|
friend class content::WebContentsUserData<NativeWindow>;
|
||||||
|
explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window);
|
||||||
|
|
||||||
|
base::WeakPtr<NativeWindow> native_window_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -999,15 +999,7 @@ bool NativeWindowMac::IsKiosk() {
|
||||||
void NativeWindowMac::SetBackgroundColor(SkColor color) {
|
void NativeWindowMac::SetBackgroundColor(SkColor color) {
|
||||||
base::ScopedCFTypeRef<CGColorRef> cgcolor(
|
base::ScopedCFTypeRef<CGColorRef> cgcolor(
|
||||||
skia::CGColorCreateFromSkColor(color));
|
skia::CGColorCreateFromSkColor(color));
|
||||||
// views::Widget adds a layer for the content view.
|
[[[window_ contentView] layer] setBackgroundColor:cgcolor];
|
||||||
auto* bridge = views::NativeWidgetMac::GetBridgeForNativeWindow(window_);
|
|
||||||
NSView* compositor_superview =
|
|
||||||
static_cast<ui::AcceleratedWidgetMacNSView*>(bridge)
|
|
||||||
->AcceleratedWidgetGetNSView();
|
|
||||||
[[compositor_superview layer] setBackgroundColor:cgcolor];
|
|
||||||
// When using WebContents as content view, the contentView also has layer.
|
|
||||||
if ([[window_ contentView] wantsLayer])
|
|
||||||
[[[window_ contentView] layer] setBackgroundColor:cgcolor];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetHasShadow(bool has_shadow) {
|
void NativeWindowMac::SetHasShadow(bool has_shadow) {
|
||||||
|
|
|
@ -142,7 +142,8 @@ int URLRequestAsarJob::ReadRawData(net::IOBuffer* dest, int dest_size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool URLRequestAsarJob::IsRedirectResponse(GURL* location,
|
bool URLRequestAsarJob::IsRedirectResponse(GURL* location,
|
||||||
int* http_status_code) {
|
int* http_status_code,
|
||||||
|
bool* insecure_scheme_was_upgraded) {
|
||||||
if (type_ != TYPE_FILE)
|
if (type_ != TYPE_FILE)
|
||||||
return false;
|
return false;
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
@ -161,6 +162,7 @@ bool URLRequestAsarJob::IsRedirectResponse(GURL* location,
|
||||||
|
|
||||||
*location = net::FilePathToFileURL(new_path);
|
*location = net::FilePathToFileURL(new_path);
|
||||||
*http_status_code = 301;
|
*http_status_code = 301;
|
||||||
|
*insecure_scheme_was_upgraded = false;
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -55,7 +55,9 @@ class URLRequestAsarJob : public net::URLRequestJob {
|
||||||
void Start() override;
|
void Start() override;
|
||||||
void Kill() override;
|
void Kill() override;
|
||||||
int ReadRawData(net::IOBuffer* buf, int buf_size) override;
|
int ReadRawData(net::IOBuffer* buf, int buf_size) override;
|
||||||
bool IsRedirectResponse(GURL* location, int* http_status_code) override;
|
bool IsRedirectResponse(GURL* location,
|
||||||
|
int* http_status_code,
|
||||||
|
bool* insecure_scheme_was_upgraded) override;
|
||||||
std::unique_ptr<net::SourceStream> SetUpSourceStream() override;
|
std::unique_ptr<net::SourceStream> SetUpSourceStream() override;
|
||||||
bool GetMimeType(std::string* mime_type) const override;
|
bool GetMimeType(std::string* mime_type) const override;
|
||||||
void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
|
void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
|
||||||
|
|
|
@ -30,14 +30,14 @@ namespace {
|
||||||
class Response : public base::LinkNode<Response> {
|
class Response : public base::LinkNode<Response> {
|
||||||
public:
|
public:
|
||||||
Response(net::CertVerifyResult* verify_result,
|
Response(net::CertVerifyResult* verify_result,
|
||||||
const net::CompletionCallback& callback)
|
net::CompletionOnceCallback callback)
|
||||||
: verify_result_(verify_result), callback_(callback) {}
|
: verify_result_(verify_result), callback_(std::move(callback)) {}
|
||||||
net::CertVerifyResult* verify_result() { return verify_result_; }
|
net::CertVerifyResult* verify_result() { return verify_result_; }
|
||||||
net::CompletionCallback callback() { return callback_; }
|
net::CompletionOnceCallback callback() { return std::move(callback_); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
net::CertVerifyResult* verify_result_;
|
net::CertVerifyResult* verify_result_;
|
||||||
net::CompletionCallback callback_;
|
net::CompletionOnceCallback callback_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Response);
|
DISALLOW_COPY_AND_ASSIGN(Response);
|
||||||
};
|
};
|
||||||
|
@ -130,8 +130,8 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddResponseListener(net::CertVerifyResult* verify_result,
|
void AddResponseListener(net::CertVerifyResult* verify_result,
|
||||||
const net::CompletionCallback& callback) {
|
net::CompletionOnceCallback callback) {
|
||||||
response_list_.Append(new Response(verify_result, callback));
|
response_list_.Append(new Response(verify_result, std::move(callback)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const AtomCertVerifier::RequestParams& params() const { return params_; }
|
const AtomCertVerifier::RequestParams& params() const { return params_; }
|
||||||
|
@ -163,15 +163,15 @@ void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) {
|
||||||
int AtomCertVerifier::Verify(const RequestParams& params,
|
int AtomCertVerifier::Verify(const RequestParams& params,
|
||||||
net::CRLSet* crl_set,
|
net::CRLSet* crl_set,
|
||||||
net::CertVerifyResult* verify_result,
|
net::CertVerifyResult* verify_result,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
std::unique_ptr<Request>* out_req,
|
std::unique_ptr<Request>* out_req,
|
||||||
const net::NetLogWithSource& net_log) {
|
const net::NetLogWithSource& net_log) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||||
|
|
||||||
if (verify_proc_.is_null()) {
|
if (verify_proc_.is_null()) {
|
||||||
ct_delegate_->ClearCTExcludedHostsList();
|
ct_delegate_->ClearCTExcludedHostsList();
|
||||||
return default_cert_verifier_->Verify(params, crl_set, verify_result,
|
return default_cert_verifier_->Verify(
|
||||||
callback, out_req, net_log);
|
params, crl_set, verify_result, std::move(callback), out_req, net_log);
|
||||||
} else {
|
} else {
|
||||||
CertVerifierRequest* request = FindRequest(params);
|
CertVerifierRequest* request = FindRequest(params);
|
||||||
if (!request) {
|
if (!request) {
|
||||||
|
@ -182,18 +182,12 @@ int AtomCertVerifier::Verify(const RequestParams& params,
|
||||||
*out_req = std::move(new_request);
|
*out_req = std::move(new_request);
|
||||||
inflight_requests_[params] = request;
|
inflight_requests_[params] = request;
|
||||||
}
|
}
|
||||||
request->AddResponseListener(verify_result, callback);
|
request->AddResponseListener(verify_result, std::move(callback));
|
||||||
|
|
||||||
return net::ERR_IO_PENDING;
|
return net::ERR_IO_PENDING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtomCertVerifier::SupportsOCSPStapling() {
|
|
||||||
if (verify_proc_.is_null())
|
|
||||||
return default_cert_verifier_->SupportsOCSPStapling();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AtomCertVerifier::RemoveRequest(const RequestParams& params) {
|
void AtomCertVerifier::RemoveRequest(const RequestParams& params) {
|
||||||
auto it = inflight_requests_.find(params);
|
auto it = inflight_requests_.find(params);
|
||||||
if (it != inflight_requests_.end())
|
if (it != inflight_requests_.end())
|
||||||
|
|
|
@ -38,7 +38,7 @@ class AtomCertVerifier : public net::CertVerifier {
|
||||||
~AtomCertVerifier() override;
|
~AtomCertVerifier() override;
|
||||||
|
|
||||||
using VerifyProc = base::Callback<void(const VerifyRequestParams& request,
|
using VerifyProc = base::Callback<void(const VerifyRequestParams& request,
|
||||||
const net::CompletionCallback&)>;
|
net::CompletionOnceCallback)>;
|
||||||
|
|
||||||
void SetVerifyProc(const VerifyProc& proc);
|
void SetVerifyProc(const VerifyProc& proc);
|
||||||
|
|
||||||
|
@ -53,10 +53,9 @@ class AtomCertVerifier : public net::CertVerifier {
|
||||||
int Verify(const RequestParams& params,
|
int Verify(const RequestParams& params,
|
||||||
net::CRLSet* crl_set,
|
net::CRLSet* crl_set,
|
||||||
net::CertVerifyResult* verify_result,
|
net::CertVerifyResult* verify_result,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
std::unique_ptr<Request>* out_req,
|
std::unique_ptr<Request>* out_req,
|
||||||
const net::NetLogWithSource& net_log) override;
|
const net::NetLogWithSource& net_log) override;
|
||||||
bool SupportsOCSPStapling() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CertVerifierRequest;
|
friend class CertVerifierRequest;
|
||||||
|
|
|
@ -20,10 +20,8 @@
|
||||||
#include "net/base/load_flags.h"
|
#include "net/base/load_flags.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/url_request/url_request.h"
|
#include "net/url_request/url_request.h"
|
||||||
#include "services/network/throttling/throttling_network_transaction.h"
|
|
||||||
|
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
using network::ThrottlingNetworkTransaction;
|
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -269,14 +267,9 @@ void AtomNetworkDelegate::SetResponseListenerInIO(ResponseEvent type,
|
||||||
response_listeners_[type] = {std::move(patterns), std::move(callback)};
|
response_listeners_[type] = {std::move(patterns), std::move(callback)};
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomNetworkDelegate::SetDevToolsNetworkEmulationClientId(
|
|
||||||
const std::string& client_id) {
|
|
||||||
client_id_ = client_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AtomNetworkDelegate::OnBeforeURLRequest(
|
int AtomNetworkDelegate::OnBeforeURLRequest(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
GURL* new_url) {
|
GURL* new_url) {
|
||||||
if (!base::ContainsKey(response_listeners_, kOnBeforeRequest)) {
|
if (!base::ContainsKey(response_listeners_, kOnBeforeRequest)) {
|
||||||
for (const auto& domain : ignore_connections_limit_domains_) {
|
for (const auto& domain : ignore_connections_limit_domains_) {
|
||||||
|
@ -290,22 +283,19 @@ int AtomNetworkDelegate::OnBeforeURLRequest(
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HandleResponseEvent(kOnBeforeRequest, request, callback, new_url);
|
return HandleResponseEvent(kOnBeforeRequest, request, std::move(callback),
|
||||||
|
new_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AtomNetworkDelegate::OnBeforeStartTransaction(
|
int AtomNetworkDelegate::OnBeforeStartTransaction(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
net::HttpRequestHeaders* headers) {
|
net::HttpRequestHeaders* headers) {
|
||||||
if (!client_id_.empty())
|
|
||||||
headers->SetHeader(network::ThrottlingNetworkTransaction::
|
|
||||||
kDevToolsEmulateNetworkConditionsClientId,
|
|
||||||
client_id_);
|
|
||||||
if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders))
|
if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders))
|
||||||
return net::OK;
|
return net::OK;
|
||||||
|
|
||||||
return HandleResponseEvent(kOnBeforeSendHeaders, request, callback, headers,
|
return HandleResponseEvent(kOnBeforeSendHeaders, request, std::move(callback),
|
||||||
*headers);
|
headers, *headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomNetworkDelegate::OnStartTransaction(
|
void AtomNetworkDelegate::OnStartTransaction(
|
||||||
|
@ -319,7 +309,7 @@ void AtomNetworkDelegate::OnStartTransaction(
|
||||||
|
|
||||||
int AtomNetworkDelegate::OnHeadersReceived(
|
int AtomNetworkDelegate::OnHeadersReceived(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
const net::HttpResponseHeaders* original,
|
const net::HttpResponseHeaders* original,
|
||||||
scoped_refptr<net::HttpResponseHeaders>* override,
|
scoped_refptr<net::HttpResponseHeaders>* override,
|
||||||
GURL* allowed) {
|
GURL* allowed) {
|
||||||
|
@ -327,7 +317,7 @@ int AtomNetworkDelegate::OnHeadersReceived(
|
||||||
return net::OK;
|
return net::OK;
|
||||||
|
|
||||||
return HandleResponseEvent(
|
return HandleResponseEvent(
|
||||||
kOnHeadersReceived, request, callback,
|
kOnHeadersReceived, request, std::move(callback),
|
||||||
std::make_pair(override, original->GetStatusLine()), original);
|
std::make_pair(override, original->GetStatusLine()), original);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,14 +343,16 @@ void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request,
|
||||||
request->was_cached());
|
request->was_cached());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
|
void AtomNetworkDelegate::OnCompleted(net::URLRequest* request,
|
||||||
|
bool started,
|
||||||
|
int net_error) {
|
||||||
// OnCompleted may happen before other events.
|
// OnCompleted may happen before other events.
|
||||||
callbacks_.erase(request->identifier());
|
callbacks_.erase(request->identifier());
|
||||||
|
|
||||||
if (request->status().status() == net::URLRequestStatus::FAILED ||
|
if (request->status().status() == net::URLRequestStatus::FAILED ||
|
||||||
request->status().status() == net::URLRequestStatus::CANCELED) {
|
request->status().status() == net::URLRequestStatus::CANCELED) {
|
||||||
// Error event.
|
// Error event.
|
||||||
OnErrorOccurred(request, started);
|
OnErrorOccurred(request, started, net_error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +383,7 @@ void AtomNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
|
||||||
net::NetworkDelegate::AuthRequiredResponse AtomNetworkDelegate::OnAuthRequired(
|
net::NetworkDelegate::AuthRequiredResponse AtomNetworkDelegate::OnAuthRequired(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::AuthChallengeInfo& auth_info,
|
const net::AuthChallengeInfo& auth_info,
|
||||||
const AuthCallback& callback,
|
AuthCallback callback,
|
||||||
net::AuthCredentials* credentials) {
|
net::AuthCredentials* credentials) {
|
||||||
auto* resource_request_info =
|
auto* resource_request_info =
|
||||||
content::ResourceRequestInfo::ForRequest(request);
|
content::ResourceRequestInfo::ForRequest(request);
|
||||||
|
@ -462,7 +454,8 @@ bool AtomNetworkDelegate::OnCanUseReportingClient(const url::Origin& origin,
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomNetworkDelegate::OnErrorOccurred(net::URLRequest* request,
|
void AtomNetworkDelegate::OnErrorOccurred(net::URLRequest* request,
|
||||||
bool started) {
|
bool started,
|
||||||
|
int net_error) {
|
||||||
if (!base::ContainsKey(simple_listeners_, kOnErrorOccurred))
|
if (!base::ContainsKey(simple_listeners_, kOnErrorOccurred))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -474,7 +467,7 @@ template <typename Out, typename... Args>
|
||||||
int AtomNetworkDelegate::HandleResponseEvent(
|
int AtomNetworkDelegate::HandleResponseEvent(
|
||||||
ResponseEvent type,
|
ResponseEvent type,
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
Out out,
|
Out out,
|
||||||
Args... args) {
|
Args... args) {
|
||||||
const auto& info = response_listeners_[type];
|
const auto& info = response_listeners_[type];
|
||||||
|
@ -489,7 +482,7 @@ int AtomNetworkDelegate::HandleResponseEvent(
|
||||||
request, &render_process_id, &render_frame_id);
|
request, &render_process_id, &render_frame_id);
|
||||||
|
|
||||||
// The |request| could be destroyed before the |callback| is called.
|
// The |request| could be destroyed before the |callback| is called.
|
||||||
callbacks_[request->identifier()] = callback;
|
callbacks_[request->identifier()] = std::move(callback);
|
||||||
|
|
||||||
ResponseCallback response =
|
ResponseCallback response =
|
||||||
base::Bind(&AtomNetworkDelegate::OnListenerResultInUI<Out>,
|
base::Bind(&AtomNetworkDelegate::OnListenerResultInUI<Out>,
|
||||||
|
@ -535,7 +528,7 @@ void AtomNetworkDelegate::OnListenerResultInIO(
|
||||||
|
|
||||||
bool cancel = false;
|
bool cancel = false;
|
||||||
response->GetBoolean("cancel", &cancel);
|
response->GetBoolean("cancel", &cancel);
|
||||||
callbacks_[id].Run(cancel ? net::ERR_BLOCKED_BY_CLIENT : net::OK);
|
std::move(callbacks_[id]).Run(cancel ? net::ERR_BLOCKED_BY_CLIENT : net::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -79,15 +79,13 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
||||||
URLPatterns patterns,
|
URLPatterns patterns,
|
||||||
ResponseListener callback);
|
ResponseListener callback);
|
||||||
|
|
||||||
void SetDevToolsNetworkEmulationClientId(const std::string& client_id);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// net::NetworkDelegate:
|
// net::NetworkDelegate:
|
||||||
int OnBeforeURLRequest(net::URLRequest* request,
|
int OnBeforeURLRequest(net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
GURL* new_url) override;
|
GURL* new_url) override;
|
||||||
int OnBeforeStartTransaction(net::URLRequest* request,
|
int OnBeforeStartTransaction(net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
net::HttpRequestHeaders* headers) override;
|
net::HttpRequestHeaders* headers) override;
|
||||||
void OnBeforeSendHeaders(net::URLRequest* request,
|
void OnBeforeSendHeaders(net::URLRequest* request,
|
||||||
const net::ProxyInfo& proxy_info,
|
const net::ProxyInfo& proxy_info,
|
||||||
|
@ -97,7 +95,7 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
||||||
const net::HttpRequestHeaders& headers) override;
|
const net::HttpRequestHeaders& headers) override;
|
||||||
int OnHeadersReceived(
|
int OnHeadersReceived(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
const net::HttpResponseHeaders* original_response_headers,
|
const net::HttpResponseHeaders* original_response_headers,
|
||||||
scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
|
scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
|
||||||
GURL* allowed_unsafe_redirect_url) override;
|
GURL* allowed_unsafe_redirect_url) override;
|
||||||
|
@ -108,14 +106,16 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
||||||
int64_t bytes_read) override {}
|
int64_t bytes_read) override {}
|
||||||
void OnNetworkBytesSent(net::URLRequest* request,
|
void OnNetworkBytesSent(net::URLRequest* request,
|
||||||
int64_t bytes_sent) override {}
|
int64_t bytes_sent) override {}
|
||||||
void OnCompleted(net::URLRequest* request, bool started) override;
|
void OnCompleted(net::URLRequest* request,
|
||||||
|
bool started,
|
||||||
|
int net_error) override;
|
||||||
void OnURLRequestDestroyed(net::URLRequest* request) override;
|
void OnURLRequestDestroyed(net::URLRequest* request) override;
|
||||||
void OnPACScriptError(int line_number, const base::string16& error) override {
|
void OnPACScriptError(int line_number, const base::string16& error) override {
|
||||||
}
|
}
|
||||||
AuthRequiredResponse OnAuthRequired(
|
AuthRequiredResponse OnAuthRequired(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::AuthChallengeInfo& auth_info,
|
const net::AuthChallengeInfo& auth_info,
|
||||||
const AuthCallback& callback,
|
AuthCallback callback,
|
||||||
net::AuthCredentials* credentials) override;
|
net::AuthCredentials* credentials) override;
|
||||||
bool OnCanGetCookies(const net::URLRequest& request,
|
bool OnCanGetCookies(const net::URLRequest& request,
|
||||||
const net::CookieList& cookie_list) override;
|
const net::CookieList& cookie_list) override;
|
||||||
|
@ -143,7 +143,7 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
||||||
const GURL& endpoint) const override;
|
const GURL& endpoint) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnErrorOccurred(net::URLRequest* request, bool started);
|
void OnErrorOccurred(net::URLRequest* request, bool started, int net_error);
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void HandleSimpleEvent(SimpleEvent type,
|
void HandleSimpleEvent(SimpleEvent type,
|
||||||
|
@ -152,7 +152,7 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
||||||
template <typename Out, typename... Args>
|
template <typename Out, typename... Args>
|
||||||
int HandleResponseEvent(ResponseEvent type,
|
int HandleResponseEvent(ResponseEvent type,
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
net::CompletionOnceCallback callback,
|
||||||
Out out,
|
Out out,
|
||||||
Args... args);
|
Args... args);
|
||||||
|
|
||||||
|
@ -169,12 +169,9 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
|
||||||
std::map<uint64_t, scoped_refptr<LoginHandler>> login_handler_map_;
|
std::map<uint64_t, scoped_refptr<LoginHandler>> login_handler_map_;
|
||||||
std::map<SimpleEvent, SimpleListenerInfo> simple_listeners_;
|
std::map<SimpleEvent, SimpleListenerInfo> simple_listeners_;
|
||||||
std::map<ResponseEvent, ResponseListenerInfo> response_listeners_;
|
std::map<ResponseEvent, ResponseListenerInfo> response_listeners_;
|
||||||
std::map<uint64_t, net::CompletionCallback> callbacks_;
|
std::map<uint64_t, net::CompletionOnceCallback> callbacks_;
|
||||||
std::vector<std::string> ignore_connections_limit_domains_;
|
std::vector<std::string> ignore_connections_limit_domains_;
|
||||||
|
|
||||||
// Client id for devtools network emulation.
|
|
||||||
std::string client_id_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomNetworkDelegate);
|
DISALLOW_COPY_AND_ASSIGN(AtomNetworkDelegate);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,8 @@ void AtomURLRequest::DoCancel() {
|
||||||
void AtomURLRequest::DoFollowRedirect() {
|
void AtomURLRequest::DoFollowRedirect() {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
||||||
if (request_ && request_->is_redirecting() && redirect_policy_ == "manual") {
|
if (request_ && request_->is_redirecting() && redirect_policy_ == "manual") {
|
||||||
request_->FollowDeferredRedirect();
|
request_->FollowDeferredRedirect(
|
||||||
|
base::nullopt /* modified_request_headers */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "atom/browser/net/atom_network_delegate.h"
|
#include "atom/browser/net/atom_network_delegate.h"
|
||||||
#include "atom/browser/net/atom_url_request_job_factory.h"
|
#include "atom/browser/net/atom_url_request_job_factory.h"
|
||||||
#include "atom/browser/net/http_protocol_handler.h"
|
#include "atom/browser/net/http_protocol_handler.h"
|
||||||
#include "atom/common/options_switches.h"
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/task_scheduler/post_task.h"
|
||||||
|
@ -83,7 +82,6 @@ network::mojom::NetworkContextParamsPtr CreateDefaultNetworkContextParams(
|
||||||
network_context_params->accept_language =
|
network_context_params->accept_language =
|
||||||
net::HttpUtil::GenerateAcceptLanguageHeader(
|
net::HttpUtil::GenerateAcceptLanguageHeader(
|
||||||
brightray::BrowserClient::Get()->GetApplicationLocale());
|
brightray::BrowserClient::Get()->GetApplicationLocale());
|
||||||
network_context_params->allow_gssapi_library_load = true;
|
|
||||||
network_context_params->enable_data_url_support = false;
|
network_context_params->enable_data_url_support = false;
|
||||||
network_context_params->proxy_resolver_factory =
|
network_context_params->proxy_resolver_factory =
|
||||||
ChromeMojoProxyResolverFactory::CreateWithStrongBinding().PassInterface();
|
ChromeMojoProxyResolverFactory::CreateWithStrongBinding().PassInterface();
|
||||||
|
@ -185,12 +183,6 @@ class ResourceContext : public content::ResourceContext {
|
||||||
ResourceContext() = default;
|
ResourceContext() = default;
|
||||||
~ResourceContext() override = default;
|
~ResourceContext() override = default;
|
||||||
|
|
||||||
net::HostResolver* GetHostResolver() override {
|
|
||||||
if (request_context_)
|
|
||||||
return request_context_->host_resolver();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
net::URLRequestContext* GetRequestContext() override {
|
net::URLRequestContext* GetRequestContext() override {
|
||||||
return request_context_;
|
return request_context_;
|
||||||
}
|
}
|
||||||
|
@ -226,8 +218,7 @@ URLRequestContextGetter::Handle::CreateMainRequestContextGetter(
|
||||||
DCHECK(!main_request_context_getter_.get());
|
DCHECK(!main_request_context_getter_.get());
|
||||||
LazyInitialize();
|
LazyInitialize();
|
||||||
main_request_context_getter_ = new URLRequestContextGetter(
|
main_request_context_getter_ = new URLRequestContextGetter(
|
||||||
AtomBrowserClient::Get()->GetNetLog(), this, protocol_handlers,
|
this, protocol_handlers, std::move(protocol_interceptors));
|
||||||
std::move(protocol_interceptors));
|
|
||||||
return main_request_context_getter_;
|
return main_request_context_getter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,12 +275,10 @@ void URLRequestContextGetter::Handle::ShutdownOnUIThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
URLRequestContextGetter::URLRequestContextGetter(
|
URLRequestContextGetter::URLRequestContextGetter(
|
||||||
net::NetLog* net_log,
|
|
||||||
URLRequestContextGetter::Handle* context_handle,
|
URLRequestContextGetter::Handle* context_handle,
|
||||||
content::ProtocolHandlerMap* protocol_handlers,
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
content::URLRequestInterceptorScopedVector protocol_interceptors)
|
content::URLRequestInterceptorScopedVector protocol_interceptors)
|
||||||
: net_log_(net_log),
|
: context_handle_(context_handle),
|
||||||
context_handle_(context_handle),
|
|
||||||
url_request_context_(nullptr),
|
url_request_context_(nullptr),
|
||||||
protocol_interceptors_(std::move(protocol_interceptors)),
|
protocol_interceptors_(std::move(protocol_interceptors)),
|
||||||
context_shutting_down_(false) {
|
context_shutting_down_(false) {
|
||||||
|
@ -322,10 +311,11 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!url_request_context_) {
|
if (!url_request_context_) {
|
||||||
auto& command_line = *base::CommandLine::ForCurrentProcess();
|
|
||||||
std::unique_ptr<network::URLRequestContextBuilderMojo> builder =
|
std::unique_ptr<network::URLRequestContextBuilderMojo> builder =
|
||||||
std::make_unique<network::URLRequestContextBuilderMojo>();
|
std::make_unique<network::URLRequestContextBuilderMojo>();
|
||||||
builder->set_network_delegate(std::make_unique<AtomNetworkDelegate>());
|
auto network_delegate = std::make_unique<AtomNetworkDelegate>();
|
||||||
|
network_delegate_ = network_delegate.get();
|
||||||
|
builder->set_network_delegate(std::move(network_delegate));
|
||||||
|
|
||||||
ct_delegate_.reset(new brightray::RequireCTDelegate);
|
ct_delegate_.reset(new brightray::RequireCTDelegate);
|
||||||
auto cert_verifier = std::make_unique<AtomCertVerifier>(ct_delegate_.get());
|
auto cert_verifier = std::make_unique<AtomCertVerifier>(ct_delegate_.get());
|
||||||
|
@ -334,42 +324,13 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
builder->SetCreateHttpTransactionFactoryCallback(
|
builder->SetCreateHttpTransactionFactoryCallback(
|
||||||
base::BindOnce(&content::CreateDevToolsNetworkTransactionFactory));
|
base::BindOnce(&content::CreateDevToolsNetworkTransactionFactory));
|
||||||
|
|
||||||
std::unique_ptr<net::HostResolver> host_resolver =
|
|
||||||
net::HostResolver::CreateDefaultResolver(net_log_);
|
|
||||||
// --host-resolver-rules
|
|
||||||
if (command_line.HasSwitch(network::switches::kHostResolverRules)) {
|
|
||||||
auto remapped_resolver =
|
|
||||||
std::make_unique<net::MappedHostResolver>(std::move(host_resolver));
|
|
||||||
remapped_resolver->SetRulesFromString(command_line.GetSwitchValueASCII(
|
|
||||||
network::switches::kHostResolverRules));
|
|
||||||
host_resolver = std::move(remapped_resolver);
|
|
||||||
}
|
|
||||||
|
|
||||||
net::HttpAuthPreferences auth_preferences;
|
|
||||||
// --auth-server-whitelist
|
|
||||||
if (command_line.HasSwitch(switches::kAuthServerWhitelist)) {
|
|
||||||
auth_preferences.SetServerWhitelist(
|
|
||||||
command_line.GetSwitchValueASCII(switches::kAuthServerWhitelist));
|
|
||||||
}
|
|
||||||
|
|
||||||
// --auth-negotiate-delegate-whitelist
|
|
||||||
if (command_line.HasSwitch(switches::kAuthNegotiateDelegateWhitelist)) {
|
|
||||||
auth_preferences.SetDelegateWhitelist(command_line.GetSwitchValueASCII(
|
|
||||||
switches::kAuthNegotiateDelegateWhitelist));
|
|
||||||
}
|
|
||||||
auto http_auth_handler_factory =
|
|
||||||
net::HttpAuthHandlerRegistryFactory::CreateDefault(host_resolver.get());
|
|
||||||
http_auth_handler_factory->SetHttpAuthPreferences(net::kNegotiateAuthScheme,
|
|
||||||
&auth_preferences);
|
|
||||||
builder->SetHttpAuthHandlerFactory(std::move(http_auth_handler_factory));
|
|
||||||
builder->set_host_resolver(std::move(host_resolver));
|
|
||||||
builder->set_ct_verifier(std::make_unique<net::MultiLogCTVerifier>());
|
builder->set_ct_verifier(std::make_unique<net::MultiLogCTVerifier>());
|
||||||
|
|
||||||
network_context_ =
|
auto* network_service = content::GetNetworkServiceImpl();
|
||||||
content::GetNetworkServiceImpl()->CreateNetworkContextWithBuilder(
|
network_context_ = network_service->CreateNetworkContextWithBuilder(
|
||||||
std::move(context_handle_->main_network_context_request_),
|
std::move(context_handle_->main_network_context_request_),
|
||||||
std::move(context_handle_->main_network_context_params_),
|
std::move(context_handle_->main_network_context_params_),
|
||||||
std::move(builder), &url_request_context_);
|
std::move(builder), &url_request_context_);
|
||||||
|
|
||||||
net::TransportSecurityState* transport_security_state =
|
net::TransportSecurityState* transport_security_state =
|
||||||
url_request_context_->transport_security_state();
|
url_request_context_->transport_security_state();
|
||||||
|
|
|
@ -23,13 +23,10 @@ namespace brightray {
|
||||||
class RequireCTDelegate;
|
class RequireCTDelegate;
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
||||||
namespace net {
|
|
||||||
class NetLog;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class AtomBrowserContext;
|
class AtomBrowserContext;
|
||||||
|
class AtomNetworkDelegate;
|
||||||
class AtomURLRequestJobFactory;
|
class AtomURLRequestJobFactory;
|
||||||
class ResourceContext;
|
class ResourceContext;
|
||||||
|
|
||||||
|
@ -48,6 +45,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||||
return top_job_factory_.get();
|
return top_job_factory_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AtomNetworkDelegate* network_delegate() const { return network_delegate_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class AtomBrowserContext;
|
friend class AtomBrowserContext;
|
||||||
|
|
||||||
|
@ -88,7 +87,6 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||||
};
|
};
|
||||||
|
|
||||||
URLRequestContextGetter(
|
URLRequestContextGetter(
|
||||||
net::NetLog* net_log,
|
|
||||||
URLRequestContextGetter::Handle* context_handle,
|
URLRequestContextGetter::Handle* context_handle,
|
||||||
content::ProtocolHandlerMap* protocol_handlers,
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
content::URLRequestInterceptorScopedVector protocol_interceptors);
|
content::URLRequestInterceptorScopedVector protocol_interceptors);
|
||||||
|
@ -102,9 +100,9 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||||
std::unique_ptr<AtomURLRequestJobFactory> top_job_factory_;
|
std::unique_ptr<AtomURLRequestJobFactory> top_job_factory_;
|
||||||
std::unique_ptr<network::mojom::NetworkContext> network_context_;
|
std::unique_ptr<network::mojom::NetworkContext> network_context_;
|
||||||
|
|
||||||
net::NetLog* net_log_;
|
|
||||||
URLRequestContextGetter::Handle* context_handle_;
|
URLRequestContextGetter::Handle* context_handle_;
|
||||||
net::URLRequestContext* url_request_context_;
|
net::URLRequestContext* url_request_context_;
|
||||||
|
AtomNetworkDelegate* network_delegate_;
|
||||||
content::ProtocolHandlerMap protocol_handlers_;
|
content::ProtocolHandlerMap protocol_handlers_;
|
||||||
content::URLRequestInterceptorScopedVector protocol_interceptors_;
|
content::URLRequestInterceptorScopedVector protocol_interceptors_;
|
||||||
bool context_shutting_down_;
|
bool context_shutting_down_;
|
||||||
|
|
|
@ -37,9 +37,9 @@ bool SpecialStoragePolicy::HasSessionOnlyOrigins() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
storage::SpecialStoragePolicy::DeleteCookiePredicate
|
network::SessionCleanupCookieStore::DeleteCookiePredicate
|
||||||
SpecialStoragePolicy::CreateDeleteCookieOnExitPredicate() {
|
SpecialStoragePolicy::CreateDeleteCookieOnExitPredicate() {
|
||||||
return storage::SpecialStoragePolicy::DeleteCookiePredicate();
|
return network::SessionCleanupCookieStore::DeleteCookiePredicate();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -20,7 +20,7 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
|
||||||
bool HasIsolatedStorage(const GURL& origin) override;
|
bool HasIsolatedStorage(const GURL& origin) override;
|
||||||
bool IsStorageSessionOnly(const GURL& origin) override;
|
bool IsStorageSessionOnly(const GURL& origin) override;
|
||||||
bool HasSessionOnlyOrigins() override;
|
bool HasSessionOnlyOrigins() override;
|
||||||
storage::SpecialStoragePolicy::DeleteCookiePredicate
|
network::SessionCleanupCookieStore::DeleteCookiePredicate
|
||||||
CreateDeleteCookieOnExitPredicate() override;
|
CreateDeleteCookieOnExitPredicate() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -64,7 +64,6 @@ bool StringToAccelerator(const std::string& shortcut,
|
||||||
}
|
}
|
||||||
|
|
||||||
*accelerator = ui::Accelerator(key, modifiers);
|
*accelerator = ui::Accelerator(key, modifiers);
|
||||||
SetPlatformAccelerator(accelerator);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,6 @@ typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
|
||||||
bool StringToAccelerator(const std::string& description,
|
bool StringToAccelerator(const std::string& description,
|
||||||
ui::Accelerator* accelerator);
|
ui::Accelerator* accelerator);
|
||||||
|
|
||||||
// Set platform accelerator for the Accelerator.
|
|
||||||
void SetPlatformAccelerator(ui::Accelerator* accelerator);
|
|
||||||
|
|
||||||
// Generate a table that contains memu model's accelerators and command ids.
|
// Generate a table that contains memu model's accelerators and command ids.
|
||||||
void GenerateAcceleratorTable(AcceleratorTable* table,
|
void GenerateAcceleratorTable(AcceleratorTable* table,
|
||||||
atom::AtomMenuModel* model);
|
atom::AtomMenuModel* model);
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
// Copyright (c) 2013 GitHub, Inc.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "atom/browser/ui/accelerator_util.h"
|
|
||||||
|
|
||||||
#include "ui/base/accelerators/accelerator.h"
|
|
||||||
#import "ui/base/accelerators/platform_accelerator_cocoa.h"
|
|
||||||
#import "ui/events/keycodes/keyboard_code_conversion_mac.h"
|
|
||||||
|
|
||||||
namespace accelerator_util {
|
|
||||||
|
|
||||||
void SetPlatformAccelerator(ui::Accelerator* accelerator) {
|
|
||||||
unichar character;
|
|
||||||
unichar characterIgnoringModifiers;
|
|
||||||
|
|
||||||
NSUInteger modifiers = (accelerator->IsCtrlDown() ? NSControlKeyMask : 0) |
|
|
||||||
(accelerator->IsCmdDown() ? NSCommandKeyMask : 0) |
|
|
||||||
(accelerator->IsAltDown() ? NSAlternateKeyMask : 0) |
|
|
||||||
(accelerator->IsShiftDown() ? NSShiftKeyMask : 0);
|
|
||||||
|
|
||||||
ui::MacKeyCodeForWindowsKeyCode(accelerator->key_code(), modifiers,
|
|
||||||
&character, &characterIgnoringModifiers);
|
|
||||||
|
|
||||||
if (character != characterIgnoringModifiers) {
|
|
||||||
if (isdigit(characterIgnoringModifiers)) {
|
|
||||||
// The character is a number so lets not mutate it with the modifiers
|
|
||||||
character = characterIgnoringModifiers;
|
|
||||||
} else {
|
|
||||||
modifiers ^= NSShiftKeyMask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (character == NSDeleteFunctionKey) {
|
|
||||||
character = NSDeleteCharacter;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString* characters =
|
|
||||||
[[[NSString alloc] initWithCharacters:&character length:1] autorelease];
|
|
||||||
|
|
||||||
std::unique_ptr<ui::PlatformAccelerator> platform_accelerator(
|
|
||||||
new ui::PlatformAcceleratorCocoa(characters, modifiers));
|
|
||||||
accelerator->set_platform_accelerator(std::move(platform_accelerator));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace accelerator_util
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright (c) 2013 GitHub, Inc.
|
|
||||||
// Use of this source code is governed by the MIT license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
#include "atom/browser/ui/accelerator_util.h"
|
|
||||||
|
|
||||||
#include "ui/base/accelerators/accelerator.h"
|
|
||||||
|
|
||||||
namespace accelerator_util {
|
|
||||||
|
|
||||||
void SetPlatformAccelerator(ui::Accelerator* accelerator) {}
|
|
||||||
|
|
||||||
} // namespace accelerator_util
|
|
|
@ -239,14 +239,12 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
||||||
ui::Accelerator accelerator;
|
ui::Accelerator accelerator;
|
||||||
if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_,
|
if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_,
|
||||||
&accelerator)) {
|
&accelerator)) {
|
||||||
const ui::PlatformAcceleratorCocoa* platformAccelerator =
|
NSString* key_equivalent;
|
||||||
static_cast<const ui::PlatformAcceleratorCocoa*>(
|
NSUInteger modifier_mask;
|
||||||
accelerator.platform_accelerator());
|
GetKeyEquivalentAndModifierMaskFromAccelerator(
|
||||||
if (platformAccelerator) {
|
accelerator, &key_equivalent, &modifier_mask);
|
||||||
[item setKeyEquivalent:platformAccelerator->characters()];
|
[item setKeyEquivalent:key_equivalent];
|
||||||
[item
|
[item setKeyEquivalentModifierMask:modifier_mask];
|
||||||
setKeyEquivalentModifierMask:platformAccelerator->modifier_mask()];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set menu item's role.
|
// Set menu item's role.
|
||||||
|
|
|
@ -36,9 +36,10 @@ namespace atom {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void MediaAccessAllowed(const content::MediaStreamRequest& request,
|
void MediaAccessAllowed(const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& callback,
|
content::MediaResponseCallback callback,
|
||||||
bool allowed) {
|
bool allowed) {
|
||||||
brightray::MediaStreamDevicesController controller(request, callback);
|
brightray::MediaStreamDevicesController controller(request,
|
||||||
|
std::move(callback));
|
||||||
if (allowed)
|
if (allowed)
|
||||||
controller.TakeAction();
|
controller.TakeAction();
|
||||||
else
|
else
|
||||||
|
@ -50,7 +51,7 @@ void OnPointerLockResponse(content::WebContents* web_contents, bool allowed) {
|
||||||
web_contents->GotResponseToLockMouseRequest(allowed);
|
web_contents->GotResponseToLockMouseRequest(allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPermissionResponse(const base::Callback<void(bool)>& callback,
|
void OnPermissionResponse(base::Callback<void(bool)> callback,
|
||||||
blink::mojom::PermissionStatus status) {
|
blink::mojom::PermissionStatus status) {
|
||||||
if (status == blink::mojom::PermissionStatus::GRANTED)
|
if (status == blink::mojom::PermissionStatus::GRANTED)
|
||||||
callback.Run(true);
|
callback.Run(true);
|
||||||
|
@ -73,11 +74,11 @@ void WebContentsPermissionHelper::RequestPermission(
|
||||||
const base::DictionaryValue* details) {
|
const base::DictionaryValue* details) {
|
||||||
auto* rfh = web_contents_->GetMainFrame();
|
auto* rfh = web_contents_->GetMainFrame();
|
||||||
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
||||||
web_contents_->GetBrowserContext()->GetPermissionManager());
|
web_contents_->GetBrowserContext()->GetPermissionControllerDelegate());
|
||||||
auto origin = web_contents_->GetLastCommittedURL();
|
auto origin = web_contents_->GetLastCommittedURL();
|
||||||
permission_manager->RequestPermissionWithDetails(
|
permission_manager->RequestPermissionWithDetails(
|
||||||
permission, rfh, origin, false, details,
|
permission, rfh, origin, false, details,
|
||||||
base::Bind(&OnPermissionResponse, callback));
|
base::Bind(&OnPermissionResponse, std::move(callback)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebContentsPermissionHelper::CheckPermission(
|
bool WebContentsPermissionHelper::CheckPermission(
|
||||||
|
@ -85,7 +86,7 @@ bool WebContentsPermissionHelper::CheckPermission(
|
||||||
const base::DictionaryValue* details) const {
|
const base::DictionaryValue* details) const {
|
||||||
auto* rfh = web_contents_->GetMainFrame();
|
auto* rfh = web_contents_->GetMainFrame();
|
||||||
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
auto* permission_manager = static_cast<AtomPermissionManager*>(
|
||||||
web_contents_->GetBrowserContext()->GetPermissionManager());
|
web_contents_->GetBrowserContext()->GetPermissionControllerDelegate());
|
||||||
auto origin = web_contents_->GetLastCommittedURL();
|
auto origin = web_contents_->GetLastCommittedURL();
|
||||||
return permission_manager->CheckPermissionWithDetails(permission, rfh, origin,
|
return permission_manager->CheckPermissionWithDetails(permission, rfh, origin,
|
||||||
details);
|
details);
|
||||||
|
@ -100,8 +101,9 @@ void WebContentsPermissionHelper::RequestFullscreenPermission(
|
||||||
|
|
||||||
void WebContentsPermissionHelper::RequestMediaAccessPermission(
|
void WebContentsPermissionHelper::RequestMediaAccessPermission(
|
||||||
const content::MediaStreamRequest& request,
|
const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& response_callback) {
|
content::MediaResponseCallback response_callback) {
|
||||||
auto callback = base::Bind(&MediaAccessAllowed, request, response_callback);
|
auto callback = base::AdaptCallbackForRepeating(base::BindOnce(
|
||||||
|
&MediaAccessAllowed, request, std::move(response_callback)));
|
||||||
|
|
||||||
base::DictionaryValue details;
|
base::DictionaryValue details;
|
||||||
std::unique_ptr<base::ListValue> media_types(new base::ListValue);
|
std::unique_ptr<base::ListValue> media_types(new base::ListValue);
|
||||||
|
@ -117,8 +119,8 @@ void WebContentsPermissionHelper::RequestMediaAccessPermission(
|
||||||
|
|
||||||
// The permission type doesn't matter here, AUDIO_CAPTURE/VIDEO_CAPTURE
|
// The permission type doesn't matter here, AUDIO_CAPTURE/VIDEO_CAPTURE
|
||||||
// are presented as same type in content_converter.h.
|
// are presented as same type in content_converter.h.
|
||||||
RequestPermission(content::PermissionType::AUDIO_CAPTURE, callback, false,
|
RequestPermission(content::PermissionType::AUDIO_CAPTURE, std::move(callback),
|
||||||
&details);
|
false, &details);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentsPermissionHelper::RequestWebNotificationPermission(
|
void WebContentsPermissionHelper::RequestWebNotificationPermission(
|
||||||
|
|
|
@ -27,7 +27,7 @@ class WebContentsPermissionHelper
|
||||||
void RequestFullscreenPermission(const base::Callback<void(bool)>& callback);
|
void RequestFullscreenPermission(const base::Callback<void(bool)>& callback);
|
||||||
void RequestMediaAccessPermission(
|
void RequestMediaAccessPermission(
|
||||||
const content::MediaStreamRequest& request,
|
const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& callback);
|
content::MediaResponseCallback callback);
|
||||||
void RequestWebNotificationPermission(
|
void RequestWebNotificationPermission(
|
||||||
const base::Callback<void(bool)>& callback);
|
const base::Callback<void(bool)>& callback);
|
||||||
void RequestPointerLockPermission(bool user_gesture);
|
void RequestPointerLockPermission(bool user_gesture);
|
||||||
|
|
|
@ -329,7 +329,7 @@ void WebContentsPreferences::AppendCommandLineSwitches(
|
||||||
if (embedder) {
|
if (embedder) {
|
||||||
auto* relay = NativeWindowRelay::FromWebContents(embedder);
|
auto* relay = NativeWindowRelay::FromWebContents(embedder);
|
||||||
if (relay) {
|
if (relay) {
|
||||||
auto* window = relay->window.get();
|
auto* window = relay->GetNativeWindow();
|
||||||
if (window) {
|
if (window) {
|
||||||
const bool visible = window->IsVisible() && !window->IsMinimized();
|
const bool visible = window->IsVisible() && !window->IsMinimized();
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#ifndef ATOM_COMMON_CHROME_VERSION_H_
|
#ifndef ATOM_COMMON_CHROME_VERSION_H_
|
||||||
#define ATOM_COMMON_CHROME_VERSION_H_
|
#define ATOM_COMMON_CHROME_VERSION_H_
|
||||||
|
|
||||||
#define CHROME_VERSION_STRING "68.0.3440.128"
|
#define CHROME_VERSION_STRING "69.0.3497.106"
|
||||||
#define CHROME_VERSION "v" CHROME_VERSION_STRING
|
#define CHROME_VERSION "v" CHROME_VERSION_STRING
|
||||||
|
|
||||||
#endif // ATOM_COMMON_CHROME_VERSION_H_
|
#endif // ATOM_COMMON_CHROME_VERSION_H_
|
||||||
|
|
|
@ -90,11 +90,11 @@ v8::Local<v8::Value> Converter<scoped_refptr<net::X509Certificate>>::ToV8(
|
||||||
issuer_intermediates.reserve(intermediate_buffers.size() - 1);
|
issuer_intermediates.reserve(intermediate_buffers.size() - 1);
|
||||||
for (size_t i = 1; i < intermediate_buffers.size(); ++i) {
|
for (size_t i = 1; i < intermediate_buffers.size(); ++i) {
|
||||||
issuer_intermediates.push_back(
|
issuer_intermediates.push_back(
|
||||||
net::x509_util::DupCryptoBuffer(intermediate_buffers[i].get()));
|
bssl::UpRef(intermediate_buffers[i].get()));
|
||||||
}
|
}
|
||||||
const scoped_refptr<net::X509Certificate>& issuer_cert =
|
const scoped_refptr<net::X509Certificate>& issuer_cert =
|
||||||
net::X509Certificate::CreateFromBuffer(
|
net::X509Certificate::CreateFromBuffer(
|
||||||
net::x509_util::DupCryptoBuffer(intermediate_buffers[0].get()),
|
bssl::UpRef(intermediate_buffers[0].get()),
|
||||||
std::move(issuer_intermediates));
|
std::move(issuer_intermediates));
|
||||||
dict.Set("issuerCert", issuer_cert);
|
dict.Set("issuerCert", issuer_cert);
|
||||||
}
|
}
|
||||||
|
@ -119,11 +119,9 @@ bool Converter<scoped_refptr<net::X509Certificate>>::FromV8(
|
||||||
scoped_refptr<net::X509Certificate> issuer_cert;
|
scoped_refptr<net::X509Certificate> issuer_cert;
|
||||||
if (dict.Get("issuerCert", &issuer_cert)) {
|
if (dict.Get("issuerCert", &issuer_cert)) {
|
||||||
std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
|
std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
|
||||||
intermediates.push_back(
|
intermediates.push_back(bssl::UpRef(issuer_cert->cert_buffer()));
|
||||||
net::x509_util::DupCryptoBuffer(issuer_cert->cert_buffer()));
|
|
||||||
auto cert = net::X509Certificate::CreateFromBuffer(
|
auto cert = net::X509Certificate::CreateFromBuffer(
|
||||||
net::x509_util::DupCryptoBuffer(leaf_cert->cert_buffer()),
|
bssl::UpRef(leaf_cert->cert_buffer()), std::move(intermediates));
|
||||||
std::move(intermediates));
|
|
||||||
if (!cert)
|
if (!cert)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,13 @@ void BrowserMainParts::InitializeFeatureList() {
|
||||||
enable_features += std::string(",") + features::kSharedArrayBuffer.name;
|
enable_features += std::string(",") + features::kSharedArrayBuffer.name;
|
||||||
auto disable_features =
|
auto disable_features =
|
||||||
cmd_line->GetSwitchValueASCII(switches::kDisableFeatures);
|
cmd_line->GetSwitchValueASCII(switches::kDisableFeatures);
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
// Disable the V2 sandbox on macOS.
|
||||||
|
// Chromium is going to use the system sandbox API of macOS for the sandbox
|
||||||
|
// implmentation, we may have to deprecate --mixed-sandbox for macOS once
|
||||||
|
// Chromium drops support for the old sandbox implmentation.
|
||||||
|
disable_features += std::string(",") + features::kMacV2Sandbox.name;
|
||||||
|
#endif
|
||||||
auto feature_list = std::make_unique<base::FeatureList>();
|
auto feature_list = std::make_unique<base::FeatureList>();
|
||||||
feature_list->InitializeFromCommandLine(enable_features, disable_features);
|
feature_list->InitializeFromCommandLine(enable_features, disable_features);
|
||||||
base::FeatureList::SetInstance(std::move(feature_list));
|
base::FeatureList::SetInstance(std::move(feature_list));
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "brightray/browser/media/media_stream_devices_controller.h"
|
#include "brightray/browser/media/media_stream_devices_controller.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "brightray/browser/media/media_capture_devices_dispatcher.h"
|
#include "brightray/browser/media/media_capture_devices_dispatcher.h"
|
||||||
#include "content/public/browser/desktop_media_id.h"
|
#include "content/public/browser/desktop_media_id.h"
|
||||||
|
@ -27,9 +28,9 @@ bool HasAnyAvailableDevice() {
|
||||||
|
|
||||||
MediaStreamDevicesController::MediaStreamDevicesController(
|
MediaStreamDevicesController::MediaStreamDevicesController(
|
||||||
const content::MediaStreamRequest& request,
|
const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& callback)
|
content::MediaResponseCallback callback)
|
||||||
: request_(request),
|
: request_(request),
|
||||||
callback_(callback),
|
callback_(std::move(callback)),
|
||||||
// For MEDIA_OPEN_DEVICE requests (Pepper) we always request both webcam
|
// For MEDIA_OPEN_DEVICE requests (Pepper) we always request both webcam
|
||||||
// and microphone to avoid popping two infobars.
|
// and microphone to avoid popping two infobars.
|
||||||
microphone_requested_(
|
microphone_requested_(
|
||||||
|
@ -41,9 +42,9 @@ MediaStreamDevicesController::MediaStreamDevicesController(
|
||||||
|
|
||||||
MediaStreamDevicesController::~MediaStreamDevicesController() {
|
MediaStreamDevicesController::~MediaStreamDevicesController() {
|
||||||
if (!callback_.is_null()) {
|
if (!callback_.is_null()) {
|
||||||
callback_.Run(content::MediaStreamDevices(),
|
std::move(callback_).Run(content::MediaStreamDevices(),
|
||||||
content::MEDIA_DEVICE_INVALID_STATE,
|
content::MEDIA_DEVICE_INVALID_STATE,
|
||||||
std::unique_ptr<content::MediaStreamUI>());
|
std::unique_ptr<content::MediaStreamUI>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,18 +141,14 @@ void MediaStreamDevicesController::Accept() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content::MediaResponseCallback cb = callback_;
|
std::move(callback_).Run(devices, content::MEDIA_DEVICE_OK,
|
||||||
callback_.Reset();
|
std::unique_ptr<content::MediaStreamUI>());
|
||||||
cb.Run(devices, content::MEDIA_DEVICE_OK,
|
|
||||||
std::unique_ptr<content::MediaStreamUI>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaStreamDevicesController::Deny(
|
void MediaStreamDevicesController::Deny(
|
||||||
content::MediaStreamRequestResult result) {
|
content::MediaStreamRequestResult result) {
|
||||||
content::MediaResponseCallback cb = callback_;
|
std::move(callback_).Run(content::MediaStreamDevices(), result,
|
||||||
callback_.Reset();
|
std::unique_ptr<content::MediaStreamUI>());
|
||||||
cb.Run(content::MediaStreamDevices(), result,
|
|
||||||
std::unique_ptr<content::MediaStreamUI>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaStreamDevicesController::HandleUserMediaRequest() {
|
void MediaStreamDevicesController::HandleUserMediaRequest() {
|
||||||
|
@ -185,12 +182,10 @@ void MediaStreamDevicesController::HandleUserMediaRequest() {
|
||||||
content::MEDIA_DESKTOP_VIDEO_CAPTURE, screen_id.ToString(), "Screen"));
|
content::MEDIA_DESKTOP_VIDEO_CAPTURE, screen_id.ToString(), "Screen"));
|
||||||
}
|
}
|
||||||
|
|
||||||
content::MediaResponseCallback cb = callback_;
|
std::move(callback_).Run(devices,
|
||||||
callback_.Reset();
|
devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE
|
||||||
cb.Run(devices,
|
: content::MEDIA_DEVICE_OK,
|
||||||
devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE
|
std::unique_ptr<content::MediaStreamUI>());
|
||||||
: content::MEDIA_DEVICE_OK,
|
|
||||||
std::unique_ptr<content::MediaStreamUI>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace brightray {
|
||||||
class MediaStreamDevicesController {
|
class MediaStreamDevicesController {
|
||||||
public:
|
public:
|
||||||
MediaStreamDevicesController(const content::MediaStreamRequest& request,
|
MediaStreamDevicesController(const content::MediaStreamRequest& request,
|
||||||
const content::MediaResponseCallback& callback);
|
content::MediaResponseCallback callback);
|
||||||
|
|
||||||
virtual ~MediaStreamDevicesController();
|
virtual ~MediaStreamDevicesController();
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "brightray/browser/notification_presenter.h"
|
#include "brightray/browser/notification_presenter.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "brightray/browser/notification.h"
|
#include "brightray/browser/notification.h"
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "brightray/browser/notification_delegate.h"
|
#include "brightray/browser/notification_delegate.h"
|
||||||
#include "brightray/browser/notification_presenter.h"
|
#include "brightray/browser/notification_presenter.h"
|
||||||
#include "content/public/browser/notification_event_dispatcher.h"
|
#include "content/public/browser/notification_event_dispatcher.h"
|
||||||
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/common/notification_resources.h"
|
#include "content/public/common/notification_resources.h"
|
||||||
#include "content/public/common/platform_notification_data.h"
|
#include "content/public/common/platform_notification_data.h"
|
||||||
#include "third_party/skia/include/core/SkBitmap.h"
|
#include "third_party/skia/include/core/SkBitmap.h"
|
||||||
|
@ -49,7 +50,7 @@ class NotificationDelegateImpl final : public brightray::NotificationDelegate {
|
||||||
|
|
||||||
void NotificationClick() override {
|
void NotificationClick() override {
|
||||||
content::NotificationEventDispatcher::GetInstance()
|
content::NotificationEventDispatcher::GetInstance()
|
||||||
->DispatchNonPersistentClickEvent(notification_id_);
|
->DispatchNonPersistentClickEvent(notification_id_, base::DoNothing());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationClosed() override {
|
void NotificationClosed() override {
|
||||||
|
@ -72,29 +73,12 @@ class NotificationDelegateImpl final : public brightray::NotificationDelegate {
|
||||||
|
|
||||||
PlatformNotificationService::PlatformNotificationService(
|
PlatformNotificationService::PlatformNotificationService(
|
||||||
BrowserClient* browser_client)
|
BrowserClient* browser_client)
|
||||||
: browser_client_(browser_client), render_process_id_(-1) {}
|
: browser_client_(browser_client) {}
|
||||||
|
|
||||||
PlatformNotificationService::~PlatformNotificationService() {}
|
PlatformNotificationService::~PlatformNotificationService() {}
|
||||||
|
|
||||||
blink::mojom::PermissionStatus
|
|
||||||
PlatformNotificationService::CheckPermissionOnUIThread(
|
|
||||||
content::BrowserContext* browser_context,
|
|
||||||
const GURL& origin,
|
|
||||||
int render_process_id) {
|
|
||||||
render_process_id_ = render_process_id;
|
|
||||||
return blink::mojom::PermissionStatus::GRANTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
blink::mojom::PermissionStatus
|
|
||||||
PlatformNotificationService::CheckPermissionOnIOThread(
|
|
||||||
content::ResourceContext* resource_context,
|
|
||||||
const GURL& origin,
|
|
||||||
int render_process_id) {
|
|
||||||
render_process_id_ = render_process_id;
|
|
||||||
return blink::mojom::PermissionStatus::GRANTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlatformNotificationService::DisplayNotification(
|
void PlatformNotificationService::DisplayNotification(
|
||||||
|
content::RenderProcessHost* render_process_host,
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const std::string& notification_id,
|
const std::string& notification_id,
|
||||||
const GURL& origin,
|
const GURL& origin,
|
||||||
|
@ -108,9 +92,10 @@ void PlatformNotificationService::DisplayNotification(
|
||||||
auto notification = presenter->CreateNotification(delegate, notification_id);
|
auto notification = presenter->CreateNotification(delegate, notification_id);
|
||||||
if (notification) {
|
if (notification) {
|
||||||
browser_client_->WebNotificationAllowed(
|
browser_client_->WebNotificationAllowed(
|
||||||
render_process_id_, base::Bind(&OnWebNotificationAllowed, notification,
|
render_process_host->GetID(),
|
||||||
notification_resources.notification_icon,
|
base::Bind(&OnWebNotificationAllowed, notification,
|
||||||
notification_data));
|
notification_resources.notification_icon,
|
||||||
|
notification_data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,4 +124,10 @@ void PlatformNotificationService::GetDisplayedNotifications(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const DisplayedNotificationsCallback& callback) {}
|
const DisplayedNotificationsCallback& callback) {}
|
||||||
|
|
||||||
|
int64_t PlatformNotificationService::ReadNextPersistentNotificationId(
|
||||||
|
content::BrowserContext* browser_context) {
|
||||||
|
// Electron doesn't support persistent notifications.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -23,15 +23,8 @@ class PlatformNotificationService
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// content::PlatformNotificationService:
|
// content::PlatformNotificationService:
|
||||||
blink::mojom::PermissionStatus CheckPermissionOnUIThread(
|
|
||||||
content::BrowserContext* browser_context,
|
|
||||||
const GURL& origin,
|
|
||||||
int render_process_id) override;
|
|
||||||
blink::mojom::PermissionStatus CheckPermissionOnIOThread(
|
|
||||||
content::ResourceContext* resource_context,
|
|
||||||
const GURL& origin,
|
|
||||||
int render_process_id) override;
|
|
||||||
void DisplayNotification(
|
void DisplayNotification(
|
||||||
|
content::RenderProcessHost* render_process_host,
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const std::string& notification_id,
|
const std::string& notification_id,
|
||||||
const GURL& origin,
|
const GURL& origin,
|
||||||
|
@ -51,10 +44,11 @@ class PlatformNotificationService
|
||||||
void GetDisplayedNotifications(
|
void GetDisplayedNotifications(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const DisplayedNotificationsCallback& callback) override;
|
const DisplayedNotificationsCallback& callback) override;
|
||||||
|
int64_t ReadNextPersistentNotificationId(
|
||||||
|
content::BrowserContext* browser_context) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BrowserClient* browser_client_;
|
BrowserClient* browser_client_;
|
||||||
int render_process_id_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(PlatformNotificationService);
|
DISALLOW_COPY_AND_ASSIGN(PlatformNotificationService);
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,14 +49,14 @@ bool WebUIControllerFactory::UseWebUIBindingsForURL(
|
||||||
return UseWebUIForURL(browser_context, url);
|
return UseWebUIForURL(browser_context, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
content::WebUIController* WebUIControllerFactory::CreateWebUIControllerForURL(
|
std::unique_ptr<content::WebUIController>
|
||||||
content::WebUI* web_ui,
|
WebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
|
||||||
const GURL& url) const {
|
const GURL& url) const {
|
||||||
if (url.host() == kChromeUIDevToolsBundledHost) {
|
if (url.host() == kChromeUIDevToolsBundledHost) {
|
||||||
auto* browser_context = web_ui->GetWebContents()->GetBrowserContext();
|
auto* browser_context = web_ui->GetWebContents()->GetBrowserContext();
|
||||||
return new DevToolsUI(browser_context, web_ui);
|
return std::make_unique<DevToolsUI>(browser_context, web_ui);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return std::unique_ptr<content::WebUIController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#ifndef BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
|
#ifndef BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
|
||||||
#define BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
|
#define BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/public/browser/web_ui.h"
|
#include "content/public/browser/web_ui.h"
|
||||||
#include "content/public/browser/web_ui_controller_factory.h"
|
#include "content/public/browser/web_ui_controller_factory.h"
|
||||||
|
@ -31,7 +33,7 @@ class WebUIControllerFactory : public content::WebUIControllerFactory {
|
||||||
const GURL& url) const override;
|
const GURL& url) const override;
|
||||||
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
|
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
|
||||||
const GURL& url) const override;
|
const GURL& url) const override;
|
||||||
content::WebUIController* CreateWebUIControllerForURL(
|
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
|
||||||
content::WebUI* web_ui,
|
content::WebUI* web_ui,
|
||||||
const GURL& url) const override;
|
const GURL& url) const override;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@ is_component_build = false
|
||||||
is_official_build = true
|
is_official_build = true
|
||||||
strip_debug_info = true
|
strip_debug_info = true
|
||||||
|
|
||||||
|
# FIXME(jeremy): this is just for testing on CI.
|
||||||
|
dcheck_always_on = true
|
||||||
|
|
||||||
# This may be guarded behind is_chrome_branded alongside
|
# This may be guarded behind is_chrome_branded alongside
|
||||||
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
|
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
|
||||||
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
|
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
|
||||||
|
|
|
@ -41,7 +41,8 @@ def main(argv):
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
|
execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
|
||||||
else:
|
else:
|
||||||
with zipfile.ZipFile(dist_zip, 'w', zipfile.ZIP_DEFLATED) as z:
|
with zipfile.ZipFile(dist_zip, mode='w', compression=zipfile.ZIP_DEFLATED,
|
||||||
|
allowZip64=True) as z:
|
||||||
for dep in dist_files:
|
for dep in dist_files:
|
||||||
if skip_path(dep):
|
if skip_path(dep):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -8,7 +8,7 @@ declare_args() {
|
||||||
# Allow running Electron as a node binary.
|
# Allow running Electron as a node binary.
|
||||||
enable_run_as_node = true
|
enable_run_as_node = true
|
||||||
|
|
||||||
enable_osr = true
|
enable_osr = false
|
||||||
|
|
||||||
enable_view_api = false
|
enable_view_api = false
|
||||||
|
|
||||||
|
|
|
@ -608,8 +608,10 @@ bool PdfConverterUtilityProcessHostClient::OnMessageReceived(
|
||||||
ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, OnPageCount)
|
ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, OnPageCount)
|
||||||
IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
|
IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
|
||||||
OnPageDone)
|
OnPageDone)
|
||||||
|
#if 0
|
||||||
IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PreCacheFontCharacters,
|
IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PreCacheFontCharacters,
|
||||||
OnPreCacheFontCharacters)
|
OnPreCacheFontCharacters)
|
||||||
|
#endif
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
IPC_END_MESSAGE_MAP()
|
IPC_END_MESSAGE_MAP()
|
||||||
return handled;
|
return handled;
|
||||||
|
|
|
@ -89,9 +89,11 @@ IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
|
||||||
// Request that the given font characters be loaded by the browser so it's
|
// Request that the given font characters be loaded by the browser so it's
|
||||||
// cached by the OS. Please see
|
// cached by the OS. Please see
|
||||||
// PdfToEmfUtilityProcessHostClient::OnPreCacheFontCharacters for details.
|
// PdfToEmfUtilityProcessHostClient::OnPreCacheFontCharacters for details.
|
||||||
|
#if 0
|
||||||
IPC_SYNC_MESSAGE_CONTROL2_0(ChromeUtilityHostMsg_PreCacheFontCharacters,
|
IPC_SYNC_MESSAGE_CONTROL2_0(ChromeUtilityHostMsg_PreCacheFontCharacters,
|
||||||
LOGFONT /* font_data */,
|
LOGFONT /* font_data */,
|
||||||
base::string16 /* characters */)
|
base::string16 /* characters */)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Tell the utility process to start rendering the given PDF into a metafile.
|
// Tell the utility process to start rendering the given PDF into a metafile.
|
||||||
// Utility process would be alive until
|
// Utility process would be alive until
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
#include "third_party/blink/public/web/web_console_message.h"
|
#include "third_party/blink/public/web/web_console_message.h"
|
||||||
#include "third_party/blink/public/web/web_document.h"
|
#include "third_party/blink/public/web/web_document.h"
|
||||||
#include "third_party/blink/public/web/web_element.h"
|
#include "third_party/blink/public/web/web_element.h"
|
||||||
#include "third_party/blink/public/web/web_frame_client.h"
|
|
||||||
#include "third_party/blink/public/web/web_frame_widget.h"
|
#include "third_party/blink/public/web/web_frame_widget.h"
|
||||||
#include "third_party/blink/public/web/web_local_frame.h"
|
#include "third_party/blink/public/web/web_local_frame.h"
|
||||||
|
#include "third_party/blink/public/web/web_local_frame_client.h"
|
||||||
#include "third_party/blink/public/web/web_plugin.h"
|
#include "third_party/blink/public/web/web_plugin.h"
|
||||||
#include "third_party/blink/public/web/web_plugin_document.h"
|
#include "third_party/blink/public/web/web_plugin_document.h"
|
||||||
#include "third_party/blink/public/web/web_print_params.h"
|
#include "third_party/blink/public/web/web_print_params.h"
|
||||||
|
@ -342,7 +342,7 @@ float PrintWebViewHelper::RenderPageContent(blink::WebLocalFrame* frame,
|
||||||
const gfx::Rect& canvas_area,
|
const gfx::Rect& canvas_area,
|
||||||
const gfx::Rect& content_area,
|
const gfx::Rect& content_area,
|
||||||
double scale_factor,
|
double scale_factor,
|
||||||
blink::WebCanvas* canvas) {
|
cc::PaintCanvas* canvas) {
|
||||||
cc::PaintCanvasAutoRestore auto_restore(canvas, true);
|
cc::PaintCanvasAutoRestore auto_restore(canvas, true);
|
||||||
canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
|
canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
|
||||||
(content_area.y() - canvas_area.y()) / scale_factor);
|
(content_area.y() - canvas_area.y()) / scale_factor);
|
||||||
|
@ -352,7 +352,8 @@ float PrintWebViewHelper::RenderPageContent(blink::WebLocalFrame* frame,
|
||||||
// Class that calls the Begin and End print functions on the frame and changes
|
// Class that calls the Begin and End print functions on the frame and changes
|
||||||
// the size of the view temporarily to support full page printing..
|
// the size of the view temporarily to support full page printing..
|
||||||
class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
||||||
public blink::WebFrameClient {
|
public blink::WebLocalFrameClient,
|
||||||
|
public blink::WebWidgetClient {
|
||||||
public:
|
public:
|
||||||
PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params,
|
PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params,
|
||||||
blink::WebLocalFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
|
@ -368,6 +369,8 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
||||||
// Prepares frame for printing.
|
// Prepares frame for printing.
|
||||||
void StartPrinting();
|
void StartPrinting();
|
||||||
|
|
||||||
|
blink::WebWidgetClient* WidgetClient() override { return this; }
|
||||||
|
|
||||||
blink::WebLocalFrame* frame() { return frame_.GetFrame(); }
|
blink::WebLocalFrame* frame() { return frame_.GetFrame(); }
|
||||||
|
|
||||||
const blink::WebNode& node() const { return node_to_print_; }
|
const blink::WebNode& node() const { return node_to_print_; }
|
||||||
|
@ -386,7 +389,7 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
||||||
void DidStopLoading() override;
|
void DidStopLoading() override;
|
||||||
bool AllowsBrokenNullLayerTreeView() const override;
|
bool AllowsBrokenNullLayerTreeView() const override;
|
||||||
|
|
||||||
// blink::WebFrameClient:
|
// blink::WebLocalFrameClient:
|
||||||
blink::WebLocalFrame* CreateChildFrame(
|
blink::WebLocalFrame* CreateChildFrame(
|
||||||
blink::WebLocalFrame* parent,
|
blink::WebLocalFrame* parent,
|
||||||
blink::WebTreeScopeType scope,
|
blink::WebTreeScopeType scope,
|
||||||
|
@ -512,7 +515,7 @@ void PrepareFrameAndViewForPrint::CopySelection(
|
||||||
prefs.javascript_enabled = false;
|
prefs.javascript_enabled = false;
|
||||||
|
|
||||||
blink::WebView* web_view = blink::WebView::Create(
|
blink::WebView* web_view = blink::WebView::Create(
|
||||||
this, blink::mojom::PageVisibilityState::kVisible, nullptr);
|
this, this, blink::mojom::PageVisibilityState::kVisible, nullptr);
|
||||||
owns_web_view_ = true;
|
owns_web_view_ = true;
|
||||||
content::RenderView::ApplyWebPreferences(prefs, web_view);
|
content::RenderView::ApplyWebPreferences(prefs, web_view);
|
||||||
blink::WebLocalFrame* main_frame =
|
blink::WebLocalFrame* main_frame =
|
||||||
|
@ -523,7 +526,7 @@ void PrepareFrameAndViewForPrint::CopySelection(
|
||||||
|
|
||||||
// When loading is done this will call DidStopLoading() and that will do the
|
// When loading is done this will call DidStopLoading() and that will do the
|
||||||
// actual printing.
|
// actual printing.
|
||||||
frame()->LoadRequest(blink::WebURLRequest(GURL(url_str)));
|
frame()->StartNavigation(blink::WebURLRequest(GURL(url_str)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrepareFrameAndViewForPrint::AllowsBrokenNullLayerTreeView() const {
|
bool PrepareFrameAndViewForPrint::AllowsBrokenNullLayerTreeView() const {
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "content/public/renderer/render_frame_observer.h"
|
#include "content/public/renderer/render_frame_observer.h"
|
||||||
#include "content/public/renderer/render_frame_observer_tracker.h"
|
#include "content/public/renderer/render_frame_observer_tracker.h"
|
||||||
#include "printing/pdf_metafile_skia.h"
|
#include "printing/pdf_metafile_skia.h"
|
||||||
#include "third_party/blink/public/platform/web_canvas.h"
|
|
||||||
#include "third_party/blink/public/web/web_local_frame.h"
|
#include "third_party/blink/public/web/web_local_frame.h"
|
||||||
#include "third_party/blink/public/web/web_node.h"
|
#include "third_party/blink/public/web/web_node.h"
|
||||||
#include "third_party/blink/public/web/web_print_params.h"
|
#include "third_party/blink/public/web/web_print_params.h"
|
||||||
|
@ -35,6 +34,10 @@ namespace blink {
|
||||||
class WebView;
|
class WebView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace cc {
|
||||||
|
class PaintCanvas;
|
||||||
|
}
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
struct PageSizeMargins;
|
struct PageSizeMargins;
|
||||||
|
@ -217,7 +220,7 @@ class PrintWebViewHelper
|
||||||
const gfx::Rect& canvas_area,
|
const gfx::Rect& canvas_area,
|
||||||
const gfx::Rect& content_area,
|
const gfx::Rect& content_area,
|
||||||
double scale_factor,
|
double scale_factor,
|
||||||
blink::WebCanvas* canvas);
|
cc::PaintCanvas* canvas);
|
||||||
|
|
||||||
// Helper methods -----------------------------------------------------------
|
// Helper methods -----------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/mac/scoped_nsautorelease_pool.h"
|
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||||
#include "base/metrics/histogram.h"
|
#include "base/metrics/histogram.h"
|
||||||
|
#include "cc/paint/paint_canvas.h"
|
||||||
#include "chrome/common/print_messages.h"
|
#include "chrome/common/print_messages.h"
|
||||||
#include "printing/metafile_skia_wrapper.h"
|
#include "printing/metafile_skia_wrapper.h"
|
||||||
#include "printing/page_size_margins.h"
|
#include "printing/page_size_margins.h"
|
||||||
#include "third_party/blink/public/platform/web_canvas.h"
|
|
||||||
#include "third_party/blink/public/web/web_local_frame.h"
|
#include "third_party/blink/public/web/web_local_frame.h"
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
@ -117,7 +117,7 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
|
||||||
|
|
||||||
MetafileSkiaWrapper::SetMetafileOnCanvas(canvas, metafile);
|
MetafileSkiaWrapper::SetMetafileOnCanvas(canvas, metafile);
|
||||||
RenderPageContent(frame, page_number, canvas_area, content_area,
|
RenderPageContent(frame, page_number, canvas_area, content_area,
|
||||||
scale_factor, static_cast<blink::WebCanvas*>(canvas));
|
scale_factor, static_cast<cc::PaintCanvas*>(canvas));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done printing. Close the device context to retrieve the compiled metafile.
|
// Done printing. Close the device context to retrieve the compiled metafile.
|
||||||
|
|
|
@ -32,8 +32,10 @@ void ReleaseProcessIfNeeded() {
|
||||||
void PreCacheFontCharacters(const LOGFONT* logfont,
|
void PreCacheFontCharacters(const LOGFONT* logfont,
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
size_t text_length) {
|
size_t text_length) {
|
||||||
|
#if 0
|
||||||
Send(new ChromeUtilityHostMsg_PreCacheFontCharacters(
|
Send(new ChromeUtilityHostMsg_PreCacheFontCharacters(
|
||||||
*logfont, base::string16(text, text_length)));
|
*logfont, base::string16(text, text_length)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -54,4 +54,7 @@ component("pepper_flash") {
|
||||||
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
|
"//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
if (is_linux) {
|
||||||
|
deps += [ "//components/services/font/public/cpp" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { app, BrowserWindow, systemPreferences } = require('electron')
|
const { app, BrowserWindow } = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
let mainWindow = null
|
let mainWindow = null
|
||||||
|
@ -11,10 +11,6 @@ app.on('window-all-closed', () => {
|
||||||
exports.load = async (appUrl) => {
|
exports.load = async (appUrl) => {
|
||||||
await app.whenReady()
|
await app.whenReady()
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
systemPreferences.startAppLevelAppearanceTrackingOS()
|
|
||||||
}
|
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
width: 900,
|
width: 900,
|
||||||
height: 600,
|
height: 600,
|
||||||
|
|
|
@ -912,7 +912,7 @@ Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Fe
|
||||||
Returns `Promise`
|
Returns `Promise`
|
||||||
|
|
||||||
For `infoType` equal to `complete`:
|
For `infoType` equal to `complete`:
|
||||||
Promise is fulfilled with `Object` containing all the GPU Information as in [chromium's GPUInfo object](https://chromium.googlesource.com/chromium/src.git/+/66.0.3359.181/gpu/config/gpu_info.cc). This includes the version and driver information that's shown on `chrome://gpu` page.
|
Promise is fulfilled with `Object` containing all the GPU Information as in [chromium's GPUInfo object](https://chromium.googlesource.com/chromium/src.git/+/69.0.3497.106/gpu/config/gpu_info.cc). This includes the version and driver information that's shown on `chrome://gpu` page.
|
||||||
|
|
||||||
For `infoType` equal to `basic`:
|
For `infoType` equal to `basic`:
|
||||||
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
|
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
|
||||||
|
|
|
@ -34,6 +34,14 @@ app.releaseSingleInstance()
|
||||||
app.releaseSingleInstanceLock()
|
app.releaseSingleInstanceLock()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `app.getGPUInfo`
|
||||||
|
|
||||||
|
```js
|
||||||
|
app.getGPUInfo('complete')
|
||||||
|
// Now behaves the same with `basic` on macOS
|
||||||
|
app.getGPUInfo('basic')
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
# Breaking API Changes (3.0)
|
# Breaking API Changes (3.0)
|
||||||
|
|
||||||
|
|
|
@ -201,8 +201,8 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
||||||
* `enableLargerThanScreen` Boolean (optional) - Enable the window to be resized larger
|
* `enableLargerThanScreen` Boolean (optional) - Enable the window to be resized larger
|
||||||
than screen. Default is `false`.
|
than screen. Default is `false`.
|
||||||
* `backgroundColor` String (optional) - Window's background color as a hexadecimal value,
|
* `backgroundColor` String (optional) - Window's background color as a hexadecimal value,
|
||||||
like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha is supported). Default is
|
like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha is supported if
|
||||||
`#FFF` (white). If `transparent` is set to `true`, only values with transparent (`#00-------`) or opaque (`#FF-----`) alpha values are respected.
|
`transparent` is set to `true`). Default is `#FFF` (white).
|
||||||
* `hasShadow` Boolean (optional) - Whether window should have a shadow. This is only
|
* `hasShadow` Boolean (optional) - Whether window should have a shadow. This is only
|
||||||
implemented on macOS. Default is `true`.
|
implemented on macOS. Default is `true`.
|
||||||
* `opacity` Number (optional) - Set the initial opacity of the window, between 0.0 (fully
|
* `opacity` Number (optional) - Set the initial opacity of the window, between 0.0 (fully
|
||||||
|
@ -864,6 +864,15 @@ height areas you have within the overall content view.
|
||||||
Calling this function with a value of `0` will remove any previously set aspect
|
Calling this function with a value of `0` will remove any previously set aspect
|
||||||
ratios.
|
ratios.
|
||||||
|
|
||||||
|
#### `win.setBackgroundColor(backgroundColor)`
|
||||||
|
|
||||||
|
* `backgroundColor` String - Window's background color as a hexadecimal value,
|
||||||
|
like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha is supported if `transparent`
|
||||||
|
is `true`). Default is `#FFF` (white).
|
||||||
|
|
||||||
|
Sets the background color of the window. See [Setting
|
||||||
|
`backgroundColor`](#setting-backgroundcolor).
|
||||||
|
|
||||||
#### `win.previewFile(path[, displayName])` _macOS_
|
#### `win.previewFile(path[, displayName])` _macOS_
|
||||||
|
|
||||||
* `path` String - The absolute path to the file to preview with QuickLook. This
|
* `path` String - The absolute path to the file to preview with QuickLook. This
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
|
<!-- The Resource ids for messages start from 31750 and for includes
|
||||||
|
it starts from 31950, make sure they don't overlap when the limit
|
||||||
|
exceeds in //tools/gritsettings/resource_ids -->
|
||||||
|
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false"
|
||||||
|
source_lang_id="en">
|
||||||
<outputs>
|
<outputs>
|
||||||
<output filename="grit/electron_resources.h" type="rc_header">
|
<output filename="grit/electron_resources.h" type="rc_header">
|
||||||
<emit emit_type='prepend'></emit>
|
<emit emit_type='prepend'></emit>
|
||||||
</output>
|
</output>
|
||||||
<output filename="electron_resources.pak" type="data_package" />
|
<output filename="electron_resources.pak" type="data_package" />
|
||||||
</outputs>
|
</outputs>
|
||||||
<release seq="1">
|
<release seq="1" allow_pseudo="false">
|
||||||
|
<messages fallback_to_english="true">
|
||||||
|
<!-- TODO(deepak1556): Add translations,
|
||||||
|
check https://www.chromium.org/developers/design-documents/ui-localization -->
|
||||||
|
<part file="electron_strings.grdp" />
|
||||||
|
</messages>
|
||||||
<includes>
|
<includes>
|
||||||
<include name="IDR_ELECTRON_CONTENT_BROWSER_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_browser_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
<include name="IDR_ELECTRON_CONTENT_BROWSER_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_browser_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||||
<include name="IDR_ELECTRON_CONTENT_PACKAGED_SERVICES_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_packaged_services_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
<include name="IDR_ELECTRON_CONTENT_PACKAGED_SERVICES_MANIFEST_OVERLAY" file="${target_gen_dir}\electron_content_packaged_services_manifest_overlay.json" use_base_dir="false" type="BINDATA" />
|
||||||
|
|
15
electron_strings.grdp
Normal file
15
electron_strings.grdp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<grit-part>
|
||||||
|
<!-- Proxy Resolver Service -->
|
||||||
|
<message name="IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME" desc="The name of the utility process used for out-of-process V8 proxy resolution.">
|
||||||
|
V8 Proxy Resolver
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<!-- Desktop Capturer API -->
|
||||||
|
<message name="IDS_DESKTOP_MEDIA_PICKER_SINGLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there is only one monitor.">
|
||||||
|
Entire screen
|
||||||
|
</message>
|
||||||
|
<message name="IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there are multiple monitors.">
|
||||||
|
{SCREEN_INDEX, plural, =1{Screen #} other{Screen #}}
|
||||||
|
</message>
|
||||||
|
</grit-part>
|
|
@ -112,6 +112,7 @@ filenames = {
|
||||||
"atom/app/atom_content_client.h",
|
"atom/app/atom_content_client.h",
|
||||||
"atom/app/atom_main_delegate.cc",
|
"atom/app/atom_main_delegate.cc",
|
||||||
"atom/app/atom_main_delegate.h",
|
"atom/app/atom_main_delegate.h",
|
||||||
|
"atom/app/atom_main_delegate_mac.h",
|
||||||
"atom/app/atom_main_delegate_mac.mm",
|
"atom/app/atom_main_delegate_mac.mm",
|
||||||
"atom/app/command_line_args.cc",
|
"atom/app/command_line_args.cc",
|
||||||
"atom/app/command_line_args.h",
|
"atom/app/command_line_args.h",
|
||||||
|
@ -230,8 +231,6 @@ filenames = {
|
||||||
"atom/browser/atom_speech_recognition_manager_delegate.h",
|
"atom/browser/atom_speech_recognition_manager_delegate.h",
|
||||||
"atom/browser/atom_web_ui_controller_factory.cc",
|
"atom/browser/atom_web_ui_controller_factory.cc",
|
||||||
"atom/browser/atom_web_ui_controller_factory.h",
|
"atom/browser/atom_web_ui_controller_factory.h",
|
||||||
"atom/browser/bridge_task_runner.cc",
|
|
||||||
"atom/browser/bridge_task_runner.h",
|
|
||||||
"atom/browser/browser.cc",
|
"atom/browser/browser.cc",
|
||||||
"atom/browser/browser.h",
|
"atom/browser/browser.h",
|
||||||
"atom/browser/browser_linux.cc",
|
"atom/browser/browser_linux.cc",
|
||||||
|
@ -336,8 +335,6 @@ filenames = {
|
||||||
"atom/browser/special_storage_policy.h",
|
"atom/browser/special_storage_policy.h",
|
||||||
"atom/browser/ui/accelerator_util.cc",
|
"atom/browser/ui/accelerator_util.cc",
|
||||||
"atom/browser/ui/accelerator_util.h",
|
"atom/browser/ui/accelerator_util.h",
|
||||||
"atom/browser/ui/accelerator_util_mac.mm",
|
|
||||||
"atom/browser/ui/accelerator_util_views.cc",
|
|
||||||
"atom/browser/ui/atom_menu_model.cc",
|
"atom/browser/ui/atom_menu_model.cc",
|
||||||
"atom/browser/ui/atom_menu_model.h",
|
"atom/browser/ui/atom_menu_model.h",
|
||||||
"atom/browser/ui/autofill_popup.cc",
|
"atom/browser/ui/autofill_popup.cc",
|
||||||
|
|
12
package.json
12
package.json
|
@ -44,19 +44,19 @@
|
||||||
"bump-version": "./script/bump-version.py",
|
"bump-version": "./script/bump-version.py",
|
||||||
"check-tls": "python ./script/tls.py",
|
"check-tls": "python ./script/tls.py",
|
||||||
"clang-format": "find atom/ brightray/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",
|
"clang-format": "find atom/ brightray/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",
|
||||||
"lint": "./script/lint.js && npm run lint:clang-format && npm run lint:docs",
|
"lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
|
||||||
"lint:js": "./script/lint.js --js",
|
"lint:js": ".node /script/lint.js --js",
|
||||||
"lint:clang-format": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
|
"lint:clang-format": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ || (echo \"\\nCode not formatted correctly.\" && exit 1)",
|
||||||
"lint:cpp": "./script/lint.js --cc",
|
"lint:cpp": "node ./script/lint.js --cc",
|
||||||
"lint:py": "./script/lint.js --py",
|
"lint:py": "node ./script/lint.js --py",
|
||||||
"lint:gn": "./script/lint.js --gn",
|
"lint:gn": "node ./script/lint.js --gn",
|
||||||
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links",
|
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links",
|
||||||
"lint:docs-relative-links": "python ./script/check-relative-doc-links.py",
|
"lint:docs-relative-links": "python ./script/check-relative-doc-links.py",
|
||||||
"lint:js-in-markdown": "standard-markdown docs",
|
"lint:js-in-markdown": "standard-markdown docs",
|
||||||
"create-api-json": "electron-docs-linter docs --outfile=electron-api.json",
|
"create-api-json": "electron-docs-linter docs --outfile=electron-api.json",
|
||||||
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=electron-api.json --out=electron.d.ts",
|
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=electron-api.json --out=electron.d.ts",
|
||||||
"preinstall": "node -e 'process.exit(0)'",
|
"preinstall": "node -e 'process.exit(0)'",
|
||||||
"precommit": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ && ./script/lint.js -c && remark docs -qf || (echo \"Code not formatted correctly.\" && exit 1)",
|
"precommit": "python script/run-clang-format.py -r -c atom/ chromium_src/ brightray/ && node ./script/lint.js -c && remark docs -qf || (echo \"Code not formatted correctly.\" && exit 1)",
|
||||||
"prepack": "check-for-leaks",
|
"prepack": "check-for-leaks",
|
||||||
"prepush": "check-for-leaks",
|
"prepush": "check-for-leaks",
|
||||||
"repl": "node ./script/start.js --interactive",
|
"repl": "node ./script/start.js --interactive",
|
||||||
|
|
|
@ -314,12 +314,6 @@ patches:
|
||||||
file: scroll_bounce_flag.patch
|
file: scroll_bounce_flag.patch
|
||||||
description: |
|
description: |
|
||||||
Patch to make scrollBounce option work.
|
Patch to make scrollBounce option work.
|
||||||
-
|
|
||||||
author: Birunthan Mohanathas <birunthan@mohanathas.com>
|
|
||||||
file: backport_d65792a.patch
|
|
||||||
description: |
|
|
||||||
https://chromium-review.googlesource.com/c/chromium/src/+/1105698
|
|
||||||
Fixes https://github.com/electron/electron/issues/13256
|
|
||||||
-
|
-
|
||||||
author: Cheng Zhao <zcbenz@gmail.com>
|
author: Cheng Zhao <zcbenz@gmail.com>
|
||||||
file: webview_reattach.patch
|
file: webview_reattach.patch
|
||||||
|
@ -447,18 +441,10 @@ patches:
|
||||||
description: backport of crashpad f540abb506
|
description: backport of crashpad f540abb506
|
||||||
-
|
-
|
||||||
author: Jeremy Apthorp <jeremya@chromium.org>
|
author: Jeremy Apthorp <jeremya@chromium.org>
|
||||||
file: backport_cd7154e0bb5.patch
|
file: expose-net-observer-api.patch
|
||||||
description: Support macosx 10.14 SDK
|
|
||||||
-
|
|
||||||
author: Shelley Vohr <shelley.vohr@gmail.com>
|
|
||||||
file: fix_xcode_ten.patch
|
|
||||||
description: |
|
description: |
|
||||||
Backports 27f9cbd8, a commit which does the following -
|
Expose URLRequestContextGetter::{Add,Remove}Observer.
|
||||||
* Removes IDEBundleInjection.framework from egtests.
|
This patch should be removed once we switch to using the net service (cc @robo)
|
||||||
* Corrects the DTXcode generation function to handle leading '10'.
|
|
||||||
* Fixes a main_application_delegate SDK change
|
|
||||||
* Fixes a non-null SDK change in a net unittest.
|
|
||||||
This is needed for Electron to compile with XCode 10.0.
|
|
||||||
-
|
-
|
||||||
author: deepak1556 <hop2deep@gmail.com>
|
author: deepak1556 <hop2deep@gmail.com>
|
||||||
file: desktop_media_list.patch
|
file: desktop_media_list.patch
|
||||||
|
@ -467,22 +453,6 @@ patches:
|
||||||
desktop capture api.
|
desktop capture api.
|
||||||
* Backports https://chromium-review.googlesource.com/c/chromium/src/+/1199806
|
* Backports https://chromium-review.googlesource.com/c/chromium/src/+/1199806
|
||||||
that fixes crash with screen capturer, can be removed in 71.0.3539.0
|
that fixes crash with screen capturer, can be removed in 71.0.3539.0
|
||||||
-
|
|
||||||
author: Jeremy Apthorp <jeremya@chromium.org>
|
|
||||||
file: expose-net-observer-api.patch
|
|
||||||
description: |
|
|
||||||
Expose URLRequestContextGetter::{Add,Remove}Observer.
|
|
||||||
This patch should be removed once we switch to using the net service (cc @robo)
|
|
||||||
-
|
|
||||||
author: Aleksei Kuzmin <alkuzmin@microsoft.com>
|
|
||||||
file: backport_7167a9eac.patch
|
|
||||||
description: |
|
|
||||||
"viz: Remove the global ServerSharedBitmapManager."
|
|
||||||
https://chromium-review.googlesource.com/802574
|
|
||||||
Landed in 69.0.3447.0.
|
|
||||||
See https://github.com/electron/electron/issues/14327
|
|
||||||
(Android specific changes and changes in some test files
|
|
||||||
have been removed from the diff.)
|
|
||||||
-
|
-
|
||||||
author: deepak1556 <hop2deep@gmail.com>
|
author: deepak1556 <hop2deep@gmail.com>
|
||||||
file: proxy_config_monitor.patch
|
file: proxy_config_monitor.patch
|
||||||
|
@ -493,3 +463,24 @@ patches:
|
||||||
file: gritsettings_resource_ids.patch
|
file: gritsettings_resource_ids.patch
|
||||||
description: |
|
description: |
|
||||||
Add electron resources file to the list of resource ids generation.
|
Add electron resources file to the list of resource ids generation.
|
||||||
|
-
|
||||||
|
author: Samuel Attard <samuel.r.attard@gmail.com>
|
||||||
|
file: isolate_holder.patch
|
||||||
|
description: |
|
||||||
|
Pass pre allocated isolate for initialization, node platform
|
||||||
|
needs to register on an isolate so that it can be used later
|
||||||
|
down in the initialization process of an isolate.
|
||||||
|
-
|
||||||
|
author: Jeremy Apthorp <jeremya@chromium.org>
|
||||||
|
file: notification_provenance.patch
|
||||||
|
description: |
|
||||||
|
Pass RenderProcessHost through to PlatformNotificationService.
|
||||||
|
|
||||||
|
This is so Electron can identify which renderer a notification came from.
|
||||||
|
-
|
||||||
|
author: deepak1556 <hop2deep@gmail.com>
|
||||||
|
file: content_browser_main_loop.patch
|
||||||
|
description: |
|
||||||
|
Pass idle quit closure for main message loop, so that pending tasks are
|
||||||
|
run before shutdown. This is required to cleanup WebContents asynchronously
|
||||||
|
in atom::CommonWebContentsDelegate::ResetManageWebContents.
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
|
From 61cd6b5bc2068a3740313d7f4680ef3fcaaacb1a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Cheng Zhao <zcbenz@gmail.com>
|
||||||
|
Date: Thu, 4 Oct 2018 14:57:02 -0700
|
||||||
|
Subject: accelerator.patch
|
||||||
|
|
||||||
|
|
||||||
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
|
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
|
||||||
index a6756c20f22c..53529588af27 100644
|
index 7e55ef366ac8..c3fb98b426cd 100644
|
||||||
--- a/ui/base/accelerators/accelerator.cc
|
--- a/ui/base/accelerators/accelerator.cc
|
||||||
+++ b/ui/base/accelerators/accelerator.cc
|
+++ b/ui/base/accelerators/accelerator.cc
|
||||||
@@ -11,6 +11,7 @@
|
@@ -11,6 +11,7 @@
|
||||||
|
@ -20,7 +26,7 @@ index a6756c20f22c..53529588af27 100644
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@@ -145,7 +144,15 @@ base::string16 Accelerator::GetShortcutText() const {
|
@@ -139,7 +138,15 @@ base::string16 Accelerator::GetShortcutText() const {
|
||||||
shortcut = KeyCodeToName(key_code_);
|
shortcut = KeyCodeToName(key_code_);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -36,7 +42,7 @@ index a6756c20f22c..53529588af27 100644
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// Our fallback is to try translate the key code to a regular character
|
// Our fallback is to try translate the key code to a regular character
|
||||||
// unless it is one of digits (VK_0 to VK_9). Some keyboard
|
// unless it is one of digits (VK_0 to VK_9). Some keyboard
|
||||||
@@ -154,17 +161,20 @@ base::string16 Accelerator::GetShortcutText() const {
|
@@ -148,17 +155,20 @@ base::string16 Accelerator::GetShortcutText() const {
|
||||||
// accent' for '0'). For display in the menu (e.g. Ctrl-0 for the
|
// accent' for '0'). For display in the menu (e.g. Ctrl-0 for the
|
||||||
// default zoom level), we leave VK_[0-9] alone without translation.
|
// default zoom level), we leave VK_[0-9] alone without translation.
|
||||||
wchar_t key;
|
wchar_t key;
|
||||||
|
@ -67,15 +73,7 @@ index a6756c20f22c..53529588af27 100644
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,15 +231,15 @@ base::string16 Accelerator::GetShortcutText() const {
|
@@ -223,7 +233,7 @@ base::string16 Accelerator::ApplyLongFormModifiers(
|
||||||
|
|
||||||
base::string16 Accelerator::ApplyLongFormModifiers(
|
|
||||||
base::string16 shortcut) const {
|
|
||||||
if (IsShiftDown())
|
|
||||||
shortcut = l10n_util::GetStringFUTF16(IDS_APP_SHIFT_MODIFIER, shortcut);
|
|
||||||
|
|
||||||
// Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut.
|
|
||||||
// See http://blogs.msdn.com/oldnewthing/archive/2004/03/29/101121.aspx for
|
|
||||||
// more information.
|
// more information.
|
||||||
if (IsCtrlDown())
|
if (IsCtrlDown())
|
||||||
shortcut = l10n_util::GetStringFUTF16(IDS_APP_CONTROL_MODIFIER, shortcut);
|
shortcut = l10n_util::GetStringFUTF16(IDS_APP_CONTROL_MODIFIER, shortcut);
|
||||||
|
@ -84,7 +82,7 @@ index a6756c20f22c..53529588af27 100644
|
||||||
shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut);
|
shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut);
|
||||||
|
|
||||||
if (IsCmdDown()) {
|
if (IsCmdDown()) {
|
||||||
@@ -249,14 +256,12 @@ base::string16 Accelerator::ApplyShortFormModifiers(
|
@@ -243,14 +253,12 @@ base::string16 Accelerator::ApplyShortFormModifiers(
|
||||||
base::string16 shortcut) const {
|
base::string16 shortcut) const {
|
||||||
const base::char16 kCommandSymbol[] = {0x2318, 0};
|
const base::char16 kCommandSymbol[] = {0x2318, 0};
|
||||||
const base::char16 kCtrlSymbol[] = {0x2303, 0};
|
const base::char16 kCtrlSymbol[] = {0x2303, 0};
|
||||||
|
@ -99,3 +97,6 @@ index a6756c20f22c..53529588af27 100644
|
||||||
parts.push_back(base::string16(IsCmdDown() ? kCommandSymbol : kNoSymbol));
|
parts.push_back(base::string16(IsCmdDown() ? kCommandSymbol : kNoSymbol));
|
||||||
parts.push_back(shortcut);
|
parts.push_back(shortcut);
|
||||||
return base::StrCat(parts);
|
return base::StrCat(parts);
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
|
From e686584a3758c1954f31e107746b40c6a63ad776 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Aleksei Kuzmin <alkuzmin@microsoft.com>
|
||||||
|
Date: Thu, 20 Sep 2018 17:47:36 -0700
|
||||||
|
Subject: add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch
|
||||||
|
|
||||||
|
|
||||||
diff --git a/base/BUILD.gn b/base/BUILD.gn
|
diff --git a/base/BUILD.gn b/base/BUILD.gn
|
||||||
index 943412faefd7..c505df950b2b 100644
|
index 7fb93868d6e0..53c5744953da 100644
|
||||||
--- a/base/BUILD.gn
|
--- a/base/BUILD.gn
|
||||||
+++ b/base/BUILD.gn
|
+++ b/base/BUILD.gn
|
||||||
@@ -1217,7 +1217,7 @@ jumbo_component("base") {
|
@@ -1248,7 +1248,7 @@ jumbo_component("base") {
|
||||||
# Needed for <atomic> if using newer C++ library than sysroot, except if
|
# Needed for <atomic> if using newer C++ library than sysroot, except if
|
||||||
# building inside the cros_sdk environment - use host_toolchain as a
|
# building inside the cros_sdk environment - use host_toolchain as a
|
||||||
# more robust check for this.
|
# more robust check for this.
|
||||||
- if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) &&
|
- if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) &&
|
||||||
+ if ((is_android || (is_linux && !is_chromecast)) &&
|
+ if ((is_android || (is_linux && !is_chromecast)) &&
|
||||||
host_toolchain != "//build/toolchain/cros:host") {
|
host_toolchain != "//build/toolchain/cros:host") {
|
||||||
libs = [ "atomic" ]
|
libs += [ "atomic" ]
|
||||||
}
|
}
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
From 0e2864c50cb039dd2f8d9b9cc88ae26f5bd62581 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||||
|
Date: Thu, 20 Sep 2018 17:44:26 -0700
|
||||||
|
Subject: add_realloc.patch
|
||||||
|
|
||||||
|
Blink overrides ArrayBuffer's allocator with its own one, while Node simply
|
||||||
|
uses malloc and free, so we need to use v8's allocator in Node. As part of the
|
||||||
|
10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator
|
||||||
|
argument in its constructor, and override ReallocateBufferMemory and
|
||||||
|
FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy
|
||||||
|
when we override ReallocateBufferMemory, so we therefore need to implement
|
||||||
|
Realloc on the v8 side and correspondingly in gin.
|
||||||
|
|
||||||
diff --git a/gin/array_buffer.cc b/gin/array_buffer.cc
|
diff --git a/gin/array_buffer.cc b/gin/array_buffer.cc
|
||||||
index f84934bfd712..fc23fef68b6f 100644
|
index f84934bfd712..fc23fef68b6f 100644
|
||||||
--- a/gin/array_buffer.cc
|
--- a/gin/array_buffer.cc
|
||||||
|
@ -26,10 +39,10 @@ index 2aef366ac819..3c7d66c81032 100644
|
||||||
|
|
||||||
GIN_EXPORT static ArrayBufferAllocator* SharedInstance();
|
GIN_EXPORT static ArrayBufferAllocator* SharedInstance();
|
||||||
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||||
index c8c822632a69..d12976b3cd01 100644
|
index 83a6639306a9..8511e7d594ce 100644
|
||||||
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||||
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
||||||
@@ -619,6 +619,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
@@ -665,6 +665,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
||||||
size, WTF::ArrayBufferContents::kDontInitialize);
|
size, WTF::ArrayBufferContents::kDontInitialize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,3 +81,6 @@ index 809229caa872..6248ad32d6b0 100644
|
||||||
static void FreeMemory(void*);
|
static void FreeMemory(void*);
|
||||||
static DataHandle CreateDataHandle(size_t, InitializationPolicy);
|
static DataHandle CreateDataHandle(size_t, InitializationPolicy);
|
||||||
static void Initialize(
|
static void Initialize(
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,24 @@
|
||||||
|
From 602c08e90102a25894a4d48d236258cae6b982c6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Charles Kerr <charles@charleskerr.com>
|
||||||
|
Date: Thu, 20 Sep 2018 17:50:17 -0700
|
||||||
|
Subject: allow_nested_error_trackers.patch
|
||||||
|
|
||||||
|
Only one X11ErrorTracker should exist at a time, but upstream has a bug
|
||||||
|
where two can exist if running in headless mode --
|
||||||
|
ui::(anonymous namespace)::SupportsEWMH() [inner tracker is created]
|
||||||
|
ui::WmSupportsHint()
|
||||||
|
ui::IsX11WindowFullScreen()
|
||||||
|
ui::ScreensaverWindowFinder::IsScreensaverWindow()
|
||||||
|
ui::ScreensaverWindowFinder::ShouldStopIterating()
|
||||||
|
ui::EnumerateTopLevelWindows()
|
||||||
|
ui::ScreensaverWindowFinder::ScreensaverWindowExists() [outer tracker created]
|
||||||
|
ui::CheckIdleStateIsLocked()
|
||||||
|
ui::CalculateIdleState()
|
||||||
|
Removal of either tracker could have side-effects in some code paths,
|
||||||
|
so this is probably better handled upstream. This patch tries to do the
|
||||||
|
least harm in the interim by removing the check that prevents more than
|
||||||
|
one tracker from existing at a time.
|
||||||
|
|
||||||
diff --git a/ui/gfx/x/x11_error_tracker.cc b/ui/gfx/x/x11_error_tracker.cc
|
diff --git a/ui/gfx/x/x11_error_tracker.cc b/ui/gfx/x/x11_error_tracker.cc
|
||||||
index af031de356c5..2a5c18dc473a 100644
|
index af031de356c5..2a5c18dc473a 100644
|
||||||
--- a/ui/gfx/x/x11_error_tracker.cc
|
--- a/ui/gfx/x/x11_error_tracker.cc
|
||||||
|
@ -11,3 +32,6 @@ index af031de356c5..2a5c18dc473a 100644
|
||||||
g_handler = this;
|
g_handler = this;
|
||||||
XSync(GetXDisplay(), False);
|
XSync(GetXDisplay(), False);
|
||||||
old_handler_ = XSetErrorHandler(X11ErrorHandler);
|
old_handler_ = XSetErrorHandler(X11ErrorHandler);
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue