Browse Source

Merge pull request #14972 from electron/chromium-upgrade/69

feat: upgrade to Chromium 69.0.3497.106
Samuel Attard 6 years ago
parent
commit
cc0c6ad14a
100 changed files with 654 additions and 689 deletions
  1. 18 9
      .circleci/config.yml
  2. 1 3
      BUILD.gn
  3. 27 13
      DEPS
  4. 13 12
      atom/app/atom_content_client.cc
  5. 10 0
      atom/app/atom_main_delegate.cc
  6. 1 0
      atom/app/atom_main_delegate.h
  7. 15 0
      atom/app/atom_main_delegate_mac.h
  8. 6 0
      atom/app/atom_main_delegate_mac.mm
  9. 2 1
      atom/app/node_main.cc
  10. 1 1
      atom/browser/api/atom_api_app.cc
  11. 4 1
      atom/browser/api/atom_api_net_log.cc
  12. 34 46
      atom/browser/api/atom_api_session.cc
  13. 2 2
      atom/browser/api/atom_api_session.h
  14. 13 14
      atom/browser/api/atom_api_web_contents.cc
  15. 5 5
      atom/browser/api/atom_api_web_contents.h
  16. 2 4
      atom/browser/api/atom_api_web_request.cc
  17. 12 0
      atom/browser/api/gpu_info_enumerator.cc
  18. 3 0
      atom/browser/api/gpu_info_enumerator.h
  19. 2 4
      atom/browser/api/gpuinfo_manager.cc
  20. 3 12
      atom/browser/atom_browser_client.cc
  21. 0 3
      atom/browser/atom_browser_client.h
  22. 3 2
      atom/browser/atom_browser_context.cc
  23. 2 1
      atom/browser/atom_browser_context.h
  24. 9 13
      atom/browser/atom_browser_main_parts.cc
  25. 2 5
      atom/browser/atom_browser_main_parts.h
  26. 0 4
      atom/browser/atom_browser_main_parts_mac.mm
  27. 1 1
      atom/browser/atom_download_manager_delegate.cc
  28. 1 1
      atom/browser/atom_javascript_dialog_manager.cc
  29. 6 4
      atom/browser/atom_permission_manager.cc
  30. 5 5
      atom/browser/atom_permission_manager.h
  31. 2 2
      atom/browser/atom_speech_recognition_manager_delegate.cc
  32. 3 2
      atom/browser/atom_speech_recognition_manager_delegate.h
  33. 2 2
      atom/browser/atom_web_ui_controller_factory.cc
  34. 4 1
      atom/browser/atom_web_ui_controller_factory.h
  35. 0 65
      atom/browser/bridge_task_runner.cc
  36. 0 48
      atom/browser/bridge_task_runner.h
  37. 11 3
      atom/browser/browser.cc
  38. 4 0
      atom/browser/browser.h
  39. 19 8
      atom/browser/common_web_contents_delegate.cc
  40. 1 1
      atom/browser/fake_location_provider.h
  41. 38 0
      atom/browser/io_thread.cc
  42. 18 14
      atom/browser/javascript_environment.cc
  43. 5 7
      atom/browser/javascript_environment.h
  44. 1 1
      atom/browser/login_handler.cc
  45. 2 1
      atom/browser/login_handler.h
  46. 15 3
      atom/browser/native_window.cc
  47. 9 7
      atom/browser/native_window.h
  48. 1 9
      atom/browser/native_window_mac.mm
  49. 3 1
      atom/browser/net/asar/url_request_asar_job.cc
  50. 3 1
      atom/browser/net/asar/url_request_asar_job.h
  51. 10 16
      atom/browser/net/atom_cert_verifier.cc
  52. 2 3
      atom/browser/net/atom_cert_verifier.h
  53. 18 25
      atom/browser/net/atom_network_delegate.cc
  54. 10 13
      atom/browser/net/atom_network_delegate.h
  55. 2 1
      atom/browser/net/atom_url_request.cc
  56. 10 49
      atom/browser/net/url_request_context_getter.cc
  57. 4 6
      atom/browser/net/url_request_context_getter.h
  58. 2 2
      atom/browser/special_storage_policy.cc
  59. 1 1
      atom/browser/special_storage_policy.h
  60. 0 1
      atom/browser/ui/accelerator_util.cc
  61. 0 3
      atom/browser/ui/accelerator_util.h
  62. 0 46
      atom/browser/ui/accelerator_util_mac.mm
  63. 0 13
      atom/browser/ui/accelerator_util_views.cc
  64. 6 8
      atom/browser/ui/cocoa/atom_menu_controller.mm
  65. 12 10
      atom/browser/web_contents_permission_helper.cc
  66. 1 1
      atom/browser/web_contents_permission_helper.h
  67. 1 1
      atom/browser/web_contents_preferences.cc
  68. 1 1
      atom/common/chrome_version.h
  69. 4 6
      atom/common/native_mate_converters/net_converter.cc
  70. 7 0
      brightray/browser/browser_main_parts.cc
  71. 14 19
      brightray/browser/media/media_stream_devices_controller.cc
  72. 1 1
      brightray/browser/media/media_stream_devices_controller.h
  73. 2 0
      brightray/browser/notification_presenter.cc
  74. 14 23
      brightray/browser/platform_notification_service.cc
  75. 3 9
      brightray/browser/platform_notification_service.h
  76. 5 5
      brightray/browser/web_ui_controller_factory.cc
  77. 3 1
      brightray/browser/web_ui_controller_factory.h
  78. 3 0
      build/args/release.gn
  79. 2 1
      build/zip.py
  80. 1 1
      buildflags/buildflags.gni
  81. 2 0
      chromium_src/chrome/browser/printing/pdf_to_emf_converter.cc
  82. 2 0
      chromium_src/chrome/common/chrome_utility_printing_messages.h
  83. 9 6
      chromium_src/chrome/renderer/printing/print_web_view_helper.cc
  84. 5 2
      chromium_src/chrome/renderer/printing/print_web_view_helper.h
  85. 2 2
      chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm
  86. 2 0
      chromium_src/chrome/utility/printing_handler_win.cc
  87. 3 0
      components/pepper_flash/BUILD.gn
  88. 1 5
      default_app/default_app.js
  89. 1 1
      docs/api/app.md
  90. 8 0
      docs/api/breaking-changes.md
  91. 11 2
      docs/api/browser-window.md
  92. 11 2
      electron_resources.grd
  93. 15 0
      electron_strings.grdp
  94. 1 4
      filenames.gni
  95. 6 6
      package.json
  96. 24 33
      patches/common/chromium/.patches.yaml
  97. 14 13
      patches/common/chromium/accelerator.patch
  98. 12 3
      patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch
  99. 18 2
      patches/common/chromium/add_realloc.patch
  100. 24 0
      patches/common/chromium/allow_nested_error_trackers.patch

+ 18 - 9
.circleci/config.yml

@@ -28,6 +28,9 @@ env-release-build: &env-release-build
 env-headless-testing: &env-headless-testing
   DISPLAY: ':99.0'
 
+env-stack-dumping: &env-stack-dumping
+  ELECTRON_ENABLE_STACK_DUMPING: '1'
+
 env-browsertests: &env-browsertests
   GN_EXTRA_ARGS: 'is_component_ffmpeg = false'
   BUILD_TARGET: electron:chromium_browsertests
@@ -606,7 +609,7 @@ steps-tests: &steps-tests
         command: |
           cd src
           export ELECTRON_OUT_DIR=Default
-          (cd electron && npm run test -- --ci --enable-logging)
+          (cd electron && npm run test -- --ci)
     - run:
         name: Check test results existence
         command: |
@@ -944,6 +947,7 @@ jobs:
     <<: *machine-linux-medium
     environment:
       <<: *env-headless-testing
+      <<: *env-stack-dumping
     <<: *steps-tests
 
   linux-x64-release-tests:
@@ -965,6 +969,7 @@ jobs:
     environment:
       <<: *env-ia32
       <<: *env-headless-testing
+      <<: *env-stack-dumping
     <<: *steps-tests
 
   linux-ia32-release-tests:
@@ -985,10 +990,14 @@ jobs:
 
   osx-testing-tests:
     <<: *machine-mac
+    environment:
+      <<: *env-stack-dumping
     <<: *steps-tests
 
   mas-testing-tests:
     <<: *machine-mac
+    environment:
+      <<: *env-stack-dumping
     <<: *steps-tests
 
   # Layer 4: Summary.
@@ -1077,14 +1086,14 @@ workflows:
             - mas-testing
 
   nightly-release-test:
-    triggers:
-      - schedule:
-          cron: "0 0 * * *"
-          filters:
-            branches:
-              only:
-                - master
-                - *chromium-upgrade-branches
+#    triggers:
+#      - schedule:
+#          cron: "0 0 * * *"
+#          filters:
+#            branches:
+#              only:
+#                - master
+#                - *chromium-upgrade-branches
     jobs:
       - linux-checkout
 

+ 1 - 3
BUILD.gn

@@ -216,8 +216,8 @@ static_library("electron_lib") {
     "//content/public/app:both",
     "//content/public/child",
     "//content/public/common:service_names",
-    "//device/geolocation",
     "//gin",
+    "//media/mojo/interfaces",
     "//net:net_resources",
     "//ppapi/host",
     "//ppapi/proxy",
@@ -693,7 +693,6 @@ if (is_mac) {
       ":electron_lib",
       ":js2asar",
       ":packed_resources",
-      "//build/config:exe_and_shlib_deps",
       "//content:sandbox_helper_win",
       "//ui/strings",
     ]
@@ -798,7 +797,6 @@ group("chromium_unittests") {
     "//third_party/blink/public:all_blink",
     "//third_party/blink/public:test_support",
     "//third_party/leveldatabase:env_chromium_unittests",
-    "//tools/gn:gn_unittests",
     "//ui/base:ui_base_unittests",
     "//ui/compositor:compositor_unittests",
     "//ui/display:display_unittests",

+ 27 - 13
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 = {
-  'chromium_version': '68.0.3440.128',
-  'node_version': '18a9880b70039f5d41ee860a95fe84e5ef928973',
+  'chromium_version':
+    '69.0.3497.106',
+  'node_version':
+    '5331c9dc72e0db379a675efdb98f6a67bf7f23f0',
 
   'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
   'pyyaml_version': '3.12',
@@ -15,16 +27,25 @@ vars = {
   # Python interface to Amazon Web Services. Is used for releases only.
   'checkout_boto': False,
 
-  'checkout_nacl': False,
-  'checkout_libaom': True,
-  'checkout_oculus_sdk': False,
-
   # Python "requests" module is used for releases only.
   'checkout_requests': False,
 
   # It is always needed for normal Electron builds,
   # but might be impossible for custom in-house builds.
   '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 = {
@@ -100,10 +121,3 @@ hooks = [
 recursedeps = [
   'src',
 ]
-
-gclient_gn_args = [
-  'checkout_libaom',
-  'checkout_nacl',
-  'checkout_oculus_sdk',
-]
-gclient_gn_args_file =  'src/build/config/gclient_args.gni'

+ 13 - 12
atom/app/atom_content_client.cc

@@ -44,7 +44,7 @@ namespace {
 bool IsWidevineAvailable(
     base::FilePath* cdm_path,
     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) {
   static enum {
     NOT_CHECKED,
@@ -71,12 +71,11 @@ bool IsWidevineAvailable(
     codecs_supported->push_back(media::VideoCodec::kCodecH264);
 #endif  // BUILDFLAG(USE_PROPRIETARY_CODECS)
 
-// TODO(crbug.com/767941): Push persistent-license support info here once
-// we check in a new CDM that supports it on Linux.
+    // TODO(crbug.com/767941): Push persistent-license support info here once
+    // we check in a new CDM that supports it on Linux.
+    session_types_supported->insert(media::CdmSessionType::kTemporary);
 #if defined(OS_CHROMEOS)
-    *supports_persistent_license = true;
-#else
-    *supports_persistent_license = false;
+    session_types_supported->insert(media::CdmSessionType::kPersistentLicense);
 #endif  // defined(OS_CHROMEOS)
 
     modes_supported->insert(media::EncryptionMode::kCenc);
@@ -211,8 +210,8 @@ void AtomContentClient::AddAdditionalSchemes(Schemes* schemes) {
 
 void AtomContentClient::AddPepperPlugins(
     std::vector<content::PepperPluginInfo>* plugins) {
-  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
 #if BUILDFLAG(ENABLE_PEPPER_FLASH)
+  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
   AddPepperFlashFromCommandLine(command_line, plugins);
 #endif  // BUILDFLAG(ENABLE_PEPPER_FLASH)
   ComputeBuiltInPlugins(plugins);
@@ -225,10 +224,10 @@ void AtomContentClient::AddContentDecryptionModules(
 #if defined(WIDEVINE_CDM_AVAILABLE)
     base::FilePath cdm_path;
     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;
     if (IsWidevineAvailable(&cdm_path, &video_codecs_supported,
-                            &supports_persistent_license,
+                            &session_types_supported,
                             &encryption_modes_supported)) {
       base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
       auto cdm_version_string =
@@ -239,11 +238,13 @@ void AtomContentClient::AddContentDecryptionModules(
       const base::Version version(cdm_version_string);
       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(
           kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path,
-          kWidevineCdmFileSystemId, video_codecs_supported,
-          supports_persistent_license, encryption_modes_supported,
-          kWidevineKeySystem, false));
+          kWidevineCdmFileSystemId, capability, kWidevineKeySystem, false));
     }
 #endif  // defined(WIDEVINE_CDM_AVAILABLE)
   }

+ 10 - 0
atom/app/atom_main_delegate.cc

@@ -35,6 +35,10 @@
 #include "atom/common/common_message_generator.h"
 #endif
 
+#if defined(OS_MACOSX)
+#include "atom/app/atom_main_delegate_mac.h"
+#endif
+
 namespace atom {
 
 namespace {
@@ -158,6 +162,12 @@ void AtomMainDelegate::PreSandboxStartup() {
 #endif
 }
 
+void AtomMainDelegate::PreContentInitialization() {
+#if defined(OS_MACOSX)
+  RegisterAtomCrApp();
+#endif
+}
+
 content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
   browser_client_.reset(new AtomBrowserClient);
   return browser_client_.get();

+ 1 - 0
atom/app/atom_main_delegate.h

@@ -22,6 +22,7 @@ class AtomMainDelegate : public brightray::MainDelegate {
   // content::ContentMainDelegate:
   bool BasicStartupComplete(int* exit_code) override;
   void PreSandboxStartup() override;
+  void PreContentInitialization() override;
   content::ContentBrowserClient* CreateContentBrowserClient() override;
   content::ContentRendererClient* CreateContentRendererClient() override;
   content::ContentUtilityClient* CreateContentUtilityClient() override;

+ 15 - 0
atom/app/atom_main_delegate_mac.h

@@ -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_

+ 6 - 0
atom/app/atom_main_delegate_mac.mm

@@ -4,6 +4,7 @@
 
 #include "atom/app/atom_main_delegate.h"
 
+#include "atom/browser/mac/atom_application.h"
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "base/mac/bundle_locations.h"
@@ -63,4 +64,9 @@ void AtomMainDelegate::SetUpBundleOverrides() {
   base::mac::SetBaseBundleID(base_bundle_id.c_str());
 }
 
+void RegisterAtomCrApp() {
+  // Force the NSApplication subclass to be used.
+  [AtomApplication sharedApplication];
+}
+
 }  // namespace atom

+ 2 - 1
atom/app/node_main.cc

@@ -51,7 +51,7 @@ int NodeMain(int argc, char* argv[]) {
     base::TaskScheduler::CreateAndStartWithDefaultParams("Electron");
 
     // Initialize gin::IsolateHolder.
-    JavascriptEnvironment gin_env;
+    JavascriptEnvironment gin_env(loop);
 
     // Explicitly register electron's builtin modules.
     NodeBindings::RegisterBuiltinModules();
@@ -100,6 +100,7 @@ int NodeMain(int argc, char* argv[]) {
     node::RunAtExit(env);
     gin_env.platform()->DrainTasks(env->isolate());
     gin_env.platform()->CancelPendingDelayedTasks(env->isolate());
+    gin_env.platform()->UnregisterIsolate(env->isolate());
 
     node::FreeEnvironment(env);
   }

+ 1 - 1
atom/browser/api/atom_api_app.cc

@@ -1173,7 +1173,7 @@ v8::Local<v8::Promise> App::GetGPUInfo(v8::Isolate* isolate,
 
   auto* const info_mgr = GPUInfoManager::GetInstance();
   if (info_type == "complete") {
-#if defined(OS_MACOSX) || defined(OS_WIN)
+#if defined(OS_WIN)
     info_mgr->FetchCompleteInfo(promise);
 #else
     info_mgr->FetchBasicInfo(promise);

+ 4 - 1
atom/browser/api/atom_api_net_log.cc

@@ -11,6 +11,7 @@
 #include "atom/common/native_mate_converters/callback.h"
 #include "atom/common/native_mate_converters/file_path_converter.h"
 #include "base/command_line.h"
+#include "base/logging.h"
 #include "components/net_log/chrome_net_log.h"
 #include "content/public/browser/storage_partition.h"
 #include "native_mate/dictionary.h"
@@ -103,11 +104,13 @@ void NetLog::StopLogging(mate::Arguments* args) {
 
 void NetLog::OnNewState(const base::DictionaryValue& state) {
   net_log_state_ = state.CreateDeepCopy();
+  auto logging_state = GetLoggingState();
+  LOG(INFO) << "Got new state: " << logging_state;
 
   if (stop_callback_queue_.empty())
     return;
 
-  if (GetLoggingState() == "NOT_LOGGING") {
+  if (logging_state == "NOT_LOGGING") {
     for (auto& callback : stop_callback_queue_) {
       if (!callback.is_null())
         net_log_writer_->GetFilePathToCompletedLog(callback);

+ 34 - 46
atom/browser/api/atom_api_session.cc

@@ -27,7 +27,6 @@
 #include "atom/common/native_mate_converters/gurl_converter.h"
 #include "atom/common/native_mate_converters/net_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/guid.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/url_request_context.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 "atom/common/node_includes.h"
+
 using atom::api::Cookies;
 using content::BrowserThread;
 using content::StoragePartition;
@@ -353,18 +352,6 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
       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,
                          const v8::Global<v8::Value>& global_handle) {
   v8::Locker locker(isolate);
@@ -385,7 +372,7 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
 }  // namespace
 
 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) {
   // Observe DownloadManager to get download notifications.
   content::BrowserContext::GetDownloadManager(browser_context)
@@ -503,42 +490,43 @@ void Session::SetDownloadPath(const base::FilePath& path) {
 }
 
 void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
-  std::unique_ptr<network::NetworkConditions> conditions;
-  bool offline = false;
-  double latency = 0.0, download_throughput = 0.0, upload_throughput = 0.0;
-  if (options.Get("offline", &offline) && offline) {
-    conditions.reset(new network::NetworkConditions(offline));
-  } else {
-    options.Get("latency", &latency);
-    options.Get("downloadThroughput", &download_throughput);
-    options.Get("uploadThroughput", &upload_throughput);
-    conditions.reset(new network::NetworkConditions(
-        false, latency, download_throughput, upload_throughput));
+  auto conditions = network::mojom::NetworkConditions::New();
+
+  options.Get("offline", &conditions->offline);
+  options.Get("downloadThroughput", &conditions->download_throughput);
+  options.Get("uploadThroughput", &conditions->upload_throughput);
+  double latency = 0.0;
+  if (options.Get("latency", &latency) && latency) {
+    conditions->latency = base::TimeDelta::FromMillisecondsD(latency);
   }
 
-  network::ThrottlingController::SetConditions(
-      devtools_network_emulation_client_id_, std::move(conditions));
-  BrowserThread::PostTask(
-      BrowserThread::IO, FROM_HERE,
-      base::BindOnce(&SetDevToolsNetworkEmulationClientIdInIO,
-                     base::RetainedRef(browser_context_->GetRequestContext()),
-                     devtools_network_emulation_client_id_));
+  auto* network_context = content::BrowserContext::GetDefaultStoragePartition(
+                              browser_context_.get())
+                              ->GetNetworkContext();
+  network_context->SetNetworkConditions(network_emulation_token_,
+                                        std::move(conditions));
 }
 
 void Session::DisableNetworkEmulation() {
-  auto conditions = std::make_unique<network::NetworkConditions>();
-  network::ThrottlingController::SetConditions(
-      devtools_network_emulation_client_id_, std::move(conditions));
-  BrowserThread::PostTask(
-      BrowserThread::IO, FROM_HERE,
-      base::BindOnce(&SetDevToolsNetworkEmulationClientIdInIO,
-                     base::RetainedRef(browser_context_->GetRequestContext()),
-                     std::string()));
+  auto* network_context = content::BrowserContext::GetDefaultStoragePartition(
+                              browser_context_.get())
+                              ->GetNetworkContext();
+  network_context->SetNetworkConditions(
+      network_emulation_token_, network::mojom::NetworkConditions::New());
+}
+
+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,
                                 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))) {
     args->ThrowError("Must pass null or function");
     return;
@@ -548,7 +536,7 @@ void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
       BrowserThread::IO, FROM_HERE,
       base::BindOnce(&SetCertVerifyProcInIO,
                      WrapRefCounted(browser_context_->GetRequestContext()),
-                     proc));
+                     base::Bind(&WrapVerifyProc, proc)));
 }
 
 void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
@@ -559,7 +547,7 @@ void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
     return;
   }
   auto* permission_manager = static_cast<AtomPermissionManager*>(
-      browser_context()->GetPermissionManager());
+      browser_context()->GetPermissionControllerDelegate());
   permission_manager->SetPermissionRequestHandler(handler);
 }
 
@@ -571,7 +559,7 @@ void Session::SetPermissionCheckHandler(v8::Local<v8::Value> val,
     return;
   }
   auto* permission_manager = static_cast<AtomPermissionManager*>(
-      browser_context()->GetPermissionManager());
+      browser_context()->GetPermissionControllerDelegate());
   permission_manager->SetPermissionCheckHandler(handler);
 }
 

+ 2 - 2
atom/browser/api/atom_api_session.h

@@ -107,8 +107,8 @@ class Session : public mate::TrackableObject<Session>,
   v8::Global<v8::Value> web_request_;
   v8::Global<v8::Value> net_log_;
 
-  // The X-DevTools-Emulate-Network-Conditions-Client-Id.
-  std::string devtools_network_emulation_client_id_;
+  // The client id to enable the network throttler.
+  base::UnguessableToken network_emulation_token_;
 
   scoped_refptr<AtomBrowserContext> browser_context_;
 

+ 13 - 14
atom/browser/api/atom_api_web_contents.cc

@@ -462,7 +462,7 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
       auto* relay =
           NativeWindowRelay::FromWebContents(embedder_->web_contents());
       if (relay)
-        owner_window = relay->window.get();
+        owner_window = relay->GetNativeWindow();
     }
     if (owner_window)
       SetOwnerWindow(owner_window);
@@ -587,8 +587,8 @@ void WebContents::BeforeUnloadFired(content::WebContents* tab,
     *proceed_to_fire_unload = true;
 }
 
-void WebContents::MoveContents(content::WebContents* source,
-                               const gfx::Rect& pos) {
+void WebContents::SetContentsBounds(content::WebContents* source,
+                                    const gfx::Rect& pos) {
   Emit("move", pos);
 }
 
@@ -612,10 +612,6 @@ void WebContents::UpdateTargetURL(content::WebContents* source,
   Emit("update-target-url", url);
 }
 
-bool WebContents::IsPopupOrPanel(const content::WebContents* source) const {
-  return type_ == BROWSER_WINDOW;
-}
-
 void WebContents::HandleKeyboardEvent(
     content::WebContents* source,
     const content::NativeWebKeyboardEvent& event) {
@@ -671,7 +667,8 @@ void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
 
 void WebContents::RendererUnresponsive(
     content::WebContents* source,
-    content::RenderWidgetHost* render_widget_host) {
+    content::RenderWidgetHost* render_widget_host,
+    base::RepeatingClosure hang_monitor_restarter) {
   Emit("unresponsive");
 }
 
@@ -734,10 +731,10 @@ bool WebContents::CheckMediaAccessPermission(
 void WebContents::RequestMediaAccessPermission(
     content::WebContents* web_contents,
     const content::MediaStreamRequest& request,
-    const content::MediaResponseCallback& callback) {
+    content::MediaResponseCallback callback) {
   auto* permission_helper =
       WebContentsPermissionHelper::FromWebContents(web_contents);
-  permission_helper->RequestMediaAccessPermission(request, callback);
+  permission_helper->RequestMediaAccessPermission(request, std::move(callback));
 }
 
 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.
   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)
     handle->SetOwnerWindow(devtools, owner_window());
 
@@ -1823,7 +1821,8 @@ gfx::Size WebContents::GetSizeForNewRenderView(content::WebContents* wc) const {
   if (IsOffScreen() && wc == web_contents()) {
     auto* relay = NativeWindowRelay::FromWebContents(web_contents());
     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;
     auto* relay = NativeWindowRelay::FromWebContents(embedder->web_contents());
     if (relay) {
-      owner_window = relay->window.get();
+      owner_window = relay->GetNativeWindow();
     }
     if (owner_window)
       SetOwnerWindow(owner_window);
@@ -1961,7 +1960,7 @@ v8::Local<v8::Value> WebContents::Debugger(v8::Isolate* isolate) {
 }
 
 void WebContents::GrantOriginAccess(const GURL& url) {
-  content::ChildProcessSecurityPolicy::GetInstance()->GrantOrigin(
+  content::ChildProcessSecurityPolicy::GetInstance()->GrantCommitOrigin(
       web_contents()->GetMainFrame()->GetProcess()->GetID(),
       url::Origin::Create(url));
 }

+ 5 - 5
atom/browser/api/atom_api_web_contents.h

@@ -314,12 +314,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
   void BeforeUnloadFired(content::WebContents* tab,
                          bool proceed,
                          bool* proceed_to_fire_unload) override;
-  void MoveContents(content::WebContents* source,
-                    const gfx::Rect& pos) override;
+  void SetContentsBounds(content::WebContents* source,
+                         const gfx::Rect& pos) override;
   void CloseContents(content::WebContents* source) override;
   void ActivateContents(content::WebContents* contents) override;
   void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
-  bool IsPopupOrPanel(const content::WebContents* source) const override;
   void HandleKeyboardEvent(
       content::WebContents* source,
       const content::NativeWebKeyboardEvent& event) override;
@@ -333,7 +332,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
   void ExitFullscreenModeForTab(content::WebContents* source) override;
   void RendererUnresponsive(
       content::WebContents* source,
-      content::RenderWidgetHost* render_widget_host) override;
+      content::RenderWidgetHost* render_widget_host,
+      base::RepeatingClosure hang_monitor_restarter) override;
   void RendererResponsive(
       content::WebContents* source,
       content::RenderWidgetHost* render_widget_host) override;
@@ -351,7 +351,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
   void RequestMediaAccessPermission(
       content::WebContents* web_contents,
       const content::MediaStreamRequest& request,
-      const content::MediaResponseCallback& callback) override;
+      content::MediaResponseCallback callback) override;
   void RequestToLockMouse(content::WebContents* web_contents,
                           bool user_gesture,
                           bool last_unlocked_by_target) override;

+ 2 - 4
atom/browser/api/atom_api_web_request.cc

@@ -49,11 +49,9 @@ void CallNetworkDelegateMethod(
     URLPatterns patterns,
     Listener listener) {
   // Force creating network delegate.
-  net::URLRequestContext* context =
-      url_request_context_getter->GetURLRequestContext();
+  url_request_context_getter->GetURLRequestContext();
   // Then call the method.
-  AtomNetworkDelegate* network_delegate =
-      static_cast<AtomNetworkDelegate*>(context->network_delegate());
+  auto* network_delegate = url_request_context_getter->network_delegate();
   (network_delegate->*method)(type, std::move(patterns), std::move(listener));
 }
 

+ 12 - 0
atom/browser/api/gpu_info_enumerator.cc

@@ -95,6 +95,18 @@ void GPUInfoEnumerator::EndAuxAttributes() {
   value_stack.pop();
 }
 
+void GPUInfoEnumerator::BeginOverlayCapability() {
+  value_stack.push(std::move(current));
+  current = std::make_unique<base::DictionaryValue>();
+}
+
+void GPUInfoEnumerator::EndOverlayCapability() {
+  auto& top_value = value_stack.top();
+  top_value->SetDictionary(kOverlayCapabilityKey, std::move(current));
+  current = std::move(top_value);
+  value_stack.pop();
+}
+
 std::unique_ptr<base::DictionaryValue> GPUInfoEnumerator::GetDictionary() {
   return std::move(current);
 }

+ 3 - 0
atom/browser/api/gpu_info_enumerator.h

@@ -23,6 +23,7 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
   const char* kVideoEncodeAcceleratorSupportedProfileKey =
       "videoEncodeAcceleratorSupportedProfile";
   const char* kAuxAttributesKey = "auxAttributes";
+  const char* kOverlayCapabilityKey = "overlayCapability";
 
  public:
   GPUInfoEnumerator();
@@ -41,6 +42,8 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
   void EndVideoEncodeAcceleratorSupportedProfile() override;
   void BeginAuxAttributes() override;
   void EndAuxAttributes() override;
+  void BeginOverlayCapability() override;
+  void EndOverlayCapability() override;
   std::unique_ptr<base::DictionaryValue> GetDictionary();
 
  private:

+ 2 - 4
atom/browser/api/gpuinfo_manager.cc

@@ -25,11 +25,9 @@ GPUInfoManager::~GPUInfoManager() {
 }
 
 // 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() {
-#if defined(OS_MACOSX)
-  return gpu_data_manager_->GetGPUInfo().gl_vendor.empty();
-#elif defined(OS_WIN)
+#if defined(OS_WIN)
   const auto& gpu_info = gpu_data_manager_->GetGPUInfo();
   return (gpu_info.dx_diagnostics.values.empty() &&
           gpu_info.dx_diagnostics.children.empty());

+ 3 - 12
atom/browser/atom_browser_client.cc

@@ -55,12 +55,12 @@
 #include "content/public/common/service_names.mojom.h"
 #include "content/public/common/url_constants.h"
 #include "content/public/common/web_preferences.h"
-#include "device/geolocation/public/cpp/location_provider.h"
 #include "electron/buildflags/buildflags.h"
 #include "electron/grit/electron_resources.h"
 #include "net/base/escape.h"
 #include "net/ssl/ssl_cert_request_info.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/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -374,16 +374,6 @@ void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) {
 #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::unique_ptr<base::Environment> env(base::Environment::Create());
   std::string api_key;
@@ -537,7 +527,8 @@ network::mojom::NetworkContextPtr AtomBrowserClient::CreateNetworkContext(
 void AtomBrowserClient::RegisterOutOfProcessServices(
     OutOfProcessServiceMap* services) {
   (*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(

+ 0 - 3
atom/browser/atom_browser_client.h

@@ -69,9 +69,6 @@ class AtomBrowserClient : public brightray::BrowserClient,
   void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
                                       int child_process_id) override;
   void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
-  void GetGeolocationRequestContext(
-      base::OnceCallback<void(scoped_refptr<net::URLRequestContextGetter>)>
-          callback) override;
   std::string GetGeolocationApiKey() override;
   content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
   void AllowCertificateError(

+ 3 - 2
atom/browser/atom_browser_context.cc

@@ -72,7 +72,7 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
                                        bool in_memory,
                                        const base::DictionaryValue& options)
     : base::RefCountedDeleteOnSequence<AtomBrowserContext>(
-          base::SequencedTaskRunnerHandle::Get()),
+          base::ThreadTaskRunnerHandle::Get()),
       in_memory_pref_store_(nullptr),
       storage_policy_(new SpecialStoragePolicy),
       in_memory_(in_memory),
@@ -234,7 +234,8 @@ content::BrowserPluginGuestManager* AtomBrowserContext::GetGuestManager() {
   return guest_manager_.get();
 }
 
-content::PermissionManager* AtomBrowserContext::GetPermissionManager() {
+content::PermissionControllerDelegate*
+AtomBrowserContext::GetPermissionControllerDelegate() {
   if (!permission_manager_.get())
     permission_manager_.reset(new AtomPermissionManager);
   return permission_manager_.get();

+ 2 - 1
atom/browser/atom_browser_context.h

@@ -81,7 +81,8 @@ class AtomBrowserContext
   std::string GetMediaDeviceIDSalt() override;
   content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
   content::BrowserPluginGuestManager* GetGuestManager() override;
-  content::PermissionManager* GetPermissionManager() override;
+  content::PermissionControllerDelegate* GetPermissionControllerDelegate()
+      override;
   storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
   net::URLRequestContextGetter* CreateRequestContext(
       content::ProtocolHandlerMap* protocol_handlers,

+ 9 - 13
atom/browser/atom_browser_main_parts.cc

@@ -10,7 +10,6 @@
 #include "atom/browser/api/trackable_object.h"
 #include "atom/browser/atom_browser_client.h"
 #include "atom/browser/atom_browser_context.h"
-#include "atom/browser/bridge_task_runner.h"
 #include "atom/browser/browser.h"
 #include "atom/browser/io_thread.h"
 #include "atom/browser/javascript_environment.h"
@@ -73,7 +72,6 @@ AtomBrowserMainParts::AtomBrowserMainParts(
       browser_(new Browser),
       node_bindings_(NodeBindings::Create(NodeBindings::BROWSER)),
       atom_bindings_(new AtomBindings(uv_default_loop())),
-      gc_timer_(true, true),
       main_function_params_(params) {
   DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
   self_ = this;
@@ -136,18 +134,15 @@ int AtomBrowserMainParts::PreEarlyInitialization() {
 void AtomBrowserMainParts::PostEarlyInitialization() {
   brightray::BrowserMainParts::PostEarlyInitialization();
 
-  // Temporary set the bridge_task_runner_ as current thread's task runner,
-  // so we can fool gin::PerIsolateData to use it as its task runner, instead
-  // of getting current message loop's task runner, which is null for now.
-  bridge_task_runner_ = new BridgeTaskRunner;
-  base::ThreadTaskRunnerHandle handle(bridge_task_runner_);
+  // A workaround was previously needed because there was no ThreadTaskRunner
+  // set.  If this check is failing we may need to re-add that workaround
+  DCHECK(base::ThreadTaskRunnerHandle::IsSet());
 
   // The ProxyResolverV8 has setup a complete V8 environment, in order to
   // 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();
-
   // Create the global environment.
   node::Environment* env = node_bindings_->CreateEnvironment(
       js_env_->context(), js_env_->platform());
@@ -222,8 +217,6 @@ void AtomBrowserMainParts::ToolkitInitialized() {
 }
 
 void AtomBrowserMainParts::PreMainMessageLoopRun() {
-  js_env_->OnMessageLoopCreated();
-
   // Run user's main script before most things get initialized, so we can have
   // a chance to setup everything.
   node_bindings_->PrepareMessageLoop();
@@ -244,8 +237,6 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
 #endif  // BUILDFLAG(ENABLE_PDF_VIEWER)
 
   brightray::BrowserMainParts::PreMainMessageLoopRun();
-  bridge_task_runner_->MessageLoopIsReady();
-  bridge_task_runner_ = nullptr;
 
 #if defined(USE_X11)
   libgtkui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());
@@ -266,6 +257,11 @@ bool AtomBrowserMainParts::MainMessageLoopRun(int* result_code) {
   return brightray::BrowserMainParts::MainMessageLoopRun(result_code);
 }
 
+void AtomBrowserMainParts::PreDefaultMainMessageLoopRun(
+    base::OnceClosure quit_closure) {
+  Browser::SetMainMessageLoopQuitClosure(std::move(quit_closure));
+}
+
 void AtomBrowserMainParts::PostMainMessageLoopStart() {
   brightray::BrowserMainParts::PostMainMessageLoopStart();
 #if defined(OS_POSIX)

+ 2 - 5
atom/browser/atom_browser_main_parts.h

@@ -81,6 +81,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
   void ToolkitInitialized() override;
   void PreMainMessageLoopRun() override;
   bool MainMessageLoopRun(int* result_code) override;
+  void PreDefaultMainMessageLoopRun(base::OnceClosure quit_closure) override;
   void PostMainMessageLoopStart() override;
   void PostMainMessageLoopRun() override;
 #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.
   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.
   int* exit_code_ = nullptr;
 
@@ -125,7 +122,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
   std::unique_ptr<net_log::ChromeNetLog> net_log_;
   std::unique_ptr<IconManager> icon_manager_;
 
-  base::Timer gc_timer_;
+  base::RepeatingTimer gc_timer_;
 
   // List of callbacks should be executed before destroying JS env.
   std::list<base::OnceClosure> destructors_;

+ 0 - 4
atom/browser/atom_browser_main_parts_mac.mm

@@ -4,7 +4,6 @@
 
 #include "atom/browser/atom_browser_main_parts.h"
 
-#include "atom/browser/mac/atom_application.h"
 #include "atom/browser/mac/atom_application_delegate.h"
 #include "base/mac/bundle_locations.h"
 #include "base/mac/foundation_util.h"
@@ -13,9 +12,6 @@
 namespace atom {
 
 void AtomBrowserMainParts::PreMainMessageLoopStart() {
-  // Force the NSApplication subclass to be used.
-  [AtomApplication sharedApplication];
-
   // Set our own application delegate.
   AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
   [NSApp setDelegate:delegate];

+ 1 - 1
atom/browser/atom_download_manager_delegate.cc

@@ -86,7 +86,7 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
   auto* relay =
       web_contents ? NativeWindowRelay::FromWebContents(web_contents) : nullptr;
   if (relay)
-    window = relay->window.get();
+    window = relay->GetNativeWindow();
 
   auto* web_preferences = WebContentsPreferences::From(web_contents);
   bool offscreen =

+ 1 - 1
atom/browser/atom_javascript_dialog_manager.cc

@@ -72,7 +72,7 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
   if (web_preferences && !web_preferences->IsEnabled(options::kOffscreen)) {
     auto* relay = NativeWindowRelay::FromWebContents(web_contents);
     if (relay)
-      window = relay->window.get();
+      window = relay->GetNativeWindow();
   }
 
   atom::ShowMessageBox(

+ 6 - 4
atom/browser/atom_permission_manager.cc

@@ -11,6 +11,7 @@
 #include "atom/browser/atom_browser_main_parts.h"
 #include "atom/browser/web_contents_preferences.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/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
@@ -111,7 +112,8 @@ int AtomPermissionManager::RequestPermission(
     content::RenderFrameHost* render_frame_host,
     const GURL& requesting_origin,
     bool user_gesture,
-    const StatusCallback& response_callback) {
+    const base::Callback<void(blink::mojom::PermissionStatus)>&
+        response_callback) {
   return RequestPermissionWithDetails(permission, render_frame_host,
                                       requesting_origin, user_gesture, nullptr,
                                       response_callback);
@@ -150,7 +152,7 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
     const StatusesCallback& response_callback) {
   if (permissions.empty()) {
     response_callback.Run(std::vector<blink::mojom::PermissionStatus>());
-    return kNoPendingOperation;
+    return content::PermissionController::kNoPendingOperation;
   }
 
   if (request_handler_.is_null()) {
@@ -168,7 +170,7 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
       statuses.push_back(blink::mojom::PermissionStatus::GRANTED);
     }
     response_callback.Run(statuses);
-    return kNoPendingOperation;
+    return content::PermissionController::kNoPendingOperation;
   }
 
   auto* web_contents =
@@ -222,7 +224,7 @@ int AtomPermissionManager::SubscribePermissionStatusChange(
     content::PermissionType permission,
     const GURL& requesting_origin,
     const GURL& embedding_origin,
-    const StatusCallback& callback) {
+    const base::Callback<void(blink::mojom::PermissionStatus)>& callback) {
   return -1;
 }
 

+ 5 - 5
atom/browser/atom_permission_manager.h

@@ -12,7 +12,7 @@
 #include "base/callback.h"
 #include "base/containers/id_map.h"
 #include "base/values.h"
-#include "content/public/browser/permission_manager.h"
+#include "content/public/browser/permission_controller_delegate.h"
 
 namespace content {
 class WebContents;
@@ -20,7 +20,7 @@ class WebContents;
 
 namespace atom {
 
-class AtomPermissionManager : public content::PermissionManager {
+class AtomPermissionManager : public content::PermissionControllerDelegate {
  public:
   AtomPermissionManager();
   ~AtomPermissionManager() override;
@@ -41,7 +41,7 @@ class AtomPermissionManager : public content::PermissionManager {
   void SetPermissionRequestHandler(const RequestHandler& handler);
   void SetPermissionCheckHandler(const CheckHandler& handler);
 
-  // content::PermissionManager:
+  // content::PermissionControllerDelegate:
   int RequestPermission(
       content::PermissionType permission,
       content::RenderFrameHost* render_frame_host,
@@ -55,7 +55,7 @@ class AtomPermissionManager : public content::PermissionManager {
       const GURL& requesting_origin,
       bool user_gesture,
       const base::DictionaryValue* details,
-      const base::Callback<void(blink::mojom::PermissionStatus)>& callback);
+      const StatusCallback& callback);
   int RequestPermissions(
       const std::vector<content::PermissionType>& permissions,
       content::RenderFrameHost* render_frame_host,
@@ -87,7 +87,7 @@ class AtomPermissionManager : public content::PermissionManager {
                             int permission_id,
                             blink::mojom::PermissionStatus status);
 
-  // content::PermissionManager:
+  // content::PermissionControllerDelegate:
   void ResetPermission(content::PermissionType permission,
                        const GURL& requesting_origin,
                        const GURL& embedding_origin) override;

+ 2 - 2
atom/browser/atom_speech_recognition_manager_delegate.cc

@@ -32,11 +32,11 @@ void AtomSpeechRecognitionManagerDelegate::OnRecognitionEnd(int session_id) {}
 
 void AtomSpeechRecognitionManagerDelegate::OnRecognitionResults(
     int session_id,
-    const content::SpeechRecognitionResults& result) {}
+    const std::vector<blink::mojom::SpeechRecognitionResultPtr>& results) {}
 
 void AtomSpeechRecognitionManagerDelegate::OnRecognitionError(
     int session_id,
-    const content::SpeechRecognitionError& error) {}
+    const blink::mojom::SpeechRecognitionError& error) {}
 
 void AtomSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
     int session_id,

+ 3 - 2
atom/browser/atom_speech_recognition_manager_delegate.h

@@ -6,6 +6,7 @@
 #define ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
 
 #include <string>
+#include <vector>
 
 #include "base/macros.h"
 #include "content/public/browser/speech_recognition_event_listener.h"
@@ -30,10 +31,10 @@ class AtomSpeechRecognitionManagerDelegate
   void OnRecognitionEnd(int session_id) override;
   void OnRecognitionResults(
       int session_id,
-      const content::SpeechRecognitionResults& result) override;
+      const std::vector<blink::mojom::SpeechRecognitionResultPtr>&) override;
   void OnRecognitionError(
       int session_id,
-      const content::SpeechRecognitionError& error) override;
+      const blink::mojom::SpeechRecognitionError& error) override;
   void OnAudioLevelsChange(int session_id,
                            float volume,
                            float noise_volume) override;

+ 2 - 2
atom/browser/atom_web_ui_controller_factory.cc

@@ -52,7 +52,7 @@ bool AtomWebUIControllerFactory::UseWebUIBindingsForURL(
   return UseWebUIForURL(browser_context, url);
 }
 
-content::WebUIController*
+std::unique_ptr<content::WebUIController>
 AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
                                                         const GURL& url) const {
 #if BUILDFLAG(ENABLE_PDF_VIEWER)
@@ -78,7 +78,7 @@ AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
     return new PdfViewerUI(browser_context, web_ui, src);
   }
 #endif  // BUILDFLAG(ENABLE_PDF_VIEWER)
-  return nullptr;
+  return std::unique_ptr<content::WebUIController>();
 }
 
 }  // namespace atom

+ 4 - 1
atom/browser/atom_web_ui_controller_factory.h

@@ -5,8 +5,11 @@
 #ifndef 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/memory/singleton.h"
+#include "content/public/browser/web_ui_controller.h"
 #include "content/public/browser/web_ui_controller_factory.h"
 
 namespace atom {
@@ -25,7 +28,7 @@ class AtomWebUIControllerFactory : public content::WebUIControllerFactory {
                       const GURL& url) const override;
   bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
                               const GURL& url) const override;
-  content::WebUIController* CreateWebUIControllerForURL(
+  std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
       content::WebUI* web_ui,
       const GURL& url) const override;
 

+ 0 - 65
atom/browser/bridge_task_runner.cc

@@ -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

+ 0 - 48
atom/browser/bridge_task_runner.h

@@ -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_

+ 11 - 3
atom/browser/browser.cc

@@ -6,6 +6,7 @@
 
 #include <memory>
 #include <string>
+#include <utility>
 
 #include "atom/browser/atom_browser_main_parts.h"
 #include "atom/browser/browser_observer.h"
@@ -14,6 +15,7 @@
 #include "atom/browser/window_list.h"
 #include "base/files/file_util.h"
 #include "base/message_loop/message_loop.h"
+#include "base/no_destructor.h"
 #include "base/path_service.h"
 #include "base/run_loop.h"
 #include "base/threading/thread_restrictions.h"
@@ -23,6 +25,9 @@
 
 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(const LoginItemSettings& other) =
@@ -90,9 +95,8 @@ void Browser::Shutdown() {
   for (BrowserObserver& observer : observers_)
     observer.OnQuit();
 
-  if (base::ThreadTaskRunnerHandle::IsSet()) {
-    base::ThreadTaskRunnerHandle::Get()->PostTask(
-        FROM_HERE, base::RunLoop::QuitCurrentWhenIdleClosureDeprecated());
+  if (*g_quit_main_message_loop) {
+    std::move(*g_quit_main_message_loop).Run();
   } else {
     // There is no message loop available so we are in early stage.
     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() {
   if (is_shutdown_)
     return;

+ 4 - 0
atom/browser/browser.h

@@ -239,6 +239,10 @@ class Browser : public WindowListObserver {
 
   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 RemoveObserver(BrowserObserver* obs) { observers_.RemoveObserver(obs); }

+ 19 - 8
atom/browser/common_web_contents_delegate.cc

@@ -189,24 +189,35 @@ void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
 void CommonWebContentsDelegate::SetOwnerWindow(
     content::WebContents* web_contents,
     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) {
+    owner_window_ = owner_window->GetWeakPtr();
 #if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
     autofill_popup_.reset(new AutofillPopup());
 #endif
-    web_contents->SetUserData(relay_key, std::move(relay));
+    NativeWindowRelay::CreateForWebContents(web_contents,
+                                            owner_window->GetWeakPtr());
   } else {
-    web_contents->RemoveUserData(relay_key);
-    relay.reset();
+    owner_window_ = nullptr;
+    web_contents->RemoveUserData(
+        NativeWindowRelay::kNativeWindowRelayUserDataKey);
   }
 }
 
 void CommonWebContentsDelegate::ResetManagedWebContents(bool async) {
   if (async) {
-    base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
-                                                    web_contents_.release());
+    // Browser context should be destroyed only after the WebContents,
+    // 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 {
     web_contents_.reset();
   }

+ 1 - 1
atom/browser/fake_location_provider.h

@@ -6,7 +6,7 @@
 #define ATOM_BROWSER_FAKE_LOCATION_PROVIDER_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"
 
 namespace atom {

+ 38 - 0
atom/browser/io_thread.cc

@@ -3,13 +3,16 @@
 // found in the LICENSE file.
 
 #include "atom/browser/io_thread.h"
+#include "atom/common/options_switches.h"
 
 #include "components/net_log/chrome_net_log.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/url_request/url_request_context.h"
 #include "net/url_request/url_request_context_builder.h"
 #include "net/url_request/url_request_context_getter.h"
+#include "services/network/network_service.h"
 
 #if defined(USE_NSS_CERTS)
 #include "net/cert_net/nss_ocsp.h"
@@ -24,6 +27,33 @@ using content::BrowserThread;
 
 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) {
   BrowserThread::SetIOThreadDelegate(this);
 }
@@ -33,6 +63,14 @@ IOThread::~IOThread() {
 }
 
 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;
   // TODO(deepak1556): We need to respoect user proxy configurations,
   // the following initialization has to happen before any request

+ 18 - 14
atom/browser/javascript_environment.cc

@@ -19,10 +19,13 @@
 
 namespace atom {
 
-JavascriptEnvironment::JavascriptEnvironment()
-    : initialized_(Initialize()),
-      isolate_holder_(base::ThreadTaskRunnerHandle::Get()),
-      isolate_(isolate_holder_.isolate()),
+JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
+    : isolate_(Initialize(event_loop)),
+      isolate_holder_(base::ThreadTaskRunnerHandle::Get(),
+                      gin::IsolateHolder::kSingleThread,
+                      gin::IsolateHolder::kAllowAtomicsWait,
+                      gin::IsolateHolder::IsolateCreationMode::kNormal,
+                      isolate_),
       isolate_scope_(isolate_),
       locker_(isolate_),
       handle_scope_(isolate_),
@@ -31,15 +34,7 @@ JavascriptEnvironment::JavascriptEnvironment()
 
 JavascriptEnvironment::~JavascriptEnvironment() = default;
 
-void JavascriptEnvironment::OnMessageLoopCreated() {
-  isolate_holder_.AddRunMicrotasksObserver();
-}
-
-void JavascriptEnvironment::OnMessageLoopDestroying() {
-  isolate_holder_.RemoveRunMicrotasksObserver();
-}
-
-bool JavascriptEnvironment::Initialize() {
+v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
   auto* cmd = base::CommandLine::ForCurrentProcess();
 
   // --js-flags.
@@ -54,12 +49,21 @@ bool JavascriptEnvironment::Initialize() {
   platform_ = node::CreatePlatform(
       base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
       tracing_controller);
+
   v8::V8::InitializePlatform(platform_);
   gin::IsolateHolder::Initialize(
       gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras,
       gin::ArrayBufferAllocator::SharedInstance(),
       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) {}

+ 5 - 7
atom/browser/javascript_environment.h

@@ -7,6 +7,7 @@
 
 #include "base/macros.h"
 #include "gin/public/isolate_holder.h"
+#include "uv.h"  // NOLINT(build/include)
 
 namespace node {
 class Environment;
@@ -18,10 +19,9 @@ namespace atom {
 // Manage the V8 isolate and context automatically.
 class JavascriptEnvironment {
  public:
-  JavascriptEnvironment();
+  explicit JavascriptEnvironment(uv_loop_t* event_loop);
   ~JavascriptEnvironment();
 
-  void OnMessageLoopCreated();
   void OnMessageLoopDestroying();
 
   node::MultiIsolatePlatform* platform() const { return platform_; }
@@ -31,18 +31,16 @@ class JavascriptEnvironment {
   }
 
  private:
-  bool Initialize();
-
+  v8::Isolate* Initialize(uv_loop_t* event_loop);
   // Leaked on exit.
   node::MultiIsolatePlatform* platform_;
 
-  bool initialized_;
-  gin::IsolateHolder isolate_holder_;
   v8::Isolate* isolate_;
+  gin::IsolateHolder isolate_holder_;
   v8::Isolate::Scope isolate_scope_;
   v8::Locker locker_;
   v8::HandleScope handle_scope_;
-  v8::UniquePersistent<v8::Context> context_;
+  v8::Global<v8::Context> context_;
   v8::Context::Scope context_scope_;
 
   DISALLOW_COPY_AND_ASSIGN(JavascriptEnvironment);

+ 1 - 1
atom/browser/login_handler.cc

@@ -21,7 +21,7 @@ namespace atom {
 LoginHandler::LoginHandler(
     net::URLRequest* request,
     const net::AuthChallengeInfo& auth_info,
-    const net::NetworkDelegate::AuthCallback& callback,
+    net::NetworkDelegate::AuthCallback callback,
     net::AuthCredentials* credentials,
     const content::ResourceRequestInfo* resource_request_info)
     : credentials_(credentials),

+ 2 - 1
atom/browser/login_handler.h

@@ -8,6 +8,7 @@
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
+#include "base/sequenced_task_runner_helpers.h"
 #include "base/strings/string16.h"
 #include "content/public/browser/resource_request_info.h"
 #include "net/base/network_delegate.h"
@@ -23,7 +24,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
  public:
   LoginHandler(net::URLRequest* request,
                const net::AuthChallengeInfo& auth_info,
-               const net::NetworkDelegate::AuthCallback& callback,
+               net::NetworkDelegate::AuthCallback callback,
                net::AuthCredentials* credentials,
                const content::ResourceRequestInfo* resource_request_info);
 

+ 15 - 3
atom/browser/native_window.cc

@@ -21,8 +21,6 @@
 #include "ui/display/win/screen_win.h"
 #endif
 
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::NativeWindowRelay);
-
 namespace atom {
 
 namespace {
@@ -577,8 +575,22 @@ const views::Widget* NativeWindow::GetWidget() const {
   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)
-    : key(UserDataKey()), window(window) {}
+    : native_window_(window) {}
 
 NativeWindowRelay::~NativeWindowRelay() = default;
 

+ 9 - 7
atom/browser/native_window.h

@@ -346,18 +346,20 @@ class NativeWindow : public base::SupportsUserData,
 class NativeWindowRelay
     : public content::WebContentsUserData<NativeWindowRelay> {
  public:
-  explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window);
-  ~NativeWindowRelay() override;
+  static const void* const kNativeWindowRelayUserDataKey;
 
-  static void* UserDataKey() {
-    return content::WebContentsUserData<NativeWindowRelay>::UserDataKey();
-  }
+  static void CreateForWebContents(content::WebContents*,
+                                   base::WeakPtr<NativeWindow>);
 
-  void* key;
-  base::WeakPtr<NativeWindow> window;
+  ~NativeWindowRelay() override;
+
+  NativeWindow* GetNativeWindow() const { return native_window_.get(); }
 
  private:
   friend class content::WebContentsUserData<NativeWindow>;
+  explicit NativeWindowRelay(base::WeakPtr<NativeWindow> window);
+
+  base::WeakPtr<NativeWindow> native_window_;
 };
 
 }  // namespace atom

+ 1 - 9
atom/browser/native_window_mac.mm

@@ -999,15 +999,7 @@ bool NativeWindowMac::IsKiosk() {
 void NativeWindowMac::SetBackgroundColor(SkColor color) {
   base::ScopedCFTypeRef<CGColorRef> cgcolor(
       skia::CGColorCreateFromSkColor(color));
-  // views::Widget adds a layer for the content view.
-  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];
+  [[[window_ contentView] layer] setBackgroundColor:cgcolor];
 }
 
 void NativeWindowMac::SetHasShadow(bool has_shadow) {

+ 3 - 1
atom/browser/net/asar/url_request_asar_job.cc

@@ -142,7 +142,8 @@ int URLRequestAsarJob::ReadRawData(net::IOBuffer* dest, int dest_size) {
 }
 
 bool URLRequestAsarJob::IsRedirectResponse(GURL* location,
-                                           int* http_status_code) {
+                                           int* http_status_code,
+                                           bool* insecure_scheme_was_upgraded) {
   if (type_ != TYPE_FILE)
     return false;
 #if defined(OS_WIN)
@@ -161,6 +162,7 @@ bool URLRequestAsarJob::IsRedirectResponse(GURL* location,
 
   *location = net::FilePathToFileURL(new_path);
   *http_status_code = 301;
+  *insecure_scheme_was_upgraded = false;
   return true;
 #else
   return false;

+ 3 - 1
atom/browser/net/asar/url_request_asar_job.h

@@ -55,7 +55,9 @@ class URLRequestAsarJob : public net::URLRequestJob {
   void Start() override;
   void Kill() 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;
   bool GetMimeType(std::string* mime_type) const override;
   void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;

+ 10 - 16
atom/browser/net/atom_cert_verifier.cc

@@ -30,14 +30,14 @@ namespace {
 class Response : public base::LinkNode<Response> {
  public:
   Response(net::CertVerifyResult* verify_result,
-           const net::CompletionCallback& callback)
-      : verify_result_(verify_result), callback_(callback) {}
+           net::CompletionOnceCallback callback)
+      : verify_result_(verify_result), callback_(std::move(callback)) {}
   net::CertVerifyResult* verify_result() { return verify_result_; }
-  net::CompletionCallback callback() { return callback_; }
+  net::CompletionOnceCallback callback() { return std::move(callback_); }
 
  private:
   net::CertVerifyResult* verify_result_;
-  net::CompletionCallback callback_;
+  net::CompletionOnceCallback callback_;
 
   DISALLOW_COPY_AND_ASSIGN(Response);
 };
@@ -130,8 +130,8 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
   }
 
   void AddResponseListener(net::CertVerifyResult* verify_result,
-                           const net::CompletionCallback& callback) {
-    response_list_.Append(new Response(verify_result, callback));
+                           net::CompletionOnceCallback callback) {
+    response_list_.Append(new Response(verify_result, std::move(callback)));
   }
 
   const AtomCertVerifier::RequestParams& params() const { return params_; }
@@ -163,15 +163,15 @@ void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) {
 int AtomCertVerifier::Verify(const RequestParams& params,
                              net::CRLSet* crl_set,
                              net::CertVerifyResult* verify_result,
-                             const net::CompletionCallback& callback,
+                             net::CompletionOnceCallback callback,
                              std::unique_ptr<Request>* out_req,
                              const net::NetLogWithSource& net_log) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
   if (verify_proc_.is_null()) {
     ct_delegate_->ClearCTExcludedHostsList();
-    return default_cert_verifier_->Verify(params, crl_set, verify_result,
-                                          callback, out_req, net_log);
+    return default_cert_verifier_->Verify(
+        params, crl_set, verify_result, std::move(callback), out_req, net_log);
   } else {
     CertVerifierRequest* request = FindRequest(params);
     if (!request) {
@@ -182,18 +182,12 @@ int AtomCertVerifier::Verify(const RequestParams& params,
       *out_req = std::move(new_request);
       inflight_requests_[params] = request;
     }
-    request->AddResponseListener(verify_result, callback);
+    request->AddResponseListener(verify_result, std::move(callback));
 
     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) {
   auto it = inflight_requests_.find(params);
   if (it != inflight_requests_.end())

+ 2 - 3
atom/browser/net/atom_cert_verifier.h

@@ -38,7 +38,7 @@ class AtomCertVerifier : public net::CertVerifier {
   ~AtomCertVerifier() override;
 
   using VerifyProc = base::Callback<void(const VerifyRequestParams& request,
-                                         const net::CompletionCallback&)>;
+                                         net::CompletionOnceCallback)>;
 
   void SetVerifyProc(const VerifyProc& proc);
 
@@ -53,10 +53,9 @@ class AtomCertVerifier : public net::CertVerifier {
   int Verify(const RequestParams& params,
              net::CRLSet* crl_set,
              net::CertVerifyResult* verify_result,
-             const net::CompletionCallback& callback,
+             net::CompletionOnceCallback callback,
              std::unique_ptr<Request>* out_req,
              const net::NetLogWithSource& net_log) override;
-  bool SupportsOCSPStapling() override;
 
  private:
   friend class CertVerifierRequest;

+ 18 - 25
atom/browser/net/atom_network_delegate.cc

@@ -20,10 +20,8 @@
 #include "net/base/load_flags.h"
 #include "net/base/net_errors.h"
 #include "net/url_request/url_request.h"
-#include "services/network/throttling/throttling_network_transaction.h"
 
 using content::BrowserThread;
-using network::ThrottlingNetworkTransaction;
 
 namespace atom {
 
@@ -269,14 +267,9 @@ void AtomNetworkDelegate::SetResponseListenerInIO(ResponseEvent type,
     response_listeners_[type] = {std::move(patterns), std::move(callback)};
 }
 
-void AtomNetworkDelegate::SetDevToolsNetworkEmulationClientId(
-    const std::string& client_id) {
-  client_id_ = client_id;
-}
-
 int AtomNetworkDelegate::OnBeforeURLRequest(
     net::URLRequest* request,
-    const net::CompletionCallback& callback,
+    net::CompletionOnceCallback callback,
     GURL* new_url) {
   if (!base::ContainsKey(response_listeners_, kOnBeforeRequest)) {
     for (const auto& domain : ignore_connections_limit_domains_) {
@@ -290,22 +283,19 @@ int AtomNetworkDelegate::OnBeforeURLRequest(
     return net::OK;
   }
 
-  return HandleResponseEvent(kOnBeforeRequest, request, callback, new_url);
+  return HandleResponseEvent(kOnBeforeRequest, request, std::move(callback),
+                             new_url);
 }
 
 int AtomNetworkDelegate::OnBeforeStartTransaction(
     net::URLRequest* request,
-    const net::CompletionCallback& callback,
+    net::CompletionOnceCallback callback,
     net::HttpRequestHeaders* headers) {
-  if (!client_id_.empty())
-    headers->SetHeader(network::ThrottlingNetworkTransaction::
-                           kDevToolsEmulateNetworkConditionsClientId,
-                       client_id_);
   if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders))
     return net::OK;
 
-  return HandleResponseEvent(kOnBeforeSendHeaders, request, callback, headers,
-                             *headers);
+  return HandleResponseEvent(kOnBeforeSendHeaders, request, std::move(callback),
+                             headers, *headers);
 }
 
 void AtomNetworkDelegate::OnStartTransaction(
@@ -319,7 +309,7 @@ void AtomNetworkDelegate::OnStartTransaction(
 
 int AtomNetworkDelegate::OnHeadersReceived(
     net::URLRequest* request,
-    const net::CompletionCallback& callback,
+    net::CompletionOnceCallback callback,
     const net::HttpResponseHeaders* original,
     scoped_refptr<net::HttpResponseHeaders>* override,
     GURL* allowed) {
@@ -327,7 +317,7 @@ int AtomNetworkDelegate::OnHeadersReceived(
     return net::OK;
 
   return HandleResponseEvent(
-      kOnHeadersReceived, request, callback,
+      kOnHeadersReceived, request, std::move(callback),
       std::make_pair(override, original->GetStatusLine()), original);
 }
 
@@ -353,14 +343,16 @@ void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request,
                     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.
   callbacks_.erase(request->identifier());
 
   if (request->status().status() == net::URLRequestStatus::FAILED ||
       request->status().status() == net::URLRequestStatus::CANCELED) {
     // Error event.
-    OnErrorOccurred(request, started);
+    OnErrorOccurred(request, started, net_error);
     return;
   }
 
@@ -391,7 +383,7 @@ void AtomNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
 net::NetworkDelegate::AuthRequiredResponse AtomNetworkDelegate::OnAuthRequired(
     net::URLRequest* request,
     const net::AuthChallengeInfo& auth_info,
-    const AuthCallback& callback,
+    AuthCallback callback,
     net::AuthCredentials* credentials) {
   auto* resource_request_info =
       content::ResourceRequestInfo::ForRequest(request);
@@ -462,7 +454,8 @@ bool AtomNetworkDelegate::OnCanUseReportingClient(const url::Origin& origin,
 }
 
 void AtomNetworkDelegate::OnErrorOccurred(net::URLRequest* request,
-                                          bool started) {
+                                          bool started,
+                                          int net_error) {
   if (!base::ContainsKey(simple_listeners_, kOnErrorOccurred))
     return;
 
@@ -474,7 +467,7 @@ template <typename Out, typename... Args>
 int AtomNetworkDelegate::HandleResponseEvent(
     ResponseEvent type,
     net::URLRequest* request,
-    const net::CompletionCallback& callback,
+    net::CompletionOnceCallback callback,
     Out out,
     Args... args) {
   const auto& info = response_listeners_[type];
@@ -489,7 +482,7 @@ int AtomNetworkDelegate::HandleResponseEvent(
       request, &render_process_id, &render_frame_id);
 
   // The |request| could be destroyed before the |callback| is called.
-  callbacks_[request->identifier()] = callback;
+  callbacks_[request->identifier()] = std::move(callback);
 
   ResponseCallback response =
       base::Bind(&AtomNetworkDelegate::OnListenerResultInUI<Out>,
@@ -535,7 +528,7 @@ void AtomNetworkDelegate::OnListenerResultInIO(
 
   bool cancel = false;
   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>

+ 10 - 13
atom/browser/net/atom_network_delegate.h

@@ -79,15 +79,13 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
                                URLPatterns patterns,
                                ResponseListener callback);
 
-  void SetDevToolsNetworkEmulationClientId(const std::string& client_id);
-
  protected:
   // net::NetworkDelegate:
   int OnBeforeURLRequest(net::URLRequest* request,
-                         const net::CompletionCallback& callback,
+                         net::CompletionOnceCallback callback,
                          GURL* new_url) override;
   int OnBeforeStartTransaction(net::URLRequest* request,
-                               const net::CompletionCallback& callback,
+                               net::CompletionOnceCallback callback,
                                net::HttpRequestHeaders* headers) override;
   void OnBeforeSendHeaders(net::URLRequest* request,
                            const net::ProxyInfo& proxy_info,
@@ -97,7 +95,7 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
                           const net::HttpRequestHeaders& headers) override;
   int OnHeadersReceived(
       net::URLRequest* request,
-      const net::CompletionCallback& callback,
+      net::CompletionOnceCallback callback,
       const net::HttpResponseHeaders* original_response_headers,
       scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
       GURL* allowed_unsafe_redirect_url) override;
@@ -108,14 +106,16 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
                               int64_t bytes_read) override {}
   void OnNetworkBytesSent(net::URLRequest* request,
                           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 OnPACScriptError(int line_number, const base::string16& error) override {
   }
   AuthRequiredResponse OnAuthRequired(
       net::URLRequest* request,
       const net::AuthChallengeInfo& auth_info,
-      const AuthCallback& callback,
+      AuthCallback callback,
       net::AuthCredentials* credentials) override;
   bool OnCanGetCookies(const net::URLRequest& request,
                        const net::CookieList& cookie_list) override;
@@ -143,7 +143,7 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
                                const GURL& endpoint) const override;
 
  private:
-  void OnErrorOccurred(net::URLRequest* request, bool started);
+  void OnErrorOccurred(net::URLRequest* request, bool started, int net_error);
 
   template <typename... Args>
   void HandleSimpleEvent(SimpleEvent type,
@@ -152,7 +152,7 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
   template <typename Out, typename... Args>
   int HandleResponseEvent(ResponseEvent type,
                           net::URLRequest* request,
-                          const net::CompletionCallback& callback,
+                          net::CompletionOnceCallback callback,
                           Out out,
                           Args... args);
 
@@ -169,12 +169,9 @@ class AtomNetworkDelegate : public net::NetworkDelegate {
   std::map<uint64_t, scoped_refptr<LoginHandler>> login_handler_map_;
   std::map<SimpleEvent, SimpleListenerInfo> simple_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_;
 
-  // Client id for devtools network emulation.
-  std::string client_id_;
-
   DISALLOW_COPY_AND_ASSIGN(AtomNetworkDelegate);
 };
 

+ 2 - 1
atom/browser/net/atom_url_request.cc

@@ -267,7 +267,8 @@ void AtomURLRequest::DoCancel() {
 void AtomURLRequest::DoFollowRedirect() {
   DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
   if (request_ && request_->is_redirecting() && redirect_policy_ == "manual") {
-    request_->FollowDeferredRedirect();
+    request_->FollowDeferredRedirect(
+        base::nullopt /* modified_request_headers */);
   }
 }
 

+ 10 - 49
atom/browser/net/url_request_context_getter.cc

@@ -17,7 +17,6 @@
 #include "atom/browser/net/atom_network_delegate.h"
 #include "atom/browser/net/atom_url_request_job_factory.h"
 #include "atom/browser/net/http_protocol_handler.h"
-#include "atom/common/options_switches.h"
 #include "base/command_line.h"
 #include "base/strings/string_util.h"
 #include "base/task_scheduler/post_task.h"
@@ -83,7 +82,6 @@ network::mojom::NetworkContextParamsPtr CreateDefaultNetworkContextParams(
   network_context_params->accept_language =
       net::HttpUtil::GenerateAcceptLanguageHeader(
           brightray::BrowserClient::Get()->GetApplicationLocale());
-  network_context_params->allow_gssapi_library_load = true;
   network_context_params->enable_data_url_support = false;
   network_context_params->proxy_resolver_factory =
       ChromeMojoProxyResolverFactory::CreateWithStrongBinding().PassInterface();
@@ -185,12 +183,6 @@ class ResourceContext : public content::ResourceContext {
   ResourceContext() = default;
   ~ResourceContext() override = default;
 
-  net::HostResolver* GetHostResolver() override {
-    if (request_context_)
-      return request_context_->host_resolver();
-    return nullptr;
-  }
-
   net::URLRequestContext* GetRequestContext() override {
     return request_context_;
   }
@@ -226,8 +218,7 @@ URLRequestContextGetter::Handle::CreateMainRequestContextGetter(
   DCHECK(!main_request_context_getter_.get());
   LazyInitialize();
   main_request_context_getter_ = new URLRequestContextGetter(
-      AtomBrowserClient::Get()->GetNetLog(), this, protocol_handlers,
-      std::move(protocol_interceptors));
+      this, protocol_handlers, std::move(protocol_interceptors));
   return main_request_context_getter_;
 }
 
@@ -284,12 +275,10 @@ void URLRequestContextGetter::Handle::ShutdownOnUIThread() {
 }
 
 URLRequestContextGetter::URLRequestContextGetter(
-    net::NetLog* net_log,
     URLRequestContextGetter::Handle* context_handle,
     content::ProtocolHandlerMap* protocol_handlers,
     content::URLRequestInterceptorScopedVector protocol_interceptors)
-    : net_log_(net_log),
-      context_handle_(context_handle),
+    : context_handle_(context_handle),
       url_request_context_(nullptr),
       protocol_interceptors_(std::move(protocol_interceptors)),
       context_shutting_down_(false) {
@@ -322,10 +311,11 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
     return nullptr;
 
   if (!url_request_context_) {
-    auto& command_line = *base::CommandLine::ForCurrentProcess();
     std::unique_ptr<network::URLRequestContextBuilderMojo> builder =
         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);
     auto cert_verifier = std::make_unique<AtomCertVerifier>(ct_delegate_.get());
@@ -334,42 +324,13 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
     builder->SetCreateHttpTransactionFactoryCallback(
         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>());
 
-    network_context_ =
-        content::GetNetworkServiceImpl()->CreateNetworkContextWithBuilder(
-            std::move(context_handle_->main_network_context_request_),
-            std::move(context_handle_->main_network_context_params_),
-            std::move(builder), &url_request_context_);
+    auto* network_service = content::GetNetworkServiceImpl();
+    network_context_ = network_service->CreateNetworkContextWithBuilder(
+        std::move(context_handle_->main_network_context_request_),
+        std::move(context_handle_->main_network_context_params_),
+        std::move(builder), &url_request_context_);
 
     net::TransportSecurityState* transport_security_state =
         url_request_context_->transport_security_state();

+ 4 - 6
atom/browser/net/url_request_context_getter.h

@@ -23,13 +23,10 @@ namespace brightray {
 class RequireCTDelegate;
 }  // namespace brightray
 
-namespace net {
-class NetLog;
-}
-
 namespace atom {
 
 class AtomBrowserContext;
+class AtomNetworkDelegate;
 class AtomURLRequestJobFactory;
 class ResourceContext;
 
@@ -48,6 +45,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
     return top_job_factory_.get();
   }
 
+  AtomNetworkDelegate* network_delegate() const { return network_delegate_; }
+
  private:
   friend class AtomBrowserContext;
 
@@ -88,7 +87,6 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
   };
 
   URLRequestContextGetter(
-      net::NetLog* net_log,
       URLRequestContextGetter::Handle* context_handle,
       content::ProtocolHandlerMap* protocol_handlers,
       content::URLRequestInterceptorScopedVector protocol_interceptors);
@@ -102,9 +100,9 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
   std::unique_ptr<AtomURLRequestJobFactory> top_job_factory_;
   std::unique_ptr<network::mojom::NetworkContext> network_context_;
 
-  net::NetLog* net_log_;
   URLRequestContextGetter::Handle* context_handle_;
   net::URLRequestContext* url_request_context_;
+  AtomNetworkDelegate* network_delegate_;
   content::ProtocolHandlerMap protocol_handlers_;
   content::URLRequestInterceptorScopedVector protocol_interceptors_;
   bool context_shutting_down_;

+ 2 - 2
atom/browser/special_storage_policy.cc

@@ -37,9 +37,9 @@ bool SpecialStoragePolicy::HasSessionOnlyOrigins() {
   return false;
 }
 
-storage::SpecialStoragePolicy::DeleteCookiePredicate
+network::SessionCleanupCookieStore::DeleteCookiePredicate
 SpecialStoragePolicy::CreateDeleteCookieOnExitPredicate() {
-  return storage::SpecialStoragePolicy::DeleteCookiePredicate();
+  return network::SessionCleanupCookieStore::DeleteCookiePredicate();
 }
 
 }  // namespace atom

+ 1 - 1
atom/browser/special_storage_policy.h

@@ -20,7 +20,7 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
   bool HasIsolatedStorage(const GURL& origin) override;
   bool IsStorageSessionOnly(const GURL& origin) override;
   bool HasSessionOnlyOrigins() override;
-  storage::SpecialStoragePolicy::DeleteCookiePredicate
+  network::SessionCleanupCookieStore::DeleteCookiePredicate
   CreateDeleteCookieOnExitPredicate() override;
 
  protected:

+ 0 - 1
atom/browser/ui/accelerator_util.cc

@@ -64,7 +64,6 @@ bool StringToAccelerator(const std::string& shortcut,
   }
 
   *accelerator = ui::Accelerator(key, modifiers);
-  SetPlatformAccelerator(accelerator);
   return true;
 }
 

+ 0 - 3
atom/browser/ui/accelerator_util.h

@@ -23,9 +23,6 @@ typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
 bool StringToAccelerator(const std::string& description,
                          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.
 void GenerateAcceleratorTable(AcceleratorTable* table,
                               atom::AtomMenuModel* model);

+ 0 - 46
atom/browser/ui/accelerator_util_mac.mm

@@ -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

+ 0 - 13
atom/browser/ui/accelerator_util_views.cc

@@ -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

+ 6 - 8
atom/browser/ui/cocoa/atom_menu_controller.mm

@@ -239,14 +239,12 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
     ui::Accelerator accelerator;
     if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_,
                                           &accelerator)) {
-      const ui::PlatformAcceleratorCocoa* platformAccelerator =
-          static_cast<const ui::PlatformAcceleratorCocoa*>(
-              accelerator.platform_accelerator());
-      if (platformAccelerator) {
-        [item setKeyEquivalent:platformAccelerator->characters()];
-        [item
-            setKeyEquivalentModifierMask:platformAccelerator->modifier_mask()];
-      }
+      NSString* key_equivalent;
+      NSUInteger modifier_mask;
+      GetKeyEquivalentAndModifierMaskFromAccelerator(
+          accelerator, &key_equivalent, &modifier_mask);
+      [item setKeyEquivalent:key_equivalent];
+      [item setKeyEquivalentModifierMask:modifier_mask];
     }
 
     // Set menu item's role.

+ 12 - 10
atom/browser/web_contents_permission_helper.cc

@@ -36,9 +36,10 @@ namespace atom {
 namespace {
 
 void MediaAccessAllowed(const content::MediaStreamRequest& request,
-                        const content::MediaResponseCallback& callback,
+                        content::MediaResponseCallback callback,
                         bool allowed) {
-  brightray::MediaStreamDevicesController controller(request, callback);
+  brightray::MediaStreamDevicesController controller(request,
+                                                     std::move(callback));
   if (allowed)
     controller.TakeAction();
   else
@@ -50,7 +51,7 @@ void OnPointerLockResponse(content::WebContents* web_contents, bool allowed) {
     web_contents->GotResponseToLockMouseRequest(allowed);
 }
 
-void OnPermissionResponse(const base::Callback<void(bool)>& callback,
+void OnPermissionResponse(base::Callback<void(bool)> callback,
                           blink::mojom::PermissionStatus status) {
   if (status == blink::mojom::PermissionStatus::GRANTED)
     callback.Run(true);
@@ -73,11 +74,11 @@ void WebContentsPermissionHelper::RequestPermission(
     const base::DictionaryValue* details) {
   auto* rfh = web_contents_->GetMainFrame();
   auto* permission_manager = static_cast<AtomPermissionManager*>(
-      web_contents_->GetBrowserContext()->GetPermissionManager());
+      web_contents_->GetBrowserContext()->GetPermissionControllerDelegate());
   auto origin = web_contents_->GetLastCommittedURL();
   permission_manager->RequestPermissionWithDetails(
       permission, rfh, origin, false, details,
-      base::Bind(&OnPermissionResponse, callback));
+      base::Bind(&OnPermissionResponse, std::move(callback)));
 }
 
 bool WebContentsPermissionHelper::CheckPermission(
@@ -85,7 +86,7 @@ bool WebContentsPermissionHelper::CheckPermission(
     const base::DictionaryValue* details) const {
   auto* rfh = web_contents_->GetMainFrame();
   auto* permission_manager = static_cast<AtomPermissionManager*>(
-      web_contents_->GetBrowserContext()->GetPermissionManager());
+      web_contents_->GetBrowserContext()->GetPermissionControllerDelegate());
   auto origin = web_contents_->GetLastCommittedURL();
   return permission_manager->CheckPermissionWithDetails(permission, rfh, origin,
                                                         details);
@@ -100,8 +101,9 @@ void WebContentsPermissionHelper::RequestFullscreenPermission(
 
 void WebContentsPermissionHelper::RequestMediaAccessPermission(
     const content::MediaStreamRequest& request,
-    const content::MediaResponseCallback& response_callback) {
-  auto callback = base::Bind(&MediaAccessAllowed, request, response_callback);
+    content::MediaResponseCallback response_callback) {
+  auto callback = base::AdaptCallbackForRepeating(base::BindOnce(
+      &MediaAccessAllowed, request, std::move(response_callback)));
 
   base::DictionaryValue details;
   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
   // are presented as same type in content_converter.h.
-  RequestPermission(content::PermissionType::AUDIO_CAPTURE, callback, false,
-                    &details);
+  RequestPermission(content::PermissionType::AUDIO_CAPTURE, std::move(callback),
+                    false, &details);
 }
 
 void WebContentsPermissionHelper::RequestWebNotificationPermission(

+ 1 - 1
atom/browser/web_contents_permission_helper.h

@@ -27,7 +27,7 @@ class WebContentsPermissionHelper
   void RequestFullscreenPermission(const base::Callback<void(bool)>& callback);
   void RequestMediaAccessPermission(
       const content::MediaStreamRequest& request,
-      const content::MediaResponseCallback& callback);
+      content::MediaResponseCallback callback);
   void RequestWebNotificationPermission(
       const base::Callback<void(bool)>& callback);
   void RequestPointerLockPermission(bool user_gesture);

+ 1 - 1
atom/browser/web_contents_preferences.cc

@@ -329,7 +329,7 @@ void WebContentsPreferences::AppendCommandLineSwitches(
       if (embedder) {
         auto* relay = NativeWindowRelay::FromWebContents(embedder);
         if (relay) {
-          auto* window = relay->window.get();
+          auto* window = relay->GetNativeWindow();
           if (window) {
             const bool visible = window->IsVisible() && !window->IsMinimized();
             if (!visible) {

+ 1 - 1
atom/common/chrome_version.h

@@ -8,7 +8,7 @@
 #ifndef 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
 
 #endif  // ATOM_COMMON_CHROME_VERSION_H_

+ 4 - 6
atom/common/native_mate_converters/net_converter.cc

@@ -90,11 +90,11 @@ v8::Local<v8::Value> Converter<scoped_refptr<net::X509Certificate>>::ToV8(
     issuer_intermediates.reserve(intermediate_buffers.size() - 1);
     for (size_t i = 1; i < intermediate_buffers.size(); ++i) {
       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 =
         net::X509Certificate::CreateFromBuffer(
-            net::x509_util::DupCryptoBuffer(intermediate_buffers[0].get()),
+            bssl::UpRef(intermediate_buffers[0].get()),
             std::move(issuer_intermediates));
     dict.Set("issuerCert", issuer_cert);
   }
@@ -119,11 +119,9 @@ bool Converter<scoped_refptr<net::X509Certificate>>::FromV8(
   scoped_refptr<net::X509Certificate> issuer_cert;
   if (dict.Get("issuerCert", &issuer_cert)) {
     std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
-    intermediates.push_back(
-        net::x509_util::DupCryptoBuffer(issuer_cert->cert_buffer()));
+    intermediates.push_back(bssl::UpRef(issuer_cert->cert_buffer()));
     auto cert = net::X509Certificate::CreateFromBuffer(
-        net::x509_util::DupCryptoBuffer(leaf_cert->cert_buffer()),
-        std::move(intermediates));
+        bssl::UpRef(leaf_cert->cert_buffer()), std::move(intermediates));
     if (!cert)
       return false;
 

+ 7 - 0
brightray/browser/browser_main_parts.cc

@@ -192,6 +192,13 @@ void BrowserMainParts::InitializeFeatureList() {
   enable_features += std::string(",") + features::kSharedArrayBuffer.name;
   auto disable_features =
       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>();
   feature_list->InitializeFromCommandLine(enable_features, disable_features);
   base::FeatureList::SetInstance(std::move(feature_list));

+ 14 - 19
brightray/browser/media/media_stream_devices_controller.cc

@@ -5,6 +5,7 @@
 #include "brightray/browser/media/media_stream_devices_controller.h"
 
 #include <memory>
+#include <utility>
 
 #include "brightray/browser/media/media_capture_devices_dispatcher.h"
 #include "content/public/browser/desktop_media_id.h"
@@ -27,9 +28,9 @@ bool HasAnyAvailableDevice() {
 
 MediaStreamDevicesController::MediaStreamDevicesController(
     const content::MediaStreamRequest& request,
-    const content::MediaResponseCallback& callback)
+    content::MediaResponseCallback callback)
     : request_(request),
-      callback_(callback),
+      callback_(std::move(callback)),
       // For MEDIA_OPEN_DEVICE requests (Pepper) we always request both webcam
       // and microphone to avoid popping two infobars.
       microphone_requested_(
@@ -41,9 +42,9 @@ MediaStreamDevicesController::MediaStreamDevicesController(
 
 MediaStreamDevicesController::~MediaStreamDevicesController() {
   if (!callback_.is_null()) {
-    callback_.Run(content::MediaStreamDevices(),
-                  content::MEDIA_DEVICE_INVALID_STATE,
-                  std::unique_ptr<content::MediaStreamUI>());
+    std::move(callback_).Run(content::MediaStreamDevices(),
+                             content::MEDIA_DEVICE_INVALID_STATE,
+                             std::unique_ptr<content::MediaStreamUI>());
   }
 }
 
@@ -140,18 +141,14 @@ void MediaStreamDevicesController::Accept() {
     }
   }
 
-  content::MediaResponseCallback cb = callback_;
-  callback_.Reset();
-  cb.Run(devices, content::MEDIA_DEVICE_OK,
-         std::unique_ptr<content::MediaStreamUI>());
+  std::move(callback_).Run(devices, content::MEDIA_DEVICE_OK,
+                           std::unique_ptr<content::MediaStreamUI>());
 }
 
 void MediaStreamDevicesController::Deny(
     content::MediaStreamRequestResult result) {
-  content::MediaResponseCallback cb = callback_;
-  callback_.Reset();
-  cb.Run(content::MediaStreamDevices(), result,
-         std::unique_ptr<content::MediaStreamUI>());
+  std::move(callback_).Run(content::MediaStreamDevices(), result,
+                           std::unique_ptr<content::MediaStreamUI>());
 }
 
 void MediaStreamDevicesController::HandleUserMediaRequest() {
@@ -185,12 +182,10 @@ void MediaStreamDevicesController::HandleUserMediaRequest() {
         content::MEDIA_DESKTOP_VIDEO_CAPTURE, screen_id.ToString(), "Screen"));
   }
 
-  content::MediaResponseCallback cb = callback_;
-  callback_.Reset();
-  cb.Run(devices,
-         devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE
-                         : content::MEDIA_DEVICE_OK,
-         std::unique_ptr<content::MediaStreamUI>());
+  std::move(callback_).Run(devices,
+                           devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE
+                                           : content::MEDIA_DEVICE_OK,
+                           std::unique_ptr<content::MediaStreamUI>());
 }
 
 }  // namespace brightray

+ 1 - 1
brightray/browser/media/media_stream_devices_controller.h

@@ -12,7 +12,7 @@ namespace brightray {
 class MediaStreamDevicesController {
  public:
   MediaStreamDevicesController(const content::MediaStreamRequest& request,
-                               const content::MediaResponseCallback& callback);
+                               content::MediaResponseCallback callback);
 
   virtual ~MediaStreamDevicesController();
 

+ 2 - 0
brightray/browser/notification_presenter.cc

@@ -4,6 +4,8 @@
 
 #include "brightray/browser/notification_presenter.h"
 
+#include <algorithm>
+
 #include "brightray/browser/notification.h"
 
 namespace brightray {

+ 14 - 23
brightray/browser/platform_notification_service.cc

@@ -10,6 +10,7 @@
 #include "brightray/browser/notification_delegate.h"
 #include "brightray/browser/notification_presenter.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/platform_notification_data.h"
 #include "third_party/skia/include/core/SkBitmap.h"
@@ -49,7 +50,7 @@ class NotificationDelegateImpl final : public brightray::NotificationDelegate {
 
   void NotificationClick() override {
     content::NotificationEventDispatcher::GetInstance()
-        ->DispatchNonPersistentClickEvent(notification_id_);
+        ->DispatchNonPersistentClickEvent(notification_id_, base::DoNothing());
   }
 
   void NotificationClosed() override {
@@ -72,29 +73,12 @@ class NotificationDelegateImpl final : public brightray::NotificationDelegate {
 
 PlatformNotificationService::PlatformNotificationService(
     BrowserClient* browser_client)
-    : browser_client_(browser_client), render_process_id_(-1) {}
+    : browser_client_(browser_client) {}
 
 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(
+    content::RenderProcessHost* render_process_host,
     content::BrowserContext* browser_context,
     const std::string& notification_id,
     const GURL& origin,
@@ -108,9 +92,10 @@ void PlatformNotificationService::DisplayNotification(
   auto notification = presenter->CreateNotification(delegate, notification_id);
   if (notification) {
     browser_client_->WebNotificationAllowed(
-        render_process_id_, base::Bind(&OnWebNotificationAllowed, notification,
-                                       notification_resources.notification_icon,
-                                       notification_data));
+        render_process_host->GetID(),
+        base::Bind(&OnWebNotificationAllowed, notification,
+                   notification_resources.notification_icon,
+                   notification_data));
   }
 }
 
@@ -139,4 +124,10 @@ void PlatformNotificationService::GetDisplayedNotifications(
     content::BrowserContext* browser_context,
     const DisplayedNotificationsCallback& callback) {}
 
+int64_t PlatformNotificationService::ReadNextPersistentNotificationId(
+    content::BrowserContext* browser_context) {
+  // Electron doesn't support persistent notifications.
+  return 0;
+}
+
 }  // namespace brightray

+ 3 - 9
brightray/browser/platform_notification_service.h

@@ -23,15 +23,8 @@ class PlatformNotificationService
 
  protected:
   // 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(
+      content::RenderProcessHost* render_process_host,
       content::BrowserContext* browser_context,
       const std::string& notification_id,
       const GURL& origin,
@@ -51,10 +44,11 @@ class PlatformNotificationService
   void GetDisplayedNotifications(
       content::BrowserContext* browser_context,
       const DisplayedNotificationsCallback& callback) override;
+  int64_t ReadNextPersistentNotificationId(
+      content::BrowserContext* browser_context) override;
 
  private:
   BrowserClient* browser_client_;
-  int render_process_id_;
 
   DISALLOW_COPY_AND_ASSIGN(PlatformNotificationService);
 };

+ 5 - 5
brightray/browser/web_ui_controller_factory.cc

@@ -49,14 +49,14 @@ bool WebUIControllerFactory::UseWebUIBindingsForURL(
   return UseWebUIForURL(browser_context, url);
 }
 
-content::WebUIController* WebUIControllerFactory::CreateWebUIControllerForURL(
-    content::WebUI* web_ui,
-    const GURL& url) const {
+std::unique_ptr<content::WebUIController>
+WebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
+                                                    const GURL& url) const {
   if (url.host() == kChromeUIDevToolsBundledHost) {
     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

+ 3 - 1
brightray/browser/web_ui_controller_factory.h

@@ -5,6 +5,8 @@
 #ifndef BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
 #define BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "content/public/browser/web_ui.h"
 #include "content/public/browser/web_ui_controller_factory.h"
@@ -31,7 +33,7 @@ class WebUIControllerFactory : public content::WebUIControllerFactory {
                       const GURL& url) const override;
   bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
                               const GURL& url) const override;
-  content::WebUIController* CreateWebUIControllerForURL(
+  std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
       content::WebUI* web_ui,
       const GURL& url) const override;
 

+ 3 - 0
build/args/release.gn

@@ -3,6 +3,9 @@ is_component_build = false
 is_official_build = 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
 # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
 # explicitly override here to build OpenH264 encoder/FFmpeg decoder.

+ 2 - 1
build/zip.py

@@ -41,7 +41,8 @@ def main(argv):
   if sys.platform == 'darwin':
     execute(['zip', '-r', '-y', dist_zip] + list(dist_files))
   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:
         if skip_path(dep):
           continue

+ 1 - 1
buildflags/buildflags.gni

@@ -8,7 +8,7 @@ declare_args() {
   # Allow running Electron as a node binary.
   enable_run_as_node = true
 
-  enable_osr = true
+  enable_osr = false
 
   enable_view_api = false
 

+ 2 - 0
chromium_src/chrome/browser/printing/pdf_to_emf_converter.cc

@@ -608,8 +608,10 @@ bool PdfConverterUtilityProcessHostClient::OnMessageReceived(
         ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, OnPageCount)
     IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
                         OnPageDone)
+#if 0
     IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PreCacheFontCharacters,
                         OnPreCacheFontCharacters)
+#endif
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   return handled;

+ 2 - 0
chromium_src/chrome/common/chrome_utility_printing_messages.h

@@ -89,9 +89,11 @@ IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone,
 // Request that the given font characters be loaded by the browser so it's
 // cached by the OS. Please see
 // PdfToEmfUtilityProcessHostClient::OnPreCacheFontCharacters for details.
+#if 0
 IPC_SYNC_MESSAGE_CONTROL2_0(ChromeUtilityHostMsg_PreCacheFontCharacters,
                             LOGFONT /* font_data */,
                             base::string16 /* characters */)
+#endif
 
 // Tell the utility process to start rendering the given PDF into a metafile.
 // Utility process would be alive until

+ 9 - 6
chromium_src/chrome/renderer/printing/print_web_view_helper.cc

@@ -32,9 +32,9 @@
 #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_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_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_document.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& content_area,
                                             double scale_factor,
-                                            blink::WebCanvas* canvas) {
+                                            cc::PaintCanvas* canvas) {
   cc::PaintCanvasAutoRestore auto_restore(canvas, true);
   canvas->translate((content_area.x() - canvas_area.x()) / 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
 // the size of the view temporarily to support full page printing..
 class PrepareFrameAndViewForPrint : public blink::WebViewClient,
-                                    public blink::WebFrameClient {
+                                    public blink::WebLocalFrameClient,
+                                    public blink::WebWidgetClient {
  public:
   PrepareFrameAndViewForPrint(const PrintMsg_Print_Params& params,
                               blink::WebLocalFrame* frame,
@@ -368,6 +369,8 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
   // Prepares frame for printing.
   void StartPrinting();
 
+  blink::WebWidgetClient* WidgetClient() override { return this; }
+
   blink::WebLocalFrame* frame() { return frame_.GetFrame(); }
 
   const blink::WebNode& node() const { return node_to_print_; }
@@ -386,7 +389,7 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
   void DidStopLoading() override;
   bool AllowsBrokenNullLayerTreeView() const override;
 
-  // blink::WebFrameClient:
+  // blink::WebLocalFrameClient:
   blink::WebLocalFrame* CreateChildFrame(
       blink::WebLocalFrame* parent,
       blink::WebTreeScopeType scope,
@@ -512,7 +515,7 @@ void PrepareFrameAndViewForPrint::CopySelection(
   prefs.javascript_enabled = false;
 
   blink::WebView* web_view = blink::WebView::Create(
-      this, blink::mojom::PageVisibilityState::kVisible, nullptr);
+      this, this, blink::mojom::PageVisibilityState::kVisible, nullptr);
   owns_web_view_ = true;
   content::RenderView::ApplyWebPreferences(prefs, web_view);
   blink::WebLocalFrame* main_frame =
@@ -523,7 +526,7 @@ void PrepareFrameAndViewForPrint::CopySelection(
 
   // When loading is done this will call DidStopLoading() and that will do the
   // actual printing.
-  frame()->LoadRequest(blink::WebURLRequest(GURL(url_str)));
+  frame()->StartNavigation(blink::WebURLRequest(GURL(url_str)));
 }
 
 bool PrepareFrameAndViewForPrint::AllowsBrokenNullLayerTreeView() const {

+ 5 - 2
chromium_src/chrome/renderer/printing/print_web_view_helper.h

@@ -16,7 +16,6 @@
 #include "content/public/renderer/render_frame_observer.h"
 #include "content/public/renderer/render_frame_observer_tracker.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_node.h"
 #include "third_party/blink/public/web/web_print_params.h"
@@ -35,6 +34,10 @@ namespace blink {
 class WebView;
 }
 
+namespace cc {
+class PaintCanvas;
+}
+
 namespace printing {
 
 struct PageSizeMargins;
@@ -217,7 +220,7 @@ class PrintWebViewHelper
                                  const gfx::Rect& canvas_area,
                                  const gfx::Rect& content_area,
                                  double scale_factor,
-                                 blink::WebCanvas* canvas);
+                                 cc::PaintCanvas* canvas);
 
   // Helper methods -----------------------------------------------------------
 

+ 2 - 2
chromium_src/chrome/renderer/printing/print_web_view_helper_mac.mm

@@ -9,10 +9,10 @@
 #include "base/logging.h"
 #include "base/mac/scoped_nsautorelease_pool.h"
 #include "base/metrics/histogram.h"
+#include "cc/paint/paint_canvas.h"
 #include "chrome/common/print_messages.h"
 #include "printing/metafile_skia_wrapper.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"
 
 namespace printing {
@@ -117,7 +117,7 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
 
     MetafileSkiaWrapper::SetMetafileOnCanvas(canvas, metafile);
     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.

+ 2 - 0
chromium_src/chrome/utility/printing_handler_win.cc

@@ -32,8 +32,10 @@ void ReleaseProcessIfNeeded() {
 void PreCacheFontCharacters(const LOGFONT* logfont,
                             const wchar_t* text,
                             size_t text_length) {
+#if 0
   Send(new ChromeUtilityHostMsg_PreCacheFontCharacters(
       *logfont, base::string16(text, text_length)));
+#endif
 }
 
 }  // namespace

+ 3 - 0
components/pepper_flash/BUILD.gn

@@ -54,4 +54,7 @@ component("pepper_flash") {
       "//chrome/browser/renderer_host/pepper/monitor_finder_mac.mm",
     ]
   }
+  if (is_linux) {
+    deps += [ "//components/services/font/public/cpp" ]
+  }
 }

+ 1 - 5
default_app/default_app.js

@@ -1,4 +1,4 @@
-const { app, BrowserWindow, systemPreferences } = require('electron')
+const { app, BrowserWindow } = require('electron')
 const path = require('path')
 
 let mainWindow = null
@@ -11,10 +11,6 @@ app.on('window-all-closed', () => {
 exports.load = async (appUrl) => {
   await app.whenReady()
 
-  if (process.platform === 'darwin') {
-    systemPreferences.startAppLevelAppearanceTrackingOS()
-  }
-
   const options = {
     width: 900,
     height: 600,

+ 1 - 1
docs/api/app.md

@@ -912,7 +912,7 @@ Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Fe
 Returns `Promise`
 
 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`:
   Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:

+ 8 - 0
docs/api/breaking-changes.md

@@ -34,6 +34,14 @@ app.releaseSingleInstance()
 app.releaseSingleInstanceLock()
 ```
 
+## `app.getGPUInfo`
+
+```js
+app.getGPUInfo('complete')
+// Now behaves the same with `basic` on macOS
+app.getGPUInfo('basic')
+```
+
 
 # Breaking API Changes (3.0)
 

+ 11 - 2
docs/api/browser-window.md

@@ -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
     than screen. Default is `false`.
   * `backgroundColor` String (optional) - Window's background color as a hexadecimal value,
-    like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha is supported). Default is
-    `#FFF` (white). If `transparent` is set to `true`, only values with transparent (`#00-------`) or opaque (`#FF-----`) alpha values are respected.
+    like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha is supported if
+    `transparent` is set to `true`). Default is `#FFF` (white).
   * `hasShadow` Boolean (optional) - Whether window should have a shadow. This is only
     implemented on macOS. Default is `true`.
   * `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
 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_
 
 * `path` String - The absolute path to the file to preview with QuickLook. This

+ 11 - 2
electron_resources.grd

@@ -1,12 +1,21 @@
 <?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>
     <output filename="grit/electron_resources.h" type="rc_header">
       <emit emit_type='prepend'></emit>
     </output>
     <output filename="electron_resources.pak" type="data_package" />
   </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>
       <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" />

+ 15 - 0
electron_strings.grdp

@@ -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>

+ 1 - 4
filenames.gni

@@ -112,6 +112,7 @@ filenames = {
     "atom/app/atom_content_client.h",
     "atom/app/atom_main_delegate.cc",
     "atom/app/atom_main_delegate.h",
+    "atom/app/atom_main_delegate_mac.h",
     "atom/app/atom_main_delegate_mac.mm",
     "atom/app/command_line_args.cc",
     "atom/app/command_line_args.h",
@@ -230,8 +231,6 @@ filenames = {
     "atom/browser/atom_speech_recognition_manager_delegate.h",
     "atom/browser/atom_web_ui_controller_factory.cc",
     "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.h",
     "atom/browser/browser_linux.cc",
@@ -336,8 +335,6 @@ filenames = {
     "atom/browser/special_storage_policy.h",
     "atom/browser/ui/accelerator_util.cc",
     "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.h",
     "atom/browser/ui/autofill_popup.cc",

+ 6 - 6
package.json

@@ -44,19 +44,19 @@
     "bump-version": "./script/bump-version.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",
-    "lint": "./script/lint.js && npm run lint:clang-format && npm run lint:docs",
-    "lint:js": "./script/lint.js --js",
+    "lint": "node ./script/lint.js && npm run lint:clang-format && npm run lint:docs",
+    "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:cpp": "./script/lint.js --cc",
-    "lint:py": "./script/lint.js --py",
-    "lint:gn": "./script/lint.js --gn",
+    "lint:cpp": "node ./script/lint.js --cc",
+    "lint:py": "node ./script/lint.js --py",
+    "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-relative-links": "python ./script/check-relative-doc-links.py",
     "lint:js-in-markdown": "standard-markdown docs",
     "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",
     "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",
     "prepush": "check-for-leaks",
     "repl": "node ./script/start.js --interactive",

+ 24 - 33
patches/common/chromium/.patches.yaml

@@ -314,12 +314,6 @@ patches:
   file: scroll_bounce_flag.patch
   description: |
     Patch to make scrollBounce option work.
--
-  author: Birunthan Mohanathas <[email protected]>
-  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 <[email protected]>
   file: webview_reattach.patch
@@ -447,18 +441,10 @@ patches:
   description: backport of crashpad f540abb506
 -
   author: Jeremy Apthorp <[email protected]>
-  file: backport_cd7154e0bb5.patch
-  description: Support macosx 10.14 SDK
--
-  author: Shelley Vohr <[email protected]>
-  file: fix_xcode_ten.patch
+  file: expose-net-observer-api.patch
   description: |
-    Backports 27f9cbd8, a commit which does the following -
-      * Removes IDEBundleInjection.framework from egtests.
-      * 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.
+    Expose URLRequestContextGetter::{Add,Remove}Observer.
+    This patch should be removed once we switch to using the net service (cc @robo)
 -
   author: deepak1556 <[email protected]>
   file: desktop_media_list.patch
@@ -467,22 +453,6 @@ patches:
       desktop capture api.
     * Backports https://chromium-review.googlesource.com/c/chromium/src/+/1199806
       that fixes crash with screen capturer, can be removed in 71.0.3539.0
--
-  author: Jeremy Apthorp <[email protected]>
-  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 <[email protected]>
-  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 <[email protected]>
   file: proxy_config_monitor.patch
@@ -493,3 +463,24 @@ patches:
   file: gritsettings_resource_ids.patch
   description: |
     Add electron resources file to the list of resource ids generation.
+-
+  author: Samuel Attard <[email protected]>
+  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 <[email protected]>
+  file: notification_provenance.patch
+  description: |
+    Pass RenderProcessHost through to PlatformNotificationService.
+
+    This is so Electron can identify which renderer a notification came from.
+-
+  author: deepak1556 <[email protected]>
+  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.

+ 14 - 13
patches/common/chromium/accelerator.patch

@@ -1,5 +1,11 @@
+From 61cd6b5bc2068a3740313d7f4680ef3fcaaacb1a Mon Sep 17 00:00:00 2001
+From: Cheng Zhao <[email protected]>
+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
-index a6756c20f22c..53529588af27 100644
+index 7e55ef366ac8..c3fb98b426cd 100644
 --- a/ui/base/accelerators/accelerator.cc
 +++ b/ui/base/accelerators/accelerator.cc
 @@ -11,6 +11,7 @@
@@ -20,7 +26,7 @@ index a6756c20f22c..53529588af27 100644
  
  namespace ui {
  
-@@ -145,7 +144,15 @@ base::string16 Accelerator::GetShortcutText() const {
+@@ -139,7 +138,15 @@ base::string16 Accelerator::GetShortcutText() const {
    shortcut = KeyCodeToName(key_code_);
  #endif
  
@@ -36,7 +42,7 @@ index a6756c20f22c..53529588af27 100644
  #if defined(OS_WIN)
      // 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
-@@ -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
      // default zoom level), we leave VK_[0-9] alone without translation.
      wchar_t key;
@@ -67,15 +73,7 @@ index a6756c20f22c..53529588af27 100644
  #endif
    }
  
-@@ -221,15 +231,15 @@ base::string16 Accelerator::GetShortcutText() const {
- 
- 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
+@@ -223,7 +233,7 @@ base::string16 Accelerator::ApplyLongFormModifiers(
    // more information.
    if (IsCtrlDown())
      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);
  
    if (IsCmdDown()) {
-@@ -249,14 +256,12 @@ base::string16 Accelerator::ApplyShortFormModifiers(
+@@ -243,14 +253,12 @@ base::string16 Accelerator::ApplyShortFormModifiers(
      base::string16 shortcut) const {
    const base::char16 kCommandSymbol[] = {0x2318, 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(shortcut);
    return base::StrCat(parts);
+-- 
+2.17.0
+

+ 12 - 3
patches/common/chromium/add_atomic_lib_to_dependencies_even_for_sysroot_builds.patch

@@ -1,13 +1,22 @@
+From e686584a3758c1954f31e107746b40c6a63ad776 Mon Sep 17 00:00:00 2001
+From: Aleksei Kuzmin <[email protected]>
+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
-index 943412faefd7..c505df950b2b 100644
+index 7fb93868d6e0..53c5744953da 100644
 --- a/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
    # building inside the cros_sdk environment - use host_toolchain as a
    # more robust check for this.
 -  if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) &&
 +  if ((is_android || (is_linux && !is_chromecast)) &&
        host_toolchain != "//build/toolchain/cros:host") {
-     libs = [ "atomic" ]
+     libs += [ "atomic" ]
    }
+-- 
+2.17.0
+

+ 18 - 2
patches/common/chromium/add_realloc.patch

@@ -1,3 +1,16 @@
+From 0e2864c50cb039dd2f8d9b9cc88ae26f5bd62581 Mon Sep 17 00:00:00 2001
+From: Shelley Vohr <[email protected]>
+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
 index f84934bfd712..fc23fef68b6f 100644
 --- a/gin/array_buffer.cc
@@ -26,10 +39,10 @@ index 2aef366ac819..3c7d66c81032 100644
  
    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
-index c8c822632a69..d12976b3cd01 100644
+index 83a6639306a9..8511e7d594ce 100644
 --- a/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);
    }
  
@@ -68,3 +81,6 @@ index 809229caa872..6248ad32d6b0 100644
    static void FreeMemory(void*);
    static DataHandle CreateDataHandle(size_t, InitializationPolicy);
    static void Initialize(
+-- 
+2.17.0
+

+ 24 - 0
patches/common/chromium/allow_nested_error_trackers.patch

@@ -1,3 +1,24 @@
+From 602c08e90102a25894a4d48d236258cae6b982c6 Mon Sep 17 00:00:00 2001
+From: Charles Kerr <[email protected]>
+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
 index af031de356c5..2a5c18dc473a 100644
 --- a/ui/gfx/x/x11_error_tracker.cc
@@ -11,3 +32,6 @@ index af031de356c5..2a5c18dc473a 100644
    g_handler = this;
    XSync(GetXDisplay(), False);
    old_handler_ = XSetErrorHandler(X11ErrorHandler);
+-- 
+2.17.0
+

Some files were not shown because too many files changed in this diff