Merge pull request #15405 from electron/chromium-upgrade/70

feat: upgrade to Chromium 70.0.3538.110
This commit is contained in:
Samuel Attard 2018-12-04 03:26:49 +11:00 committed by GitHub
commit 3ddd917ff4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
165 changed files with 1664 additions and 4742 deletions

View file

@ -247,6 +247,7 @@ static_library("electron_lib") {
"//components/network_session_configurator/common",
"//components/prefs",
"//components/spellcheck/renderer",
"//components/viz/host",
"//components/viz/service",
"//content/public/app:both",
"//content/public/browser",
@ -254,6 +255,7 @@ static_library("electron_lib") {
"//content/public/common:service_names",
"//content/shell:copy_shell_resources",
"//gin",
"//media/capture/mojom:video_capture",
"//media/mojo/interfaces",
"//net:extras",
"//net:net_resources",
@ -263,6 +265,7 @@ static_library("electron_lib") {
"//ppapi/shared_impl",
"//services/device/public/mojom",
"//services/proxy_resolver:lib",
"//services/viz/privileged/interfaces/compositing",
"//skia",
"//third_party/blink/public:blink",
"//third_party/boringssl",
@ -385,6 +388,7 @@ static_library("electron_lib") {
":libnotify_loader",
"//build/config/linux/gtk",
"//chrome/browser/ui/libgtkui",
"//dbus",
"//device/bluetooth",
"//ui/events/devices/x11",
"//ui/events/platform/x11",

4
DEPS
View file

@ -10,9 +10,9 @@ gclient_gn_args = [
vars = {
'chromium_version':
'69.0.3497.106',
'70.0.3538.110',
'node_version':
'4d44266b78256449dd6ae86e419e3ec07257b569',
'1b192088522d10d126e5bb9316adae2a97add62a',
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
'pyyaml_version': '3.12',

View file

@ -219,7 +219,7 @@ void AtomMainDelegate::PreSandboxStartup() {
#endif
}
void AtomMainDelegate::PreContentInitialization() {
void AtomMainDelegate::PreCreateMainMessageLoop() {
#if defined(OS_MACOSX)
RegisterAtomCrApp();
#endif

View file

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

View file

@ -16,7 +16,7 @@
#include "atom/common/node_bindings.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/task_scheduler/task_scheduler.h"
#include "base/task/task_scheduler/task_scheduler.h"
#include "base/threading/thread_task_runner_handle.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"

View file

@ -788,24 +788,24 @@ void App::OnGpuProcessCrashed(base::TerminationStatus status) {
void App::BrowserChildProcessLaunchedAndConnected(
const content::ChildProcessData& data) {
ChildProcessLaunched(data.process_type, data.handle);
ChildProcessLaunched(data.process_type, data.GetHandle());
}
void App::BrowserChildProcessHostDisconnected(
const content::ChildProcessData& data) {
ChildProcessDisconnected(base::GetProcId(data.handle));
ChildProcessDisconnected(base::GetProcId(data.GetHandle()));
}
void App::BrowserChildProcessCrashed(
const content::ChildProcessData& data,
const content::ChildProcessTerminationInfo& info) {
ChildProcessDisconnected(base::GetProcId(data.handle));
ChildProcessDisconnected(base::GetProcId(data.GetHandle()));
}
void App::BrowserChildProcessKilled(
const content::ChildProcessData& data,
const content::ChildProcessTerminationInfo& info) {
ChildProcessDisconnected(base::GetProcId(data.handle));
ChildProcessDisconnected(base::GetProcId(data.GetHandle()));
}
void App::RenderProcessReady(content::RenderProcessHost* host) {

View file

@ -20,6 +20,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "gin/converter.h"
#include "native_mate/dictionary.h"
#include "ui/gl/gpu_switching_manager.h"
@ -311,7 +312,7 @@ void BrowserWindow::SetBrowserView(v8::Local<v8::Value> value) {
void BrowserWindow::SetVibrancy(v8::Isolate* isolate,
v8::Local<v8::Value> value) {
std::string type = mate::V8ToString(value);
std::string type = gin::V8ToString(isolate, value);
auto* render_view_host = web_contents()->GetRenderViewHost();
if (render_view_host) {

View file

@ -90,7 +90,7 @@ void Menu::ExecuteCommand(int command_id, int flags) {
command_id);
}
void Menu::MenuWillShow(ui::SimpleMenuModel* source) {
void Menu::OnMenuWillShow(ui::SimpleMenuModel* source) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
menu_will_show_.Run(GetWrapper());

View file

@ -53,7 +53,7 @@ class Menu : public mate::TrackableObject<Menu>,
ui::Accelerator* accelerator) const override;
bool ShouldRegisterAcceleratorForCommandId(int command_id) const override;
void ExecuteCommand(int command_id, int event_flags) override;
void MenuWillShow(ui::SimpleMenuModel* source) override;
void OnMenuWillShow(ui::SimpleMenuModel* source) override;
virtual void PopupAt(TopLevelWindow* window,
int x,

View file

@ -6,7 +6,7 @@
#include <string>
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/common/service_manager_connection.h"
#include "native_mate/dictionary.h"

View file

@ -359,7 +359,7 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
if (!global_handle.IsEmpty()) {
v8::Local<v8::Value> local_handle = global_handle.Get(isolate);
if (local_handle->IsObject()) {
v8::Local<v8::Object> object = local_handle->ToObject();
v8::Local<v8::Object> object = local_handle->ToObject(isolate);
void* ptr = object->GetAlignedPointerFromInternalField(0);
if (!ptr)
return;
@ -471,13 +471,14 @@ void Session::SetProxy(const mate::Dictionary& options,
if (!pac_url.empty()) {
browser_context_->in_memory_pref_store()->SetValue(
proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreatePacScript(pac_url,
true /* pac_mandatory */),
std::make_unique<base::Value>(ProxyConfigDictionary::CreatePacScript(
pac_url, true /* pac_mandatory */)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else {
browser_context_->in_memory_pref_store()->SetValue(
proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreateFixedServers(proxy_rules, bypass_list),
std::make_unique<base::Value>(ProxyConfigDictionary::CreateFixedServers(
proxy_rules, bypass_list)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}

View file

@ -20,6 +20,7 @@
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/options_switches.h"
#include "electron/buildflags/buildflags.h"
#include "gin/converter.h"
#include "native_mate/handle.h"
#include "native_mate/persistent_dictionary.h"
@ -643,7 +644,8 @@ void TopLevelWindow::SetFocusable(bool focusable) {
void TopLevelWindow::SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> value) {
mate::Handle<Menu> menu;
if (value->IsObject() &&
mate::V8ToString(value->ToObject()->GetConstructorName()) == "Menu" &&
gin::V8ToString(
isolate, value->ToObject(isolate)->GetConstructorName()) == "Menu" &&
mate::ConvertFromV8(isolate, value, &menu) && !menu.IsEmpty()) {
menu_.Reset(isolate, menu.ToV8());
window_->SetMenu(menu->model());
@ -740,7 +742,7 @@ void TopLevelWindow::SetAutoHideCursor(bool auto_hide) {
void TopLevelWindow::SetVibrancy(v8::Isolate* isolate,
v8::Local<v8::Value> value) {
std::string type = mate::V8ToString(value);
std::string type = gin::V8ToString(isolate, value);
window_->SetVibrancy(type);
}

View file

@ -15,6 +15,7 @@
#include "atom/browser/common_web_contents_delegate.h"
#include "atom/browser/ui/autofill_popup.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "content/common/cursors/webcursor.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/web_contents.h"
@ -60,10 +61,13 @@ namespace api {
// Certain events are only in WebContentsDelegate, provide our own Observer to
// dispatch those events.
class ExtendedWebContentsObserver {
class ExtendedWebContentsObserver : public base::CheckedObserver {
public:
virtual void OnCloseContents() {}
virtual void OnRendererResponsive() {}
protected:
~ExtendedWebContentsObserver() override {}
};
// Wrapper around the content::WebContents.

View file

@ -36,8 +36,6 @@ class WebContentsViewRelay
} // namespace
DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsViewRelay);
namespace atom {
namespace api {

View file

@ -103,7 +103,8 @@ class EventEmitter : public Wrappable<T> {
v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(), name, event, args...);
return event->Get(StringToV8(isolate(), "defaultPrevented"))
->BooleanValue();
->BooleanValue(isolate()->GetCurrentContext())
.ToChecked();
}
DISALLOW_COPY_AND_ASSIGN(EventEmitter);

View file

@ -4,13 +4,12 @@
#include "atom/browser/api/frame_subscriber.h"
#include <utility>
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
#include "components/viz/service/surfaces/surface_manager.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ui/gfx/skbitmap_operations.h"
#include "atom/common/node_includes.h"
@ -19,6 +18,8 @@ namespace atom {
namespace api {
constexpr static int kMaxFrameRate = 30;
FrameSubscriber::FrameSubscriber(v8::Isolate* isolate,
content::WebContents* web_contents,
const FrameCaptureCallback& callback,
@ -27,48 +28,123 @@ FrameSubscriber::FrameSubscriber(v8::Isolate* isolate,
isolate_(isolate),
callback_(callback),
only_dirty_(only_dirty),
weak_ptr_factory_(this) {}
weak_ptr_factory_(this) {
content::RenderViewHost* rvh = web_contents->GetRenderViewHost();
if (rvh)
AttachToHost(rvh->GetWidget());
}
FrameSubscriber::~FrameSubscriber() = default;
gfx::Rect FrameSubscriber::GetDamageRect() {
auto* view = web_contents()->GetRenderWidgetHostView();
if (view == nullptr)
return gfx::Rect();
void FrameSubscriber::AttachToHost(content::RenderWidgetHost* host) {
host_ = host;
auto* view_base = static_cast<content::RenderWidgetHostViewBase*>(view);
viz::SurfaceManager* surface_manager =
content::GetFrameSinkManager()->surface_manager();
viz::Surface* surface =
surface_manager->GetSurfaceForId(view_base->GetCurrentSurfaceId());
if (surface == nullptr)
return gfx::Rect();
// The view can be null if the renderer process has crashed.
// (https://crbug.com/847363)
if (!host_->GetView())
return;
if (surface->HasActiveFrame()) {
const viz::CompositorFrame& frame = surface->GetActiveFrame();
viz::RenderPass* root_pass = frame.render_pass_list.back().get();
gfx::Size frame_size = root_pass->output_rect.size();
gfx::Rect damage_rect =
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
damage_rect.Intersect(gfx::Rect(frame_size));
return gfx::ScaleToEnclosedRect(damage_rect,
1.0f / frame.device_scale_factor());
} else {
return gfx::Rect();
// Create and configure the video capturer.
video_capturer_ = host_->GetView()->CreateVideoCapturer();
video_capturer_->SetResolutionConstraints(
host_->GetView()->GetViewBounds().size(),
host_->GetView()->GetViewBounds().size(), true);
video_capturer_->SetAutoThrottlingEnabled(false);
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB,
media::COLOR_SPACE_UNSPECIFIED);
video_capturer_->SetMinCapturePeriod(base::TimeDelta::FromSeconds(1) /
kMaxFrameRate);
video_capturer_->Start(this);
}
void FrameSubscriber::DetachFromHost() {
if (!host_)
return;
video_capturer_.reset();
host_ = nullptr;
}
void FrameSubscriber::RenderViewCreated(content::RenderViewHost* host) {
if (!host_)
AttachToHost(host->GetWidget());
}
void FrameSubscriber::RenderViewDeleted(content::RenderViewHost* host) {
if (host->GetWidget() == host_) {
DetachFromHost();
}
}
void FrameSubscriber::DidReceiveCompositorFrame() {
auto* view = web_contents()->GetRenderWidgetHostView();
if (view == nullptr)
return;
view->CopyFromSurface(
gfx::Rect(), view->GetViewBounds().size(),
base::BindOnce(&FrameSubscriber::Done, weak_ptr_factory_.GetWeakPtr(),
GetDamageRect()));
void FrameSubscriber::RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) {
if ((old_host && old_host->GetWidget() == host_) || (!old_host && !host_)) {
DetachFromHost();
AttachToHost(new_host->GetWidget());
}
}
void FrameSubscriber::OnFrameCaptured(
base::ReadOnlySharedMemoryRegion data,
::media::mojom::VideoFrameInfoPtr info,
const gfx::Rect& update_rect,
const gfx::Rect& content_rect,
viz::mojom::FrameSinkVideoConsumerFrameCallbacksPtr callbacks) {
gfx::Size view_size = host_->GetView()->GetViewBounds().size();
if (view_size != content_rect.size()) {
video_capturer_->SetResolutionConstraints(view_size, view_size, true);
video_capturer_->RequestRefreshFrame();
return;
}
if (!data.IsValid()) {
callbacks->Done();
return;
}
base::ReadOnlySharedMemoryMapping mapping = data.Map();
if (!mapping.IsValid()) {
DLOG(ERROR) << "Shared memory mapping failed.";
return;
}
if (mapping.size() <
media::VideoFrame::AllocationSize(info->pixel_format, info->coded_size)) {
DLOG(ERROR) << "Shared memory size was less than expected.";
return;
}
// The SkBitmap's pixels will be marked as immutable, but the installPixels()
// API requires a non-const pointer. So, cast away the const.
void* const pixels = const_cast<void*>(mapping.memory());
// Call installPixels() with a |releaseProc| that: 1) notifies the capturer
// that this consumer has finished with the frame, and 2) releases the shared
// memory mapping.
struct FramePinner {
// Keeps the shared memory that backs |frame_| mapped.
base::ReadOnlySharedMemoryMapping mapping;
// Prevents FrameSinkVideoCapturer from recycling the shared memory that
// backs |frame_|.
viz::mojom::FrameSinkVideoConsumerFrameCallbacksPtr releaser;
};
SkBitmap bitmap;
bitmap.installPixels(
SkImageInfo::MakeN32(content_rect.width(), content_rect.height(),
kPremul_SkAlphaType),
pixels,
media::VideoFrame::RowBytes(media::VideoFrame::kARGBPlane,
info->pixel_format, info->coded_size.width()),
[](void* addr, void* context) {
delete static_cast<FramePinner*>(context);
},
new FramePinner{std::move(mapping), std::move(callbacks)});
bitmap.setImmutable();
Done(content_rect, bitmap);
}
void FrameSubscriber::OnStopped() {}
void FrameSubscriber::Done(const gfx::Rect& damage, const SkBitmap& frame) {
if (frame.drawsNothing())
return;

View file

@ -5,13 +5,13 @@
#ifndef ATOM_BROWSER_API_FRAME_SUBSCRIBER_H_
#define ATOM_BROWSER_API_FRAME_SUBSCRIBER_H_
#include "content/public/browser/web_contents.h"
#include <memory>
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/host/client_frame_sink_video_capturer.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "ui/gfx/image/image.h"
#include "v8/include/v8.h"
namespace atom {
@ -20,7 +20,8 @@ namespace api {
class WebContents;
class FrameSubscriber : public content::WebContentsObserver {
class FrameSubscriber : public content::WebContentsObserver,
public viz::mojom::FrameSinkVideoConsumer {
public:
using FrameCaptureCallback =
base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>)>;
@ -32,14 +33,32 @@ class FrameSubscriber : public content::WebContentsObserver {
~FrameSubscriber() override;
private:
gfx::Rect GetDamageRect();
void DidReceiveCompositorFrame() override;
void AttachToHost(content::RenderWidgetHost* host);
void DetachFromHost();
void RenderViewCreated(content::RenderViewHost* host) override;
void RenderViewDeleted(content::RenderViewHost* host) override;
void RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) override;
// viz::mojom::FrameSinkVideoConsumer implementation.
void OnFrameCaptured(
base::ReadOnlySharedMemoryRegion data,
::media::mojom::VideoFrameInfoPtr info,
const gfx::Rect& update_rect,
const gfx::Rect& content_rect,
viz::mojom::FrameSinkVideoConsumerFrameCallbacksPtr callbacks) override;
void OnStopped() override;
void Done(const gfx::Rect& damage, const SkBitmap& frame);
v8::Isolate* isolate_;
FrameCaptureCallback callback_;
bool only_dirty_;
content::RenderWidgetHost* host_;
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
base::WeakPtrFactory<FrameSubscriber> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(FrameSubscriber);

View file

@ -191,6 +191,11 @@ base::FilePath AtomBrowserContext::GetPath() const {
return path_;
}
base::FilePath AtomBrowserContext::GetCachePath() const {
// TODO(deepak1556): Use platform cache directory.
return path_;
}
bool AtomBrowserContext::IsOffTheRecord() const {
return in_memory_;
}

View file

@ -60,6 +60,7 @@ class AtomBrowserContext
// content::BrowserContext:
base::FilePath GetPath() const override;
base::FilePath GetCachePath() const override;
bool IsOffTheRecord() const override;
content::ResourceContext* GetResourceContext() override;
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(

View file

@ -196,12 +196,6 @@ void AtomBrowserMainParts::InitializeFeatureList() {
auto* cmd_line = base::CommandLine::ForCurrentProcess();
auto enable_features =
cmd_line->GetSwitchValueASCII(::switches::kEnableFeatures);
// Node depends on SharedArrayBuffer support, which was temporarily disabled
// by https://chromium-review.googlesource.com/c/chromium/src/+/849429 (in
// M64) and reenabled by
// https://chromium-review.googlesource.com/c/chromium/src/+/1159358 (in
// M70). Once Electron upgrades to M70, we can remove this.
enable_features += std::string(",") + features::kSharedArrayBuffer.name;
auto disable_features =
cmd_line->GetSwitchValueASCII(::switches::kDisableFeatures);
#if defined(OS_MACOSX)
@ -211,6 +205,12 @@ void AtomBrowserMainParts::InitializeFeatureList() {
// Chromium drops support for the old sandbox implmentation.
disable_features += std::string(",") + features::kMacV2Sandbox.name;
#endif
// Disable creation of spare renderer process with site-per-process mode,
// it interferes with our process preference tracking for non sandboxed mode.
// Can be reenabled when our site instance policy is aligned with chromium
// when node integration is enabled.
disable_features +=
std::string(",") + features::kSpareRendererForSitePerProcess.name;
auto feature_list = std::make_unique<base::FeatureList>();
feature_list->InitializeFromCommandLine(enable_features, disable_features);
base::FeatureList::SetInstance(std::move(feature_list));

View file

@ -14,7 +14,7 @@
#include "atom/common/options_switches.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "chrome/common/pref_names.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/prefs/pref_service.h"
@ -178,7 +178,7 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE,
{base::MayBlock(), base::TaskPriority::BACKGROUND,
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(&CreateDownloadPath, download->GetURL(),
download->GetContentDisposition(),

View file

@ -222,8 +222,8 @@ blink::mojom::PermissionStatus AtomPermissionManager::GetPermissionStatus(
int AtomPermissionManager::SubscribePermissionStatusChange(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const GURL& embedding_origin,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback) {
return -1;
}

View file

@ -96,8 +96,8 @@ class AtomPermissionManager : public content::PermissionControllerDelegate {
const GURL& embedding_origin) override;
int SubscribePermissionStatusChange(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const GURL& embedding_origin,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
override;
void UnsubscribePermissionStatusChange(int subscription_id) override;

View file

@ -9,6 +9,7 @@
#include "atom/browser/login_handler.h"
#include "base/memory/scoped_refptr.h"
#include "base/observer_list_types.h"
#include "build/build_config.h"
namespace base {
@ -17,7 +18,7 @@ class DictionaryValue;
namespace atom {
class BrowserObserver {
class BrowserObserver : public base::CheckedObserver {
public:
// The browser is about to close all windows.
virtual void OnBeforeQuit(bool* prevent_default) {}
@ -83,7 +84,7 @@ class BrowserObserver {
#endif
protected:
virtual ~BrowserObserver() {}
~BrowserObserver() override {}
};
} // namespace atom

View file

@ -47,19 +47,22 @@ void BrowserProcessImpl::ApplyProxyModeFromCommandLine(
auto* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kNoProxyServer)) {
pref_store->SetValue(proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreateDirect(),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
pref_store->SetValue(
proxy_config::prefs::kProxy,
std::make_unique<base::Value>(ProxyConfigDictionary::CreateDirect()),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else if (command_line->HasSwitch(switches::kProxyPacUrl)) {
std::string pac_script_url =
command_line->GetSwitchValueASCII(switches::kProxyPacUrl);
pref_store->SetValue(proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreatePacScript(
pac_script_url, false /* pac_mandatory */),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
pref_store->SetValue(
proxy_config::prefs::kProxy,
std::make_unique<base::Value>(ProxyConfigDictionary::CreatePacScript(
pac_script_url, false /* pac_mandatory */)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else if (command_line->HasSwitch(switches::kProxyAutoDetect)) {
pref_store->SetValue(proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreateAutoDetect(),
std::make_unique<base::Value>(
ProxyConfigDictionary::CreateAutoDetect()),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
} else if (command_line->HasSwitch(switches::kProxyServer)) {
std::string proxy_server =
@ -68,7 +71,8 @@ void BrowserProcessImpl::ApplyProxyModeFromCommandLine(
command_line->GetSwitchValueASCII(switches::kProxyBypassList);
pref_store->SetValue(
proxy_config::prefs::kProxy,
ProxyConfigDictionary::CreateFixedServers(proxy_server, bypass_list),
std::make_unique<base::Value>(ProxyConfigDictionary::CreateFixedServers(
proxy_server, bypass_list)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}
}
@ -309,11 +313,6 @@ prefs::InProcessPrefServiceFactory* BrowserProcessImpl::pref_service_factory()
return nullptr;
}
content::NetworkConnectionTracker*
BrowserProcessImpl::network_connection_tracker() {
return nullptr;
}
void BrowserProcessImpl::SetApplicationLocale(const std::string& locale) {
locale_ = locale;
}

View file

@ -102,7 +102,6 @@ class BrowserProcessImpl : public BrowserProcess {
shell_integration::DefaultWebClientState CachedDefaultWebClientState()
override;
prefs::InProcessPrefServiceFactory* pref_service_factory() const override;
content::NetworkConnectionTracker* network_connection_tracker() override;
void CreateDevToolsProtocolHandler() override {}
void CreateDevToolsAutoOpener() override {}
void set_background_mode_manager_for_test(

View file

@ -19,7 +19,7 @@
#include "atom/common/options_switches.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/ui/browser_dialogs.h"

View file

@ -9,7 +9,7 @@
#include "atom/browser/microtasks_runner.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/task_scheduler/initialization_util.h"
#include "base/task/task_scheduler/initialization_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/common/content_switches.h"
#include "gin/array_buffer.h"
@ -25,6 +25,7 @@ JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
isolate_holder_(base::ThreadTaskRunnerHandle::Get(),
gin::IsolateHolder::kSingleThread,
gin::IsolateHolder::kAllowAtomicsWait,
gin::IsolateHolder::IsolateType::kUtility,
gin::IsolateHolder::IsolateCreationMode::kNormal,
isolate_),
isolate_scope_(isolate_),
@ -45,8 +46,9 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
// The V8Platform of gin relies on Chromium's task schedule, which has not
// been started at this point, so we have to rely on Node's V8Platform.
auto* tracing_controller = new v8::TracingController();
node::tracing::TraceEventHelper::SetTracingController(tracing_controller);
auto* tracing_agent = node::CreateAgent();
auto* tracing_controller = tracing_agent->GetTracingController();
node::tracing::TraceEventHelper::SetAgent(tracing_agent);
platform_ = node::CreatePlatform(
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
tracing_controller);

View file

@ -50,10 +50,10 @@ MediaStreamDevicesController::~MediaStreamDevicesController() {
bool MediaStreamDevicesController::TakeAction() {
// Do special handling of desktop screen cast.
if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE ||
request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE ||
request_.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE ||
request_.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
if (request_.audio_type == content::MEDIA_GUM_TAB_AUDIO_CAPTURE ||
request_.video_type == content::MEDIA_GUM_TAB_VIDEO_CAPTURE ||
request_.audio_type == content::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE ||
request_.video_type == content::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE) {
HandleUserMediaRequest();
return true;
}
@ -154,19 +154,19 @@ void MediaStreamDevicesController::Deny(
void MediaStreamDevicesController::HandleUserMediaRequest() {
content::MediaStreamDevices devices;
if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE) {
devices.push_back(
content::MediaStreamDevice(content::MEDIA_TAB_AUDIO_CAPTURE, "", ""));
}
if (request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) {
devices.push_back(
content::MediaStreamDevice(content::MEDIA_TAB_VIDEO_CAPTURE, "", ""));
}
if (request_.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE) {
if (request_.audio_type == content::MEDIA_GUM_TAB_AUDIO_CAPTURE) {
devices.push_back(content::MediaStreamDevice(
content::MEDIA_DESKTOP_AUDIO_CAPTURE, "loopback", "System Audio"));
content::MEDIA_GUM_TAB_AUDIO_CAPTURE, "", ""));
}
if (request_.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE) {
if (request_.video_type == content::MEDIA_GUM_TAB_VIDEO_CAPTURE) {
devices.push_back(content::MediaStreamDevice(
content::MEDIA_GUM_TAB_VIDEO_CAPTURE, "", ""));
}
if (request_.audio_type == content::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE) {
devices.push_back(content::MediaStreamDevice(
content::MEDIA_GUM_DESKTOP_AUDIO_CAPTURE, "loopback", "System Audio"));
}
if (request_.video_type == content::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE) {
content::DesktopMediaID screen_id;
// If the device id wasn't specified then this is a screen capture request
// (i.e. chooseDesktopMedia() API wasn't used to generate device id).
@ -178,8 +178,9 @@ void MediaStreamDevicesController::HandleUserMediaRequest() {
content::DesktopMediaID::Parse(request_.requested_video_device_id);
}
devices.push_back(content::MediaStreamDevice(
content::MEDIA_DESKTOP_VIDEO_CAPTURE, screen_id.ToString(), "Screen"));
devices.push_back(
content::MediaStreamDevice(content::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE,
screen_id.ToString(), "Screen"));
}
std::move(callback_).Run(devices,

View file

@ -7,6 +7,7 @@
#include <string>
#include "base/observer_list_types.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "ui/base/window_open_disposition.h"
@ -22,9 +23,9 @@ class Rect;
namespace atom {
class NativeWindowObserver {
class NativeWindowObserver : public base::CheckedObserver {
public:
virtual ~NativeWindowObserver() {}
~NativeWindowObserver() override {}
// Called when the web page in window wants to create a popup window.
virtual void WillCreatePopupWindow(const base::string16& frame_name,

View file

@ -347,7 +347,7 @@ void NativeWindowViews::Show() {
!widget()->native_widget_private()->IsVisible())
static_cast<NativeWindowViews*>(parent())->IncrementChildModals();
widget()->native_widget_private()->ShowWithWindowState(GetRestoredState());
widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect());
NotifyWindowShow();
@ -454,8 +454,8 @@ void NativeWindowViews::Maximize() {
if (IsVisible())
widget()->Maximize();
else
widget()->native_widget_private()->ShowWithWindowState(
ui::SHOW_STATE_MAXIMIZED);
widget()->native_widget_private()->Show(ui::SHOW_STATE_MAXIMIZED,
gfx::Rect());
}
void NativeWindowViews::Unmaximize() {
@ -477,8 +477,8 @@ void NativeWindowViews::Minimize() {
if (IsVisible())
widget()->Minimize();
else
widget()->native_widget_private()->ShowWithWindowState(
ui::SHOW_STATE_MINIMIZED);
widget()->native_widget_private()->Show(ui::SHOW_STATE_MINIMIZED,
gfx::Rect());
}
void NativeWindowViews::Restore() {
@ -533,8 +533,8 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
if (IsVisible())
widget()->SetFullscreen(fullscreen);
else if (fullscreen)
widget()->native_widget_private()->ShowWithWindowState(
ui::SHOW_STATE_FULLSCREEN);
widget()->native_widget_private()->Show(ui::SHOW_STATE_FULLSCREEN,
gfx::Rect());
// Auto-hide menubar when in fullscreen.
if (fullscreen)

View file

@ -14,7 +14,6 @@
#include "content/public/browser/browser_thread.h"
#include "net/base/net_errors.h"
#include "net/cert/cert_verify_result.h"
#include "net/cert/crl_set.h"
#include "net/cert/x509_certificate.h"
using content::BrowserThread;
@ -78,9 +77,9 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
delete response;
}
void Start(net::CRLSet* crl_set, const net::NetLogWithSource& net_log) {
void Start(const net::NetLogWithSource& net_log) {
int error = cert_verifier_->default_verifier()->Verify(
params_, crl_set, &result_,
params_, &result_,
base::Bind(&CertVerifierRequest::OnDefaultVerificationDone,
weak_ptr_factory_.GetWeakPtr()),
&default_verifier_request_, net_log);
@ -161,7 +160,6 @@ void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) {
}
int AtomCertVerifier::Verify(const RequestParams& params,
net::CRLSet* crl_set,
net::CertVerifyResult* verify_result,
net::CompletionOnceCallback callback,
std::unique_ptr<Request>* out_req,
@ -171,13 +169,13 @@ int AtomCertVerifier::Verify(const RequestParams& params,
if (verify_proc_.is_null()) {
ct_delegate_->ClearCTExcludedHostsList();
return default_cert_verifier_->Verify(
params, crl_set, verify_result, std::move(callback), out_req, net_log);
params, verify_result, std::move(callback), out_req, net_log);
} else {
CertVerifierRequest* request = FindRequest(params);
if (!request) {
out_req->reset();
auto new_request = std::make_unique<CertVerifierRequest>(params, this);
new_request->Start(crl_set, net_log);
new_request->Start(net_log);
request = new_request.get();
*out_req = std::move(new_request);
inflight_requests_[params] = request;
@ -188,6 +186,10 @@ int AtomCertVerifier::Verify(const RequestParams& params,
}
}
void AtomCertVerifier::SetConfig(const Config& config) {
default_cert_verifier_->SetConfig(config);
}
void AtomCertVerifier::RemoveRequest(const RequestParams& params) {
auto it = inflight_requests_.find(params);
if (it != inflight_requests_.end())

View file

@ -46,11 +46,11 @@ class AtomCertVerifier : public net::CertVerifier {
protected:
// net::CertVerifier:
int Verify(const RequestParams& params,
net::CRLSet* crl_set,
net::CertVerifyResult* verify_result,
net::CompletionOnceCallback callback,
std::unique_ptr<Request>* out_req,
const net::NetLogWithSource& net_log) override;
void SetConfig(const Config& config) override;
private:
friend class CertVerifierRequest;

View file

@ -4,76 +4,79 @@
#include "atom/browser/net/resolve_proxy_helper.h"
#include <utility>
#include "atom/browser/atom_browser_context.h"
#include "base/bind.h"
#include "base/threading/thread_task_runner_handle.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "net/proxy_resolution/proxy_info.h"
#include "services/network/public/mojom/network_context.mojom.h"
using content::BrowserThread;
namespace atom {
ResolveProxyHelper::ResolveProxyHelper(AtomBrowserContext* browser_context)
: context_getter_(browser_context->GetRequestContext()),
original_thread_(base::ThreadTaskRunnerHandle::Get()) {}
: binding_(this), browser_context_(browser_context) {}
ResolveProxyHelper::~ResolveProxyHelper() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!owned_self_);
DCHECK(!binding_.is_bound());
// Clear all pending requests if the ProxyService is still alive.
pending_requests_.clear();
}
void ResolveProxyHelper::ResolveProxy(const GURL& url,
const ResolveProxyCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Enqueue the pending request.
pending_requests_.push_back(PendingRequest(url, callback));
// If nothing is in progress, start.
if (pending_requests_.size() == 1)
if (!binding_.is_bound()) {
DCHECK_EQ(1u, pending_requests_.size());
StartPendingRequest();
}
}
void ResolveProxyHelper::StartPendingRequest() {
auto& pending_request = pending_requests_.front();
context_getter_->GetNetworkTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&ResolveProxyHelper::StartPendingRequestInIO,
base::Unretained(this), pending_request.url));
}
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!binding_.is_bound());
DCHECK(!pending_requests_.empty());
void ResolveProxyHelper::StartPendingRequestInIO(const GURL& url) {
auto* proxy_service =
context_getter_->GetURLRequestContext()->proxy_resolution_service();
// Start the request.
int result = proxy_service->ResolveProxy(
url, std::string(), &proxy_info_,
base::Bind(&ResolveProxyHelper::OnProxyResolveComplete,
base::RetainedRef(this)),
nullptr, nullptr, net::NetLogWithSource());
// Completed synchronously.
if (result != net::ERR_IO_PENDING)
OnProxyResolveComplete(result);
network::mojom::ProxyLookupClientPtr proxy_lookup_client;
binding_.Bind(mojo::MakeRequest(&proxy_lookup_client));
binding_.set_connection_error_handler(
base::BindOnce(&ResolveProxyHelper::OnProxyLookupComplete,
base::Unretained(this), base::nullopt));
content::BrowserContext::GetDefaultStoragePartition(browser_context_)
->GetNetworkContext()
->LookUpProxyForURL(pending_requests_.front().url,
std::move(proxy_lookup_client));
}
void ResolveProxyHelper::OnProxyResolveComplete(int result) {
void ResolveProxyHelper::OnProxyLookupComplete(
const base::Optional<net::ProxyInfo>& proxy_info) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!pending_requests_.empty());
std::string proxy;
if (result == net::OK)
proxy = proxy_info_.ToPacString();
original_thread_->PostTask(
FROM_HERE, base::BindOnce(&ResolveProxyHelper::SendProxyResult,
base::RetainedRef(this), proxy));
}
void ResolveProxyHelper::SendProxyResult(const std::string& proxy) {
DCHECK(!pending_requests_.empty());
const auto& completed_request = pending_requests_.front();
if (!completed_request.callback.is_null())
completed_request.callback.Run(proxy);
binding_.Close();
// Clear the current (completed) request.
PendingRequest completed_request = std::move(pending_requests_.front());
pending_requests_.pop_front();
std::string proxy;
if (proxy_info)
proxy = proxy_info->ToPacString();
if (!completed_request.callback.is_null())
completed_request.callback.Run(proxy);
// Start the next request.
if (!pending_requests_.empty())
StartPendingRequest();

View file

@ -9,19 +9,18 @@
#include <string>
#include "base/memory/ref_counted.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "base/optional.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/network/public/mojom/proxy_lookup_client.mojom.h"
#include "url/gurl.h"
namespace net {
class URLRequestContextGetter;
}
namespace atom {
class AtomBrowserContext;
class ResolveProxyHelper
: public base::RefCountedThreadSafe<ResolveProxyHelper> {
: public base::RefCountedThreadSafe<ResolveProxyHelper>,
network::mojom::ProxyLookupClient {
public:
using ResolveProxyCallback = base::Callback<void(std::string)>;
@ -29,6 +28,9 @@ class ResolveProxyHelper
void ResolveProxy(const GURL& url, const ResolveProxyCallback& callback);
protected:
~ResolveProxyHelper() override;
private:
friend class base::RefCountedThreadSafe<ResolveProxyHelper>;
// A PendingRequest is a resolve request that is in progress, or queued.
@ -47,18 +49,22 @@ class ResolveProxyHelper
DISALLOW_COPY_AND_ASSIGN(PendingRequest);
};
~ResolveProxyHelper();
// Starts the first pending request.
void StartPendingRequest();
void StartPendingRequestInIO(const GURL& url);
void OnProxyResolveComplete(int result);
void SendProxyResult(const std::string& proxy);
net::ProxyInfo proxy_info_;
// network::mojom::ProxyLookupClient implementation.
void OnProxyLookupComplete(
const base::Optional<net::ProxyInfo>& proxy_info) override;
// Self-reference. Owned as long as there's an outstanding proxy lookup.
scoped_refptr<ResolveProxyHelper> owned_self_;
std::deque<PendingRequest> pending_requests_;
scoped_refptr<net::URLRequestContextGetter> context_getter_;
scoped_refptr<base::SingleThreadTaskRunner> original_thread_;
// Binding for the currently in-progress request, if any.
mojo::Binding<network::mojom::ProxyLookupClient> binding_;
// Weak Ref
AtomBrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(ResolveProxyHelper);
};

View file

@ -12,7 +12,7 @@
#include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/native_mate_converters/v8_value_converter.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "content/public/browser/browser_thread.h"
namespace atom {

View file

@ -143,7 +143,7 @@ int URLRequestBufferJob::GetRefCountedData(
std::string* mime_type,
std::string* charset,
scoped_refptr<base::RefCountedMemory>* data,
const net::CompletionCallback& callback) const {
net::CompletionOnceCallback callback) const {
*mime_type = mime_type_;
*charset = charset_;
*data = data_;

View file

@ -31,7 +31,7 @@ class URLRequestBufferJob : public JsAsker, public net::URLRequestSimpleJob {
int GetRefCountedData(std::string* mime_type,
std::string* charset,
scoped_refptr<base::RefCountedMemory>* data,
const net::CompletionCallback& callback) const override;
net::CompletionOnceCallback callback) const override;
private:
std::string mime_type_;

View file

@ -22,7 +22,7 @@
#include "atom/browser/net/system_network_context_manager.h"
#include "base/command_line.h"
#include "base/strings/string_util.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
#include "components/network_session_configurator/common/network_switches.h"

View file

@ -55,21 +55,21 @@ class ResponsePiper : public net::URLFetcherResponseWriter {
explicit ResponsePiper(URLRequestFetchJob* job) : job_(job) {}
// net::URLFetcherResponseWriter:
int Initialize(const net::CompletionCallback& callback) override {
int Initialize(net::CompletionOnceCallback callback) override {
return net::OK;
}
int Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) override {
net::CompletionOnceCallback callback) override {
if (first_write_) {
// The URLFetcherResponseWriter doesn't have an event when headers have
// been read, so we have to emulate by hooking to first write event.
job_->HeadersCompleted();
first_write_ = false;
}
return job_->DataAvailable(buffer, num_bytes, callback);
return job_->DataAvailable(buffer, num_bytes, std::move(callback));
}
int Finish(int net_error, const net::CompletionCallback& callback) override {
int Finish(int net_error, net::CompletionOnceCallback callback) override {
return net::OK;
}
@ -231,14 +231,14 @@ void URLRequestFetchJob::HeadersCompleted() {
int URLRequestFetchJob::DataAvailable(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
net::CompletionOnceCallback callback) {
// When pending_buffer_ is empty, there's no ReadRawData() operation waiting
// for IO completion, we have to save the parameters until the request is
// ready to read data.
if (!pending_buffer_.get()) {
write_buffer_ = buffer;
write_num_bytes_ = num_bytes;
write_callback_ = callback;
write_callback_ = std::move(callback);
return net::ERR_IO_PENDING;
}
@ -274,9 +274,9 @@ int URLRequestFetchJob::ReadRawData(net::IOBuffer* dest, int dest_size) {
// Read from the write buffer and clear them after reading.
int bytes_read =
BufferCopy(write_buffer_.get(), write_num_bytes_, dest, dest_size);
net::CompletionCallback write_callback = write_callback_;
ClearWriteBuffer();
write_callback.Run(bytes_read);
if (!write_callback_.is_null())
std::move(write_callback_).Run(bytes_read);
return bytes_read;
}
@ -336,7 +336,6 @@ void URLRequestFetchJob::ClearPendingBuffer() {
void URLRequestFetchJob::ClearWriteBuffer() {
write_buffer_ = nullptr;
write_num_bytes_ = 0;
write_callback_.Reset();
}
} // namespace atom

View file

@ -36,7 +36,7 @@ class URLRequestFetchJob : public JsAsker,
void HeadersCompleted();
int DataAvailable(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback);
net::CompletionOnceCallback callback);
protected:
// net::URLRequestJob:
@ -69,7 +69,7 @@ class URLRequestFetchJob : public JsAsker,
// Saved arguments passed to DataAvailable.
scoped_refptr<net::IOBuffer> write_buffer_;
int write_num_bytes_ = 0;
net::CompletionCallback write_callback_;
net::CompletionOnceCallback write_callback_;
base::WeakPtrFactory<URLRequestFetchJob> weak_factory_;

View file

@ -102,11 +102,10 @@ void URLRequestStringJob::GetResponseInfo(net::HttpResponseInfo* info) {
info->headers = headers;
}
int URLRequestStringJob::GetData(
std::string* mime_type,
std::string* charset,
std::string* data,
const net::CompletionCallback& callback) const {
int URLRequestStringJob::GetData(std::string* mime_type,
std::string* charset,
std::string* data,
net::CompletionOnceCallback callback) const {
*mime_type = mime_type_;
*charset = charset_;
*data = data_;

View file

@ -29,7 +29,7 @@ class URLRequestStringJob : public JsAsker, public net::URLRequestSimpleJob {
int GetData(std::string* mime_type,
std::string* charset,
std::string* data,
const net::CompletionCallback& callback) const override;
net::CompletionOnceCallback callback) const override;
private:
std::string mime_type_;

View file

@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "libplatform/libplatform.h"
#include "native_mate/dictionary.h"
@ -39,15 +40,16 @@ void NodeDebugger::Start() {
auto options = std::make_shared<node::DebugOptions>();
std::vector<std::string> exec_args;
std::vector<std::string> v8_args;
std::string error;
std::vector<std::string> errors;
node::options_parser::DebugOptionsParser::instance.Parse(
&args, &exec_args, &v8_args, options.get(),
node::options_parser::kDisallowedInEnvironment, &error);
node::options_parser::kDisallowedInEnvironment, &errors);
if (!error.empty()) {
if (!errors.empty()) {
// TODO(jeremy): what's the appropriate behaviour here?
LOG(ERROR) << "Error parsing node options: " << error;
LOG(ERROR) << "Error parsing node options: "
<< base::JoinString(errors, " ");
}
// Set process._debugWaitConnect if --inspect-brk was specified to stop
@ -58,7 +60,7 @@ void NodeDebugger::Start() {
}
const char* path = "";
if (inspector->Start(path, options))
if (inspector->Start(path, options, true /* is_main */))
DCHECK(env_->inspector_agent()->IsListening());
}

View file

@ -130,4 +130,8 @@ int64_t PlatformNotificationService::ReadNextPersistentNotificationId(
return 0;
}
void PlatformNotificationService::RecordNotificationUkmEvent(
content::BrowserContext* browser_context,
const content::NotificationDatabaseData& data) {}
} // namespace atom

View file

@ -46,6 +46,9 @@ class PlatformNotificationService
const DisplayedNotificationsCallback& callback) override;
int64_t ReadNextPersistentNotificationId(
content::BrowserContext* browser_context) override;
void RecordNotificationUkmEvent(
content::BrowserContext* browser_context,
const content::NotificationDatabaseData& data) override;
private:
AtomBrowserClient* browser_client_;

View file

@ -275,7 +275,6 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
#if !defined(OS_MACOSX)
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(is_guest_view_hack), this,
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
true /* should_register_frame_sink_id */);
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
@ -325,7 +324,7 @@ OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
// necessary to remove all connections to its old ui::Compositor.
if (is_showing_)
delegated_frame_host_->WasHidden();
delegated_frame_host_->ResetCompositor();
delegated_frame_host_->DetachFromCompositor();
#endif
if (copy_frame_generator_.get())
@ -431,7 +430,7 @@ void OffScreenRenderWidgetHostView::Show() {
#if defined(OS_MACOSX)
browser_compositor_->SetRenderWidgetHostIsHidden(false);
#else
delegated_frame_host_->SetCompositor(compositor_.get());
delegated_frame_host_->AttachToCompositor(compositor_.get());
delegated_frame_host_->WasShown(GetLocalSurfaceId(),
GetRootLayer()->bounds().size(), false);
#endif
@ -451,7 +450,7 @@ void OffScreenRenderWidgetHostView::Hide() {
browser_compositor_->SetRenderWidgetHostIsHidden(true);
#else
GetDelegatedFrameHost()->WasHidden();
GetDelegatedFrameHost()->ResetCompositor();
GetDelegatedFrameHost()->DetachFromCompositor();
#endif
is_showing_ = false;
@ -589,6 +588,10 @@ void OffScreenRenderWidgetHostView::ClearCompositorFrame() {
GetDelegatedFrameHost()->ClearDelegatedFrame();
}
void OffScreenRenderWidgetHostView::ResetFallbackToFirstNavigationSurface() {
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
}
void OffScreenRenderWidgetHostView::InitAsPopup(
content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) {
@ -746,7 +749,7 @@ ui::Layer* OffScreenRenderWidgetHostView::DelegatedFrameHostGetLayer() const {
}
bool OffScreenRenderWidgetHostView::DelegatedFrameHostIsVisible() const {
return !render_widget_host_->is_hidden();
return is_showing_;
}
SkColor OffScreenRenderWidgetHostView::DelegatedFrameHostGetGutterColor()
@ -767,10 +770,6 @@ void OffScreenRenderWidgetHostView::OnFrameTokenChanged(uint32_t frame_token) {
render_widget_host_->DidProcessFrame(frame_token);
}
void OffScreenRenderWidgetHostView::DidReceiveFirstFrameAfterNavigation() {
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
}
const viz::LocalSurfaceId& OffScreenRenderWidgetHostView::GetLocalSurfaceId()
const {
return local_surface_id_;
@ -820,11 +819,7 @@ bool OffScreenRenderWidgetHostView::TransformPointToCoordSpaceForView(
return true;
}
// In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion,
// but it is not necessary here because the final target view is responsible
// for converting before computing the final transform.
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
point, target_view, transformed_point, source);
return false;
}
void OffScreenRenderWidgetHostView::CancelWidget() {

View file

@ -132,6 +132,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
void ClearCompositorFrame(void) override;
void ResetFallbackToFirstNavigationSurface() override;
void InitAsPopup(content::RenderWidgetHostView* rwhv,
const gfx::Rect& rect) override;
void InitAsFullscreen(content::RenderWidgetHostView*) override;
@ -178,7 +179,6 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnBeginFrame(base::TimeTicks frame_time) override;
void OnFrameTokenChanged(uint32_t frame_token) override;
void DidReceiveFirstFrameAfterNavigation() override;
#endif // !defined(OS_MACOSX)
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;

View file

@ -42,10 +42,6 @@ class MacHelper : public content::BrowserCompositorMacClient,
void AcceleratedWidgetCALayerParamsUpdated() override {}
void DidReceiveFirstFrameAfterNavigation() override {
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
}
void DestroyCompositorForShutdown() override {}
bool SynchronizeVisualProperties(

View file

@ -26,8 +26,6 @@
using content::BrowserThread;
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::PrintPreviewMessageHandler);
namespace atom {
namespace {
@ -110,11 +108,9 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting(
printing::PrintCompositeClient::FromWebContents(web_contents());
DCHECK(client);
client->DoCompositeDocumentToPdf(
params.document_cookie, render_frame_host, content.metafile_data_handle,
content.data_size, content.subframe_content_info,
params.document_cookie, render_frame_host, content,
base::BindOnce(&PrintPreviewMessageHandler::OnCompositePdfDocumentDone,
weak_ptr_factory_.GetWeakPtr(),
params.expected_pages_count, ids));
weak_ptr_factory_.GetWeakPtr(), ids));
} else {
RunPrintToPDFCallback(
ids.request_id,
@ -123,7 +119,6 @@ void PrintPreviewMessageHandler::OnMetafileReadyForPrinting(
}
void PrintPreviewMessageHandler::OnCompositePdfDocumentDone(
int page_number,
const PrintHostMsg_PreviewIds& ids,
printing::mojom::PdfCompositor::Status status,
base::ReadOnlySharedMemoryRegion region) {

View file

@ -50,8 +50,7 @@ class PrintPreviewMessageHandler
content::RenderFrameHost* render_frame_host,
const PrintHostMsg_DidPreviewDocument_Params& params,
const PrintHostMsg_PreviewIds& ids);
void OnCompositePdfDocumentDone(int page_number,
const PrintHostMsg_PreviewIds& ids,
void OnCompositePdfDocumentDone(const PrintHostMsg_PreviewIds& ids,
printing::mojom::PdfCompositor::Status status,
base::ReadOnlySharedMemoryRegion region);
void OnPrintPreviewFailed(int document_cookie,

View file

@ -8,6 +8,7 @@
#include <map>
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "ui/base/models/simple_menu_model.h"
namespace atom {
@ -33,9 +34,9 @@ class AtomMenuModel : public ui::SimpleMenuModel {
ui::Accelerator* accelerator) const override;
};
class Observer {
class Observer : public base::CheckedObserver {
public:
virtual ~Observer() {}
~Observer() override {}
// Notifies the menu will open.
virtual void OnMenuWillShow() {}

View file

@ -5,6 +5,7 @@
#include "atom/browser/ui/devtools_manager_delegate.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/bind.h"
@ -93,11 +94,13 @@ DevToolsManagerDelegate::~DevToolsManagerDelegate() {}
void DevToolsManagerDelegate::Inspect(content::DevToolsAgentHost* agent_host) {}
bool DevToolsManagerDelegate::HandleCommand(
void DevToolsManagerDelegate::HandleCommand(
content::DevToolsAgentHost* agent_host,
content::DevToolsAgentHostClient* client,
base::DictionaryValue* command) {
return false;
std::unique_ptr<base::DictionaryValue> command,
const std::string& message,
NotHandledCallback callback) {
std::move(callback).Run(std::move(command), message);
}
scoped_refptr<content::DevToolsAgentHost>

View file

@ -5,6 +5,7 @@
#ifndef ATOM_BROWSER_UI_DEVTOOLS_MANAGER_DELEGATE_H_
#define ATOM_BROWSER_UI_DEVTOOLS_MANAGER_DELEGATE_H_
#include <memory>
#include <string>
#include "base/compiler_specific.h"
@ -22,9 +23,11 @@ class DevToolsManagerDelegate : public content::DevToolsManagerDelegate {
// DevToolsManagerDelegate implementation.
void Inspect(content::DevToolsAgentHost* agent_host) override;
bool HandleCommand(content::DevToolsAgentHost* agent_host,
void HandleCommand(content::DevToolsAgentHost* agent_host,
content::DevToolsAgentHostClient* client,
base::DictionaryValue* command) override;
std::unique_ptr<base::DictionaryValue> command,
const std::string& message,
NotHandledCallback callback) override;
scoped_refptr<content::DevToolsAgentHost> CreateNewTarget(
const GURL& url) override;
std::string GetDiscoveryPageHTML() override;

View file

@ -141,11 +141,11 @@ class ResponseWriter : public net::URLFetcherResponseWriter {
~ResponseWriter() override;
// URLFetcherResponseWriter overrides:
int Initialize(const net::CompletionCallback& callback) override;
int Initialize(net::CompletionOnceCallback callback) override;
int Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) override;
int Finish(int net_error, const net::CompletionCallback& callback) override;
net::CompletionOnceCallback callback) override;
int Finish(int net_error, net::CompletionOnceCallback callback) override;
private:
base::WeakPtr<InspectableWebContentsImpl> bindings_;
@ -161,13 +161,13 @@ ResponseWriter::ResponseWriter(
ResponseWriter::~ResponseWriter() {}
int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
int ResponseWriter::Initialize(net::CompletionOnceCallback callback) {
return net::OK;
}
int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
net::CompletionOnceCallback callback) {
std::string chunk = std::string(buffer->data(), num_bytes);
if (!base::IsStringUTF8(chunk))
return num_bytes;
@ -184,7 +184,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
}
int ResponseWriter::Finish(int net_error,
const net::CompletionCallback& callback) {
net::CompletionOnceCallback callback) {
return net::OK;
}

View file

@ -8,6 +8,8 @@
#include <string>
#include <vector>
#include "base/observer_list_types.h"
namespace gfx {
class Rect;
class Point;
@ -15,7 +17,7 @@ class Point;
namespace atom {
class TrayIconObserver {
class TrayIconObserver : public base::CheckedObserver {
public:
virtual void OnClicked(const gfx::Rect& bounds,
const gfx::Point& location,
@ -36,7 +38,7 @@ class TrayIconObserver {
virtual void OnMouseMoved(const gfx::Point& location, int modifiers) {}
protected:
virtual ~TrayIconObserver() {}
~TrayIconObserver() override {}
};
} // namespace atom

View file

@ -70,8 +70,8 @@ base::string16 MenuDelegate::GetLabel(int id) const {
return adapter_->GetLabel(id);
}
const gfx::FontList* MenuDelegate::GetLabelFontList(int id) const {
return adapter_->GetLabelFontList(id);
void MenuDelegate::GetLabelStyle(int id, LabelStyle* style) const {
return adapter_->GetLabelStyle(id, style);
}
bool MenuDelegate::IsCommandEnabled(int id) const {

View file

@ -46,7 +46,7 @@ class MenuDelegate : public views::MenuDelegate {
const ui::Event& e) override;
bool GetAccelerator(int id, ui::Accelerator* accelerator) const override;
base::string16 GetLabel(int id) const override;
const gfx::FontList* GetLabelFontList(int id) const override;
void GetLabelStyle(int id, LabelStyle* style) const override;
bool IsCommandEnabled(int id) const override;
bool IsCommandVisible(int id) const override;
bool IsItemChecked(int id) const override;
@ -70,7 +70,7 @@ class MenuDelegate : public views::MenuDelegate {
views::MenuButton* button_to_open_ = nullptr;
bool hold_first_switch_;
base::ObserverList<Observer> observers_;
base::ObserverList<Observer>::Unchecked observers_;
DISALLOW_COPY_AND_ASSIGN(MenuDelegate);
};

View file

@ -14,8 +14,6 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_process_host.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsPermissionHelper);
namespace {
std::string MediaStreamTypeToString(content::MediaStreamType type) {

View file

@ -30,8 +30,6 @@
#include "ui/gfx/switches.h"
#endif
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsPreferences);
namespace {
bool GetAsString(const base::Value* val,

View file

@ -15,8 +15,6 @@
#include "content/public/common/page_zoom.h"
#include "net/base/url_util.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsZoomController);
namespace atom {
WebContentsZoomController::WebContentsZoomController(

View file

@ -8,6 +8,7 @@
#include <map>
#include <string>
#include "base/observer_list_types.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
@ -19,7 +20,7 @@ class WebContentsZoomController
: public content::WebContentsObserver,
public content::WebContentsUserData<WebContentsZoomController> {
public:
class Observer {
class Observer : public base::CheckedObserver {
public:
virtual void OnZoomLevelChanged(content::WebContents* web_contents,
double level,
@ -27,7 +28,7 @@ class WebContentsZoomController
virtual void OnZoomControllerWebContentsDestroyed() {}
protected:
virtual ~Observer() {}
~Observer() override {}
};
// Defines how zoom changes are handled.

View file

@ -5,11 +5,13 @@
#ifndef ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_
#define ATOM_BROWSER_WINDOW_LIST_OBSERVER_H_
#include "base/observer_list_types.h"
namespace atom {
class NativeWindow;
class WindowListObserver {
class WindowListObserver : public base::CheckedObserver {
public:
// Called immediately after a window is added to the list.
virtual void OnWindowAdded(NativeWindow* window) {}
@ -24,7 +26,7 @@ class WindowListObserver {
virtual void OnWindowAllClosed() {}
protected:
virtual ~WindowListObserver() {}
~WindowListObserver() override {}
};
} // namespace atom

View file

@ -119,23 +119,26 @@ class Archive : public mate::Wrappable<Archive> {
};
void InitAsarSupport(v8::Isolate* isolate,
v8::Local<v8::Value> process,
v8::Local<v8::Value> source,
v8::Local<v8::Value> require) {
// Evaluate asar_init.js.
auto context = isolate->GetCurrentContext();
auto source = node::asar_init_value.ToStringChecked(isolate);
auto asar_init = v8::Script::Compile(context, source).ToLocalChecked();
auto result = asar_init->Run(context).ToLocalChecked();
v8::Local<v8::Context> context(isolate->GetCurrentContext());
auto maybe_asar_init = v8::Script::Compile(
context, node::asar_init_value.ToStringChecked(isolate));
v8::Local<v8::Script> asar_init;
v8::Local<v8::Value> result;
if (maybe_asar_init.ToLocal(&asar_init))
result = asar_init->Run(context).ToLocalChecked();
// Initialize asar support.
if (result->IsFunction()) {
v8::Local<v8::Value> args[] = {
process,
require,
node::asar_value.ToStringChecked(isolate),
};
result.As<v8::Function>()->Call(result, 3, args);
}
DCHECK(result->IsFunction());
v8::Local<v8::Value> args[] = {
source,
require,
node::asar_value.ToStringChecked(isolate),
};
result.As<v8::Function>()->Call(result, 3, args);
}
void Initialize(v8::Local<v8::Object> exports,

View file

@ -195,11 +195,11 @@ base::win::ScopedHICON ReadICOFromPath(int size, const base::FilePath& path) {
bool ReadImageSkiaFromICO(gfx::ImageSkia* image, HICON icon) {
// Convert the icon from the Windows specific HICON to gfx::ImageSkia.
std::unique_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon));
if (!bitmap)
SkBitmap bitmap = IconUtil::CreateSkBitmapFromHICON(icon);
if (bitmap.isNull())
return false;
image->AddRepresentation(gfx::ImageSkiaRep(*bitmap, 1.0f));
image->AddRepresentation(gfx::ImageSkiaRep(bitmap, 1.0f));
return true;
}
#endif

View file

@ -15,7 +15,7 @@
#include "base/logging.h"
#include "base/pickle.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"

View file

@ -12,6 +12,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "gin/converter.h"
#include "native_mate/dictionary.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
@ -41,7 +42,7 @@ struct Converter<base::char16> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
base::char16* out) {
base::string16 code = base::UTF8ToUTF16(V8ToString(val));
base::string16 code = base::UTF8ToUTF16(gin::V8ToString(isolate, val));
if (code.length() != 1)
return false;
*out = code[0];
@ -54,7 +55,7 @@ struct Converter<blink::WebInputEvent::Type> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
blink::WebInputEvent::Type* out) {
std::string type = base::ToLowerASCII(V8ToString(val));
std::string type = base::ToLowerASCII(gin::V8ToString(isolate, val));
if (type == "mousedown")
*out = blink::WebInputEvent::kMouseDown;
else if (type == "mouseup")
@ -92,7 +93,7 @@ struct Converter<blink::WebMouseEvent::Button> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
blink::WebMouseEvent::Button* out) {
std::string button = base::ToLowerASCII(V8ToString(val));
std::string button = base::ToLowerASCII(gin::V8ToString(isolate, val));
if (button == "left")
*out = blink::WebMouseEvent::Button::kLeft;
else if (button == "middle")
@ -110,7 +111,7 @@ struct Converter<blink::WebInputEvent::Modifiers> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
blink::WebInputEvent::Modifiers* out) {
std::string modifier = base::ToLowerASCII(V8ToString(val));
std::string modifier = base::ToLowerASCII(gin::V8ToString(isolate, val));
if (modifier == "shift")
*out = blink::WebInputEvent::kShiftKey;
else if (modifier == "control" || modifier == "ctrl")
@ -377,8 +378,6 @@ bool Converter<blink::WebFindOptions>::FromV8(v8::Isolate* isolate,
dict.Get("forward", &out->forward);
dict.Get("matchCase", &out->match_case);
dict.Get("findNext", &out->find_next);
dict.Get("wordStart", &out->word_start);
dict.Get("medialCapitalAsWordStart", &out->medial_capital_as_word_start);
return true;
}
@ -518,7 +517,7 @@ bool Converter<blink::WebReferrerPolicy>::FromV8(
v8::Isolate* isolate,
v8::Handle<v8::Value> val,
blink::WebReferrerPolicy* out) {
std::string policy = base::ToLowerASCII(V8ToString(val));
std::string policy = base::ToLowerASCII(gin::V8ToString(isolate, val));
if (policy == "default")
*out = blink::kWebReferrerPolicyDefault;
else if (policy == "unsafe-url")

View file

@ -10,6 +10,7 @@
#include <vector>
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/numerics/safe_conversions.h"
#include "native_mate/dictionary.h"
#include "services/network/public/cpp/resource_request_body.h"
@ -66,7 +67,9 @@ bool Converter<scoped_refptr<network::ResourceRequestBody>>::FromV8(
if (type == "rawData") {
base::Value* bytes = nullptr;
dict->GetBinary("bytes", &bytes);
(*out)->AppendBytes(bytes->GetBlob().data(), bytes->GetBlob().size());
(*out)->AppendBytes(
reinterpret_cast<const char*>(bytes->GetBlob().data()),
base::checked_cast<int>(bytes->GetBlob().size()));
} else if (type == "file") {
std::string file;
int offset = 0, length = -1;

View file

@ -244,7 +244,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Object(
v8::Local<v8::Value> V8ValueConverter::ToArrayBuffer(
v8::Isolate* isolate,
const base::Value* value) const {
const char* data = value->GetBlob().data();
const auto* data = reinterpret_cast<const char*>(value->GetBlob().data());
size_t length = value->GetBlob().size();
if (NodeBindings::IsInitialized()) {

View file

@ -45,7 +45,8 @@ namespace tracing {
class TraceEventHelper {
public:
static v8::TracingController* GetTracingController();
static void SetTracingController(v8::TracingController* controller);
static node::tracing::Agent* GetAgent();
static void SetAgent(node::tracing::Agent* agent);
};
} // namespace tracing

View file

@ -29,6 +29,7 @@
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "url/url_util.h"
#include "atom/common/node_includes.h"
@ -276,7 +277,7 @@ void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
privileged_scheme);
}
if (corsEnabled) {
blink::SchemeRegistry::RegisterURLSchemeAsCORSEnabled(privileged_scheme);
url::AddCORSEnabledScheme(scheme.c_str());
}
}

View file

@ -46,7 +46,7 @@ bool GetIPCObject(v8::Isolate* isolate,
return false;
if (value.IsEmpty() || !value->IsObject())
return false;
*ipc = value->ToObject();
*ipc = value->ToObject(isolate);
return true;
}

View file

@ -107,9 +107,8 @@ void AtomRendererClient::DidCreateScriptContext(
}
// Setup node tracing controller.
if (!node::tracing::TraceEventHelper::GetTracingController())
node::tracing::TraceEventHelper::SetTracingController(
new v8::TracingController());
if (!node::tracing::TraceEventHelper::GetAgent())
node::tracing::TraceEventHelper::SetAgent(node::CreateAgent());
// Setup node environment for each window.
node::Environment* env = node_bindings_->CreateEnvironment(context);
@ -163,13 +162,11 @@ bool AtomRendererClient::ShouldFork(blink::WebLocalFrame* frame,
const GURL& url,
const std::string& http_method,
bool is_initial_navigation,
bool is_server_redirect,
bool* send_referrer) {
bool is_server_redirect) {
// Handle all the navigations and reloads in browser.
// FIXME We only support GET here because http method will be ignored when
// the OpenURLFromTab is triggered, which means form posting would not work,
// we should solve this by patching Chromium in future.
*send_referrer = true;
return http_method == "GET";
}
@ -193,18 +190,21 @@ void AtomRendererClient::SetupMainWorldOverrides(
v8::Handle<v8::Context> context) {
// Setup window overrides in the main world context
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(context);
// Wrap the bundle into a function that receives the binding object as
// an argument.
std::string left = "(function (binding, require) {\n";
std::string right = "\n})";
auto source = v8::String::Concat(
mate::ConvertToV8(isolate, left)->ToString(),
v8::String::Concat(node::isolated_bundle_value.ToStringChecked(isolate),
mate::ConvertToV8(isolate, right)->ToString()));
auto script = v8::Script::Compile(context, source).ToLocalChecked();
auto func =
v8::Handle<v8::Function>::Cast(script->Run(context).ToLocalChecked());
isolate, mate::ConvertToV8(isolate, left)->ToString(isolate),
v8::String::Concat(isolate,
node::isolated_bundle_value.ToStringChecked(isolate),
mate::ConvertToV8(isolate, right)->ToString(isolate)));
auto result = RunScript(context, source);
DCHECK(result->IsFunction());
auto binding = v8::Object::New(isolate);
api::Initialize(binding, v8::Null(isolate), context, nullptr);
@ -223,7 +223,8 @@ void AtomRendererClient::SetupMainWorldOverrides(
command_line->HasSwitch(switches::kNativeWindowOpen));
v8::Local<v8::Value> args[] = {binding};
ignore_result(func->Call(context, v8::Null(isolate), 1, args));
ignore_result(
result.As<v8::Function>()->Call(context, v8::Null(isolate), 1, args));
}
node::Environment* AtomRendererClient::GetEnvironment(

View file

@ -51,8 +51,7 @@ class AtomRendererClient : public RendererClientBase {
const GURL& url,
const std::string& http_method,
bool is_initial_navigation,
bool is_server_redirect,
bool* send_referrer) override;
bool is_server_redirect) override;
void DidInitializeWorkerContextOnWorkerThread(
v8::Local<v8::Context> context) override;
void WillDestroyWorkerContextOnWorkerThread(

View file

@ -19,6 +19,7 @@
#include "base/path_service.h"
#include "base/process/process_handle.h"
#include "content/public/renderer/render_frame.h"
#include "gin/converter.h"
#include "native_mate/dictionary.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_document.h"
@ -52,7 +53,7 @@ v8::Local<v8::Object> GetModuleCache(v8::Isolate* isolate) {
global.SetHidden(kModuleCacheKey, cache);
}
return cache->ToObject();
return cache->ToObject(isolate);
}
// adapted from node.cc
@ -60,7 +61,7 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
v8::Local<v8::String> key,
mate::Arguments* margs) {
v8::Local<v8::Object> exports;
std::string module_key = mate::V8ToString(key);
std::string module_key = gin::V8ToString(isolate, key);
mate::Dictionary cache(isolate, GetModuleCache(isolate));
if (cache.Get(module_key.c_str(), &exports)) {
@ -87,10 +88,8 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate,
v8::Local<v8::String> preloadSrc) {
auto context = isolate->GetCurrentContext();
auto script = v8::Script::Compile(context, preloadSrc).ToLocalChecked();
auto func = script->Run(context).ToLocalChecked();
return func;
return RendererClientBase::RunScript(isolate->GetCurrentContext(),
preloadSrc);
}
class AtomSandboxedRenderFrameObserver : public AtomRenderFrameObserver {
@ -192,20 +191,21 @@ void AtomSandboxedRendererClient::DidCreateScriptContext(
std::string right = "\n})";
// Compile the wrapper and run it to get the function object
auto source = v8::String::Concat(
mate::ConvertToV8(isolate, left)->ToString(),
v8::String::Concat(node::preload_bundle_value.ToStringChecked(isolate),
mate::ConvertToV8(isolate, right)->ToString()));
auto script = v8::Script::Compile(context, source).ToLocalChecked();
auto func =
v8::Handle<v8::Function>::Cast(script->Run(context).ToLocalChecked());
isolate, mate::ConvertToV8(isolate, left)->ToString(isolate),
v8::String::Concat(isolate,
node::preload_bundle_value.ToStringChecked(isolate),
mate::ConvertToV8(isolate, right)->ToString(isolate)));
auto result = RunScript(context, source);
DCHECK(result->IsFunction());
// Create and initialize the binding object
auto binding = v8::Object::New(isolate);
InitializeBindings(binding, context);
AddRenderBindings(isolate, binding);
v8::Local<v8::Value> args[] = {binding};
// Execute the function with proper arguments
ignore_result(
func->Call(context, v8::Null(isolate), node::arraysize(args), args));
ignore_result(result.As<v8::Function>()->Call(context, v8::Null(isolate),
node::arraysize(args), args));
}
void AtomSandboxedRendererClient::WillReleaseScriptContext(
@ -226,7 +226,7 @@ void AtomSandboxedRendererClient::InvokeIpcCallback(
const std::string& callback_name,
std::vector<v8::Handle<v8::Value>> args) {
auto* isolate = context->GetIsolate();
auto binding_key = mate::ConvertToV8(isolate, kIpcKey)->ToString();
auto binding_key = mate::ConvertToV8(isolate, kIpcKey)->ToString(isolate);
auto private_binding_key = v8::Private::ForApi(isolate, binding_key);
auto global_object = context->Global();
v8::Local<v8::Value> value;
@ -234,8 +234,9 @@ void AtomSandboxedRendererClient::InvokeIpcCallback(
return;
if (value.IsEmpty() || !value->IsObject())
return;
auto binding = value->ToObject();
auto callback_key = mate::ConvertToV8(isolate, callback_name)->ToString();
auto binding = value->ToObject(isolate);
auto callback_key =
mate::ConvertToV8(isolate, callback_name)->ToString(isolate);
auto callback_value = binding->Get(callback_key);
DCHECK(callback_value->IsFunction()); // set by sandboxed_renderer/init.js
auto callback = v8::Handle<v8::Function>::Cast(callback_value);

View file

@ -153,7 +153,6 @@ void RendererClientBase::RenderThreadStarted() {
// In Chrome we should set extension's origins to match the pages they can
// work on, but in Electron currently we just let extensions do anything.
blink::SchemeRegistry::RegisterURLSchemeAsSecure(extension_scheme);
blink::SchemeRegistry::RegisterURLSchemeAsCORSEnabled(extension_scheme);
blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy(
extension_scheme);
@ -278,4 +277,14 @@ v8::Local<v8::Context> RendererClientBase::GetContext(
return frame->MainWorldScriptContext();
}
v8::Local<v8::Value> RendererClientBase::RunScript(
v8::Local<v8::Context> context,
v8::Local<v8::String> source) {
auto maybe_script = v8::Script::Compile(context, source);
v8::Local<v8::Script> script;
if (!maybe_script.ToLocal(&script))
return v8::Local<v8::Value>();
return script->Run(context).ToLocalChecked();
}
} // namespace atom

View file

@ -39,6 +39,9 @@ class RendererClientBase : public content::ContentRendererClient {
// Get the context that the Electron API is running in.
v8::Local<v8::Context> GetContext(blink::WebLocalFrame* frame,
v8::Isolate* isolate) const;
// Executes a given v8 Script
static v8::Local<v8::Value> RunScript(v8::Local<v8::Context> context,
v8::Local<v8::String> source);
protected:
void AddRenderBindings(v8::Isolate* isolate,

View file

@ -1,9 +1,7 @@
'use strict'
;(function () { // eslint-disable-line
return function (process, require, asarSource) {
const source = process.binding('natives')
return function (source, require, asarSource) {
// Expose fs module without asar support.
source['original-fs'] = source.fs

View file

@ -10,17 +10,33 @@ using v8::Array;
using v8::Boolean;
using v8::External;
using v8::Function;
using v8::Int32;
using v8::Integer;
using v8::Isolate;
using v8::Local;
using v8::Maybe;
using v8::MaybeLocal;
using v8::Number;
using v8::Object;
using v8::Promise;
using v8::String;
using v8::Uint32;
using v8::Value;
namespace mate {
namespace {
template <typename T, typename U>
bool FromMaybe(Maybe<T> maybe, U* out) {
if (maybe.IsNothing())
return false;
*out = static_cast<U>(maybe.FromJust());
return true;
}
} // namespace
Local<Value> Converter<bool>::ToV8(Isolate* isolate, bool val) {
return v8::Boolean::New(isolate, val);
}
@ -28,7 +44,7 @@ Local<Value> Converter<bool>::ToV8(Isolate* isolate, bool val) {
bool Converter<bool>::FromV8(Isolate* isolate, Local<Value> val, bool* out) {
if (!val->IsBoolean())
return false;
*out = val->BooleanValue();
*out = val.As<Boolean>()->Value();
return true;
}
@ -43,8 +59,7 @@ bool Converter<unsigned long>::FromV8(Isolate* isolate,
unsigned long* out) {
if (!val->IsNumber())
return false;
*out = val->IntegerValue();
return true;
return FromMaybe(val->IntegerValue(isolate->GetCurrentContext()), out);
}
#endif
@ -57,7 +72,7 @@ bool Converter<int32_t>::FromV8(Isolate* isolate,
int32_t* out) {
if (!val->IsInt32())
return false;
*out = val->Int32Value();
*out = val.As<Int32>()->Value();
return true;
}
@ -70,7 +85,7 @@ bool Converter<uint32_t>::FromV8(Isolate* isolate,
uint32_t* out) {
if (!val->IsUint32())
return false;
*out = val->Uint32Value();
*out = val.As<Uint32>()->Value();
return true;
}
@ -85,8 +100,7 @@ bool Converter<int64_t>::FromV8(Isolate* isolate,
return false;
// Even though IntegerValue returns int64_t, JavaScript cannot represent
// the full precision of int64_t, which means some rounding might occur.
*out = val->IntegerValue();
return true;
return FromMaybe(val->IntegerValue(isolate->GetCurrentContext()), out);
}
Local<Value> Converter<uint64_t>::ToV8(Isolate* isolate, uint64_t val) {
@ -98,8 +112,7 @@ bool Converter<uint64_t>::FromV8(Isolate* isolate,
uint64_t* out) {
if (!val->IsNumber())
return false;
*out = static_cast<uint64_t>(val->IntegerValue());
return true;
return FromMaybe(val->IntegerValue(isolate->GetCurrentContext()), out);
}
Local<Value> Converter<float>::ToV8(Isolate* isolate, float val) {
@ -109,7 +122,7 @@ Local<Value> Converter<float>::ToV8(Isolate* isolate, float val) {
bool Converter<float>::FromV8(Isolate* isolate, Local<Value> val, float* out) {
if (!val->IsNumber())
return false;
*out = static_cast<float>(val->NumberValue());
*out = static_cast<float>(val.As<Number>()->Value());
return true;
}
@ -122,7 +135,7 @@ bool Converter<double>::FromV8(Isolate* isolate,
double* out) {
if (!val->IsNumber())
return false;
*out = val->NumberValue();
*out = val.As<Number>()->Value();
return true;
}
@ -147,9 +160,10 @@ bool Converter<std::string>::FromV8(Isolate* isolate,
if (!val->IsString())
return false;
Local<String> str = Local<String>::Cast(val);
int length = str->Utf8Length();
int length = str->Utf8Length(isolate);
out->resize(length);
str->WriteUtf8(&(*out)[0], length, NULL, String::NO_NULL_TERMINATION);
str->WriteUtf8(isolate, &(*out)[0], length, NULL,
String::NO_NULL_TERMINATION);
return true;
}
@ -245,13 +259,4 @@ v8::Local<v8::String> StringToSymbol(v8::Isolate* isolate,
static_cast<uint32_t>(val.length()));
}
std::string V8ToString(v8::Local<v8::Value> value) {
if (value.IsEmpty())
return std::string();
std::string result;
if (!ConvertFromV8(NULL, value, &result))
return std::string();
return result;
}
} // namespace mate

View file

@ -11,6 +11,7 @@
#include <vector>
#include "base/strings/string_piece.h"
#include "gin/converter.h"
#include "v8/include/v8.h"
namespace mate {
@ -136,8 +137,6 @@ struct Converter<std::string> {
v8::Local<v8::String> StringToSymbol(v8::Isolate* isolate,
const base::StringPiece& input);
std::string V8ToString(v8::Local<v8::Value> value);
template <>
struct Converter<v8::Local<v8::Function>> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
@ -276,13 +275,14 @@ struct Converter<std::map<std::string, T>> {
if (!val->IsObject())
return false;
v8::Local<v8::Object> dict = val->ToObject();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Object> dict = val->ToObject(context).ToLocalChecked();
v8::Local<v8::Array> keys = dict->GetOwnPropertyNames();
for (uint32_t i = 0; i < keys->Length(); ++i) {
v8::Local<v8::Value> key = keys->Get(i);
T value;
if (Converter<T>::FromV8(isolate, dict->Get(key), &value))
(*out)[V8ToString(key)] = std::move(value);
(*out)[gin::V8ToString(isolate, key)] = std::move(value);
}
return true;
}

View file

@ -13,15 +13,13 @@ namespace mate {
// Currently we don't have a mechanism for retaining a mate::Wrappable object
// in the C++ heap because strong references from C++ to V8 can cause memory
// leaks.
template<typename T>
template <typename T>
class Handle {
public:
Handle() : object_(NULL) {}
Handle(v8::Local<v8::Object> wrapper, T* object)
: wrapper_(wrapper),
object_(object) {
}
: wrapper_(wrapper), object_(object) {}
bool IsEmpty() const { return !object_; }
@ -39,13 +37,14 @@ class Handle {
T* object_;
};
template<typename T>
struct Converter<mate::Handle<T> > {
template <typename T>
struct Converter<mate::Handle<T>> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const mate::Handle<T>& val) {
const mate::Handle<T>& val) {
return val.ToV8();
}
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
mate::Handle<T>* out) {
T* object = NULL;
if (val->IsNull() || val->IsUndefined()) {
@ -55,14 +54,15 @@ struct Converter<mate::Handle<T> > {
if (!Converter<T*>::FromV8(isolate, val, &object)) {
return false;
}
*out = mate::Handle<T>(val->ToObject(), object);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
*out = mate::Handle<T>(val->ToObject(context).ToLocalChecked(), object);
return true;
}
};
// This function is a convenient way to create a handle from a raw pointer
// without having to write out the type of the object explicitly.
template<typename T>
template <typename T>
mate::Handle<T> CreateHandle(v8::Isolate* isolate, T* object) {
return mate::Handle<T>(object->GetWrapper(), object);
}

41
package-lock.json generated
View file

@ -4266,8 +4266,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@ -4288,14 +4287,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -4310,20 +4307,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -4440,8 +4434,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -4453,7 +4446,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -4468,7 +4460,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -4476,14 +4467,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -4502,7 +4491,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -4583,8 +4571,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -4596,7 +4583,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -4682,8 +4668,7 @@
"safe-buffer": {
"version": "5.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@ -4719,7 +4704,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -4739,7 +4723,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -4783,14 +4766,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},

View file

@ -38,7 +38,6 @@ mas_blink_no_private_api.patch
mas_no_private_api.patch
resource_file_conflict.patch
scroll_bounce_flag.patch
webview_reattach.patch
mas-cfisobjc.patch
mas-cgdisplayusesforcetogray.patch
mas-audiodeviceduck.patch
@ -55,7 +54,6 @@ disable_detach_webview_frame.patch
ssl_security_state_tab_helper.patch
leveldb_ssize_t.patch
exclude-a-few-test-files-from-build.patch
crashpad_http_status.patch
expose-net-observer-api.patch
desktop_media_list.patch
proxy_config_monitor.patch
@ -69,11 +67,9 @@ tts.patch
color_chooser.patch
printing.patch
verbose_generate_breakpad_symbols.patch
fix_zoom_display.patch
chrome_process_finder.patch
customizable_app_indicator_id_prefix.patch
cross_site_document_resource_handler.patch
content_allow_embedder_to_prevent_locking_scheme_registry.patch
fix_trackpad_scrolling.patch
mac_fix_form_control_rendering_on_10_14_mojave.patch
ensure_cookie_store.patch

View file

@ -26,7 +26,7 @@ index 7e55ef366ac8320f730cdcb268453b1fa2710887..9b000ab1dfb85c097e879eacbfe69dc0
namespace ui {
@@ -139,7 +138,15 @@ base::string16 Accelerator::GetShortcutText() const {
@@ -147,7 +146,15 @@ base::string16 Accelerator::GetShortcutText() const {
shortcut = KeyCodeToName(key_code_);
#endif
@ -70,9 +70,9 @@ index 7e55ef366ac8320f730cdcb268453b1fa2710887..9b000ab1dfb85c097e879eacbfe69dc0
@@ -223,7 +226,7 @@ base::string16 Accelerator::ApplyLongFormModifiers(
// more information.
if (IsCtrlDown())
shortcut = l10n_util::GetStringFUTF16(IDS_APP_CONTROL_MODIFIER, shortcut);
shortcut = ApplyModifierToAcceleratorString(shortcut, IDS_APP_CTRL_KEY);
- else if (IsAltDown())
+ if (IsAltDown())
shortcut = l10n_util::GetStringFUTF16(IDS_APP_ALT_MODIFIER, shortcut);
shortcut = ApplyModifierToAcceleratorString(shortcut, IDS_APP_ALT_KEY);
if (IsCmdDown()) {

View file

@ -39,10 +39,10 @@ index 2aef366ac8194aa261cbca6abc051f7da8a988d3..3c7d66c81032636abcca4f1538ce9b7f
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 83a6639306a9a2c907b478a974628cc89e2de97c..8511e7d594ce5116f19619fa89115e24422e419c 100644
index de5c4b11829141913784fc3c7190ab86368cf675..f88a404c95c12ab5647bf88bd7be2504699b7ff7 100644
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
@@ -665,6 +665,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
@@ -671,6 +671,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
size, WTF::ArrayBufferContents::kDontInitialize);
}
@ -54,7 +54,7 @@ index 83a6639306a9a2c907b478a974628cc89e2de97c..8511e7d594ce5116f19619fa89115e24
WTF::ArrayBufferContents::FreeMemory(data);
}
diff --git a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc
index 053babce10512d9967546f2e547f826c9ad1b158..e33d6d4ceb5a10ffbe853dc87cad8a1145992154 100644
index 83133e1a836d0c3b25e931e0c19ebcdb987173cf..2c64bd4d5cf3ecd71ee0711cecd1c149e8795797 100644
--- a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc
+++ b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.cc
@@ -121,6 +121,11 @@ void* ArrayBufferContents::AllocateMemoryOrNull(size_t size,
@ -70,10 +70,10 @@ index 053babce10512d9967546f2e547f826c9ad1b158..e33d6d4ceb5a10ffbe853dc87cad8a11
Partitions::ArrayBufferPartition()->Free(data);
}
diff --git a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h
index 809229caa872789345218538d945f3ed6a871adc..6248ad32d6b045fbd4c863cbdbeb859a3ecde3a5 100644
index a87a02bdaf4b7050752f05984ff1c0170f64a203..cf7f2940d48b03c51b997729fc7ea033dc0d1bfe 100644
--- a/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h
+++ b/third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h
@@ -178,6 +178,7 @@ class WTF_EXPORT ArrayBufferContents {
@@ -187,6 +187,7 @@ class WTF_EXPORT ArrayBufferContents {
void CopyTo(ArrayBufferContents& other);
static void* AllocateMemoryOrNull(size_t, InitializationPolicy);

View file

@ -6,10 +6,10 @@ Subject: allow_webview_file_url.patch
Allow webview to load non-web URLs.
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 061ad189c46d5f0f1afb09052cc21aeb7e60a744..d64ba4f20d49a57b29e1ad5bc7ac53616974efc9 100644
index 2ed617dbab85dc45184cc0883669f9b5401d5766..6830ea9a0c18affb54ecab7cead5059a7e27bbed 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1488,6 +1488,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
@@ -1459,6 +1459,8 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
!policy->IsWebSafeScheme(info.common_params.url.scheme()) &&
!is_external_protocol;

View file

@ -5,10 +5,10 @@ Subject: blink-worker-enable-csp-in-file-scheme.patch
diff --git a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc
index 6e803af108f310b6df0ff0f3e2f0ddb0cce3cae3..94a72b37ae8ebf7f142b5dfdd02261220b6eeb99 100644
index fae3bbccaf04ae653b52b484334a1b402a127b76..5a13426281adb0d51a5259346c1f588a67a78e07 100644
--- a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc
+++ b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc
@@ -244,7 +244,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy(
@@ -261,7 +261,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy(
// document (which is implemented in WorkerMessagingProxy, and
// m_contentSecurityPolicy should be left as nullptr to inherit the policy).
if (!response.Url().ProtocolIs("blob") &&

View file

@ -10,7 +10,7 @@ to fix electron/electron#13787. The backport landed in Chromium 67 but the
DidCreateScriptContext re-ordering needs to be upstreamed or kept indefinitely
diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
index cbd9f811d97855e8bf083cbb2dd9ebcbcab0a1a5..160e5bc7d57ad18619a4c912d57b6b07b790ddf5 100644
index e148eda29606cdf8856c6875dc8e370f29e90f8a..c7289e9c60fc75d0db0d3671d7dd4b428bd80329 100644
--- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
+++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
@@ -177,11 +177,10 @@ void LocalWindowProxy::Initialize() {

View file

@ -14,10 +14,10 @@ when there is code doing that.
This patch reverts the change to fix the crash in Electron.
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
index 52810bba03b0c2916ae84d5b1642740cc2d7a2e6..65575d432df5e8e27f8285dcf6dd77e48e2ea1ec 100644
index a7ddc156c2b13acaaf9295df98dfa3955e9a015b..d684cbcaf2a82f1d7423522bf4cc48713a13dead 100644
--- a/third_party/blink/renderer/core/frame/local_frame.cc
+++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -392,10 +392,6 @@ void LocalFrame::Detach(FrameDetachType type) {
@@ -340,10 +340,6 @@ void LocalFrame::Detach(FrameDetachType type) {
}
CHECK(!view_ || !view_->IsAttached());
@ -28,7 +28,7 @@ index 52810bba03b0c2916ae84d5b1642740cc2d7a2e6..65575d432df5e8e27f8285dcf6dd77e4
if (!Client())
return;
@@ -413,6 +409,10 @@ void LocalFrame::Detach(FrameDetachType type) {
@@ -361,6 +357,10 @@ void LocalFrame::Detach(FrameDetachType type) {
// Notify ScriptController that the frame is closing, since its cleanup ends
// up calling back to LocalFrameClient via WindowProxy.
GetScriptController().ClearForClose();

View file

@ -5,10 +5,10 @@ Subject: blink_world_context.patch
diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h
index 437e8b22c0f589df3eb41ba8628092c3146b1f8c..0ff6b21fd5a9e49254f283dcbab0b2be9668b296 100644
index e2f071b74c17c4d8854a66c461e6f3fa34ee5eaf..03f725429382a3b2ebc9e73600dc1b92168592b1 100644
--- a/third_party/blink/public/web/web_local_frame.h
+++ b/third_party/blink/public/web/web_local_frame.h
@@ -438,6 +438,9 @@ class WebLocalFrame : public WebFrame {
@@ -466,6 +466,9 @@ class WebLocalFrame : public WebFrame {
// be calling this API.
virtual v8::Local<v8::Context> MainWorldScriptContext() const = 0;
@ -19,10 +19,10 @@ index 437e8b22c0f589df3eb41ba8628092c3146b1f8c..0ff6b21fd5a9e49254f283dcbab0b2be
// that the script evaluated to with callback. Script execution can be
// suspend.
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
index 082b055a570c9d6ec944b3310f54934e65fbe6a0..345d97f888b522c17c755f48e43e7a699ca78472 100644
index fbadba8e0f240ce48ba26ad01573a97203a123ab..ac062b3967e61def6484bb266b55e6006bb0fcdd 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -874,6 +874,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
@@ -885,6 +885,13 @@ v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const {
return MainWorldScriptContext()->Global();
}
@ -37,10 +37,10 @@ index 082b055a570c9d6ec944b3310f54934e65fbe6a0..345d97f888b522c17c755f48e43e7a69
return BindingSecurity::ShouldAllowAccessToFrame(
CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()),
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
index feb4b14bc8e52c8335e93d133506ecd6226c051d..95d1cc2c91ca01ec95dc3f63aa5f2546a7074095 100644
index 9b07d3bc3e50775225fafc020f6264c6b3f4cd15..8420f56040c87643365d40bd17ff6071e81eb4f8 100644
--- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h
+++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -145,6 +145,8 @@ class CORE_EXPORT WebLocalFrameImpl final
@@ -146,6 +146,8 @@ class CORE_EXPORT WebLocalFrameImpl final
int argc,
v8::Local<v8::Value> argv[]) override;
v8::Local<v8::Context> MainWorldScriptContext() const override;

View file

@ -5,10 +5,10 @@ Subject: browser_compositor_mac.patch
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.h b/content/browser/renderer_host/browser_compositor_view_mac.h
index 46be85eea4b52b191d9e717fd34408a6c2445199..4c816b7021f87873a524e0dc2384146193b86e3c 100644
index 7dc490ea5607bc61344d763d73b008c9be43280a..df136ec5c30db5146e5d1dd34e2f5ff55377af59 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.h
+++ b/content/browser/renderer_host/browser_compositor_view_mac.h
@@ -59,6 +59,8 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient,
@@ -60,6 +60,8 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient,
// These will not return nullptr until Destroy is called.
DelegatedFrameHost* GetDelegatedFrameHost();
@ -17,7 +17,7 @@ index 46be85eea4b52b191d9e717fd34408a6c2445199..4c816b7021f87873a524e0dc23841461
// Ensure that the currect compositor frame be cleared (even if it is
// potentially visible).
void ClearCompositorFrame();
@@ -69,6 +71,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient,
@@ -70,6 +72,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient,
// no valid frame is available.
const gfx::CALayerParams* GetLastCALayerParams() const;
@ -26,10 +26,10 @@ index 46be85eea4b52b191d9e717fd34408a6c2445199..4c816b7021f87873a524e0dc23841461
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink);
void OnDidNotProduceFrame(const viz::BeginFrameAck& ack);
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm
index 92afcc77910610e53378f55adc003cc1bdf3109a..42bd6fd7c169de36c775471c68b456f1386ff666 100644
index fb23caccdd1dc0280ba2039937222679b6b460d8..d1739539e7bf5240c70aece8bcc84bc093ebde3a 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -81,6 +81,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
@@ -79,6 +79,12 @@
DCHECK_EQ(1u, num_erased);
}

View file

@ -5,7 +5,7 @@ Subject: build_gn.patch
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index fcc00ee0e49f101cb1b10629747c4c4fa521776d..3232a0360e94e78621f7f672e3de4bdcc5f7b8d5 100644
index 387fdb2795a832ba8ee1187f3097f736c69e9839..590d457928ced573a7152a129bbfcf01309ee3c1 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -123,6 +123,9 @@ if (current_os == "") {

View file

@ -5,10 +5,10 @@ Subject: can_create_window.patch
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 520dcffb53534e76d739cff74ea58d49bdfb682a..783dc705f748bc6c9d3b8630ce12ad39ff2fd7d2 100644
index c5e56bc15cfbf95f7564cc4d080243c48e585f20..30b945c417d04106a05a0d3dcb86e5df87845c0c 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -3142,6 +3142,38 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -3163,6 +3163,38 @@ void RenderFrameHostImpl::CreateNewWindow(
"frame_tree_node", frame_tree_node_->frame_tree_node_id(), "url",
params->target_url.possibly_invalid_spec());
@ -47,7 +47,7 @@ index 520dcffb53534e76d739cff74ea58d49bdfb682a..783dc705f748bc6c9d3b8630ce12ad39
bool no_javascript_access = false;
// Filter out URLs to which navigation is disallowed from this context.
@@ -3170,6 +3202,7 @@ void RenderFrameHostImpl::CreateNewWindow(
@@ -3191,6 +3223,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_.GetURL(), params->window_container_type,
params->target_url, params->referrer, params->frame_name,
params->disposition, *params->features,
@ -56,10 +56,10 @@ index 520dcffb53534e76d739cff74ea58d49bdfb682a..783dc705f748bc6c9d3b8630ce12ad39
&no_javascript_access);
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index e3b04edb5a301115d894190a64e734eb2c8b3499..254f94016b97620cfbc102cbbc7677cfcfe38e22 100644
index e9cb49ebc81d7b9babe25a0a9c9ddfdf1db843d9..23776e0911f2315b60451d132ddd3cd002a241a2 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -313,6 +313,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
@@ -300,6 +300,7 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New();
params->target_url = GURL("about:blank");
@ -68,7 +68,7 @@ index e3b04edb5a301115d894190a64e734eb2c8b3499..254f94016b97620cfbc102cbbc7677cf
std::move(params), base::BindOnce([](mojom::CreateNewWindowStatus,
mojom::CreateNewWindowReplyPtr) {}));
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index fb4732e6e666044233716fc3ae629dedad7b2618..804086522994b038c86a31e7acdcffc1e039c260 100644
index c2ce967c17ac6a61b3aeb6e26f88212211f7a9f4..8c8d149b9c0de26e050b196a1a2a1bf6e953f121 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -12,6 +12,8 @@ import "content/public/common/resource_type.mojom";
@ -80,7 +80,7 @@ index fb4732e6e666044233716fc3ae629dedad7b2618..804086522994b038c86a31e7acdcffc1
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/network/public/mojom/url_loader.mojom";
@@ -157,6 +159,24 @@ interface FrameFactory {
@@ -168,6 +170,24 @@ interface FrameFactory {
CreateFrame(int32 frame_routing_id, Frame& frame);
};
@ -105,7 +105,7 @@ index fb4732e6e666044233716fc3ae629dedad7b2618..804086522994b038c86a31e7acdcffc1
struct CreateNewWindowParams {
// True if this open request came in the context of a user gesture.
//
@@ -196,6 +216,10 @@ struct CreateNewWindowParams {
@@ -207,6 +227,10 @@ struct CreateNewWindowParams {
// The window features to use for the new window.
blink.mojom.WindowFeatures features;
@ -117,10 +117,10 @@ index fb4732e6e666044233716fc3ae629dedad7b2618..804086522994b038c86a31e7acdcffc1
// Operation result when the renderer asks the browser to create a new window.
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 2a896c7072caae655be1902b536d9172448abddb..bb54b89bef5c6f32e7b4a056336c85494e2a04de 100644
index 8e652e4b66f08ff86c3184adf0ef9704fab0d11c..12411003ad4d54576117cc719bff804da1706170 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -435,6 +435,8 @@ bool ContentBrowserClient::CanCreateWindow(
@@ -453,6 +453,8 @@ bool ContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@ -130,10 +130,10 @@ index 2a896c7072caae655be1902b536d9172448abddb..bb54b89bef5c6f32e7b4a056336c8549
bool opener_suppressed,
bool* no_javascript_access) {
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index fd5d62fee1172b07a692fcf6ce06a30096d25b03..3be31602689cb93b965729cc4e35cf6d23a8ec2f 100644
index bc2b501331e9d628c5285eee003ca3b55f3cb98f..89674a18276e34eebc0038e588ea4629a4eaca6c 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -162,6 +162,7 @@ class RenderFrameHost;
@@ -169,6 +169,7 @@ class RenderFrameHost;
class RenderProcessHost;
class RenderViewHost;
class ResourceContext;
@ -141,7 +141,7 @@ index fd5d62fee1172b07a692fcf6ce06a30096d25b03..3be31602689cb93b965729cc4e35cf6d
class ServiceManagerConnection;
class SiteInstance;
class SpeechRecognitionManagerDelegate;
@@ -706,6 +707,8 @@ class CONTENT_EXPORT ContentBrowserClient {
@@ -734,6 +735,8 @@ class CONTENT_EXPORT ContentBrowserClient {
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@ -151,10 +151,10 @@ index fd5d62fee1172b07a692fcf6ce06a30096d25b03..3be31602689cb93b965729cc4e35cf6d
bool opener_suppressed,
bool* no_javascript_access);
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 03d9cda9f95daa369101b6f922e0978061e0225f..edad9fc3198ca12bd326c9f407a62866373e3b29 100644
index 215c4a750f046939cb59ba8f53059eb4c3e35ef6..0e6199a8f594fd6c7384147c541e6c06a263f51e 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -79,6 +79,7 @@
@@ -78,6 +78,7 @@
#include "content/renderer/ime_event_guard.h"
#include "content/renderer/internal_document_state_data.h"
#include "content/renderer/loader/request_extra_data.h"
@ -162,7 +162,7 @@ index 03d9cda9f95daa369101b6f922e0978061e0225f..edad9fc3198ca12bd326c9f407a62866
#include "content/renderer/media/audio/audio_device_factory.h"
#include "content/renderer/media/stream/media_stream_device_observer.h"
#include "content/renderer/media/video_capture_impl_manager.h"
@@ -1270,6 +1271,46 @@ WebView* RenderViewImpl::CreateView(WebLocalFrame* creator,
@@ -1421,6 +1422,46 @@ WebView* RenderViewImpl::CreateView(WebLocalFrame* creator,
}
params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);
@ -210,10 +210,10 @@ index 03d9cda9f95daa369101b6f922e0978061e0225f..edad9fc3198ca12bd326c9f407a62866
// moved on send.
bool is_background_tab =
diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.cc b/content/shell/browser/layout_test/layout_test_content_browser_client.cc
index fe0e3720ea5d60d65ecbbc3836bc87785997a513..4a31617b5a898b0f6d7e25cc05992d36862678a0 100644
index 7da9182635afa02226a0848d35d7ec372f4fc785..048e1126a31cf5bcaf9e0203af4a0c449db190f5 100644
--- a/content/shell/browser/layout_test/layout_test_content_browser_client.cc
+++ b/content/shell/browser/layout_test/layout_test_content_browser_client.cc
@@ -276,6 +276,8 @@ bool LayoutTestContentBrowserClient::CanCreateWindow(
@@ -279,6 +279,8 @@ bool LayoutTestContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
@ -223,7 +223,7 @@ index fe0e3720ea5d60d65ecbbc3836bc87785997a513..4a31617b5a898b0f6d7e25cc05992d36
bool opener_suppressed,
bool* no_javascript_access) {
diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.h b/content/shell/browser/layout_test/layout_test_content_browser_client.h
index fa458cf0c92d6f75ecd71e296ba1af88ace400dc..cdd95a1d88e582a31aca43cd2fc9001113dcde1c 100644
index c601d6e4b28dfb4216b2d7072ba1ac9dd7345f42..00bbd237ff8afd6567218363423538b9e38ae1b0 100644
--- a/content/shell/browser/layout_test/layout_test_content_browser_client.h
+++ b/content/shell/browser/layout_test/layout_test_content_browser_client.h
@@ -66,6 +66,8 @@ class LayoutTestContentBrowserClient : public ShellContentBrowserClient {

View file

@ -7,7 +7,7 @@ Disable persiste licence support check for widevine cdm,
as its not supported in the current version of chrome.
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc
index 5c38d0b1ce7c6d395126b6cc428467d31bb3c0a5..4ffaf2a3301eec188b1b40b06b2152f17b4c7641 100644
index 7826495469120f46d1bd8529139f7567f45138ef..166e5a31d5f36876b339c5cf66527fc88e7c26af 100644
--- a/chrome/renderer/media/chrome_key_systems.cc
+++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -15,7 +15,9 @@
@ -20,7 +20,7 @@ index 5c38d0b1ce7c6d395126b6cc428467d31bb3c0a5..4ffaf2a3301eec188b1b40b06b2152f1
#include "components/cdm/renderer/external_clear_key_key_system_properties.h"
#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "content/public/renderer/render_thread.h"
@@ -185,12 +187,14 @@ static SupportedCodecs GetSupportedCodecs(
@@ -187,12 +189,14 @@ static SupportedCodecs GetSupportedCodecs(
// Returns persistent-license session support.
static EmeSessionTypeSupport GetPersistentLicenseSupport(
bool supported_by_the_cdm) {

View file

@ -15,7 +15,7 @@ code was around 2012-2013, and this is purely UI, I don't think they have
automated tests for it).
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h
index f57c1ded416a7a642bdf8502daeb40afe539903b..59fdd948c3c5e57374beef801b96f5bfd1343b1c 100644
index c0c7c21131c3dd8d197ad1808142915704406d9d..43b5e57e91a451e79c3f77450d99cffc222842fd 100644
--- a/chrome/browser/ui/browser_dialogs.h
+++ b/chrome/browser/ui/browser_dialogs.h
@@ -4,7 +4,7 @@
@ -44,11 +44,10 @@ index f57c1ded416a7a642bdf8502daeb40afe539903b..59fdd948c3c5e57374beef801b96f5bf
// Shows or hides the Task Manager. |browser| can be NULL when called from Ash.
// Returns a pointer to the underlying TableModel, which can be ignored, or used
// for testing.
@@ -129,11 +130,11 @@ void ShowBookmarkAppDialog(content::WebContents* web_contents,
void ShowPWAInstallDialog(content::WebContents* web_contents,
const WebApplicationInfo& web_app_info,
AppInstallationAcceptanceCallback callback);
-
@@ -138,10 +139,11 @@ void ShowPWAInstallDialog(content::WebContents* web_contents,
// user interaction.
void SetAutoAcceptPWAInstallDialogForTesting(bool auto_accept);
+#endif
// Shows a color chooser that reports to the given WebContents.
content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
@ -58,7 +57,7 @@ index f57c1ded416a7a642bdf8502daeb40afe539903b..59fdd948c3c5e57374beef801b96f5bf
#if defined(OS_MACOSX)
// Bridging methods that show/hide the toolkit-views based Task Manager on Mac.
@@ -301,13 +302,13 @@ void ShowChromeCleanerRebootPrompt(
@@ -310,13 +312,13 @@ void ShowChromeCleanerRebootPrompt(
safe_browsing::ChromeCleanerRebootDialogController* dialog_controller);
#endif // OS_WIN

View file

@ -18,7 +18,7 @@ diff --git a/chrome/browser/extensions/global_shortcut_listener_mac.mm b/chrome/
index f612ba2fb7952654663cbce596c43b0b65d5ea29..77c2c68e6f9bfec3fc887e2119243cee1321cd17 100644
--- a/chrome/browser/extensions/global_shortcut_listener_mac.mm
+++ b/chrome/browser/extensions/global_shortcut_listener_mac.mm
@@ -20,6 +20,26 @@ using extensions::GlobalShortcutListenerMac;
@@ -20,6 +20,26 @@
namespace extensions {
@ -92,7 +92,7 @@ diff --git a/ui/base/accelerators/media_keys_listener_mac.mm b/ui/base/accelerat
index cd595b0c017d6e36a5d94f7c99fe0a098a52b067..941c1a76a1c3ebe542aebcc9dc301d19bab47057 100644
--- a/ui/base/accelerators/media_keys_listener_mac.mm
+++ b/ui/base/accelerators/media_keys_listener_mac.mm
@@ -30,6 +30,12 @@ ui::KeyboardCode MediaKeyCodeToKeyboardCode(int key_code) {
@@ -30,6 +30,12 @@
case NX_KEYTYPE_NEXT:
case NX_KEYTYPE_FAST:
return ui::VKEY_MEDIA_NEXT_TRACK;
@ -105,7 +105,7 @@ index cd595b0c017d6e36a5d94f7c99fe0a098a52b067..941c1a76a1c3ebe542aebcc9dc301d19
}
return ui::VKEY_UNKNOWN;
}
@@ -180,7 +186,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
@@ -180,7 +186,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
int key_code = (data1 & 0xFFFF0000) >> 16;
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&

View file

@ -5,10 +5,10 @@ Subject: compositor_delegate.patch
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 511d805187b15325f72c574ad37fb43e4e5e2df6..5fb01fee0378ac807ee4fde6d4bea8d76db75d42 100644
index 642fff3b4367f0fe684d99cdcd4aee7d1a21cb40..45faeed249c0d92d8e146290fefddd5cf8f4f643 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -494,10 +494,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
@@ -493,10 +493,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
// surfaces as they are not following the correct mode.
DisableGpuCompositing(compositor.get());
}
@ -32,10 +32,10 @@ index 511d805187b15325f72c574ad37fb43e4e5e2df6..5fb01fee0378ac807ee4fde6d4bea8d7
} else {
DCHECK(context_provider);
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index e0ec33400b179a600d95501fb93826075ffc52eb..29ba88a504c33d850c7a3425bd7d874ac3323fe1 100644
index a1b6716fc79f06216edf150a4e34f678a0da1518..89a1c426e9a48504082a3119f837e3d5f22d45a3 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -24,6 +24,7 @@
@@ -25,6 +25,7 @@
#include "components/viz/common/surfaces/frame_sink_id.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "components/viz/host/host_frame_sink_client.h"
@ -43,7 +43,7 @@ index e0ec33400b179a600d95501fb93826075ffc52eb..29ba88a504c33d850c7a3425bd7d874a
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkMatrix44.h"
#include "ui/compositor/compositor_animation_observer.h"
@@ -199,6 +200,15 @@ class COMPOSITOR_EXPORT ContextFactory {
@@ -200,6 +201,15 @@ class COMPOSITOR_EXPORT ContextFactory {
virtual bool SyncTokensRequiredForDisplayCompositor() = 0;
};
@ -59,7 +59,7 @@ index e0ec33400b179a600d95501fb93826075ffc52eb..29ba88a504c33d850c7a3425bd7d874a
// Compositor object to take care of GPU painting.
// A Browser compositor object is responsible for generating the final
// displayable form of pixels comprising a single widget's contents. It draws an
@@ -239,6 +249,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
@@ -240,6 +250,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
// Schedules a redraw of the layer tree associated with this compositor.
void ScheduleDraw();
@ -69,7 +69,7 @@ index e0ec33400b179a600d95501fb93826075ffc52eb..29ba88a504c33d850c7a3425bd7d874a
// Sets the root of the layer tree drawn by this Compositor. The root layer
// must have no parent. The compositor's root layer is reset if the root layer
// is destroyed. NULL can be passed to reset the root layer, in which case the
@@ -461,6 +474,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
@@ -463,6 +476,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
ui::ContextFactory* context_factory_;
ui::ContextFactoryPrivate* context_factory_private_;

View file

@ -8,10 +8,10 @@ run before shutdown. This is required to cleanup WebContents asynchronously
in atom::CommonWebContentsDelegate::ResetManageWebContents.
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index eb942391306e86e8ee8dc2584c63440b10ec76bd..9111cf18b7fc8fb67e7ee65e3cd76bd1e713aee8 100644
index 5cea69cfba0058041766ff25b32afbe6cfb6d59d..0d427b35f0f4762fc74f5aceac3923f98a2134f7 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -1571,7 +1571,7 @@ void BrowserMainLoop::MainMessageLoopRun() {
@@ -1582,7 +1582,7 @@ void BrowserMainLoop::MainMessageLoopRun() {
}
base::RunLoop run_loop;

View file

@ -1,86 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <nornagon@nornagon.net>
Date: Thu, 18 Oct 2018 17:06:46 -0700
Subject: crashpad_http_status.patch
backport of crashpad f540abb506
diff --git a/third_party/crashpad/crashpad/util/net/http_transport.h b/third_party/crashpad/crashpad/util/net/http_transport.h
index f91a55612a2ffc2f4a78ff48ceba6174adc58cbf..acd4e442462b031dd304f303cdaa3664f5cffb64 100644
--- a/third_party/crashpad/crashpad/util/net/http_transport.h
+++ b/third_party/crashpad/crashpad/util/net/http_transport.h
@@ -90,7 +90,7 @@ class HTTPTransport {
//! if the response body is not required.
//!
//! \return Whether or not the request was successful, defined as returning
- //! a HTTP status 200 (OK) code.
+ //! a HTTP status code in the range 200-203 (inclusive).
virtual bool ExecuteSynchronously(std::string* response_body) = 0;
protected:
diff --git a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm
index 8d5f78cc6efc8b8e349958f51c78921a8c163c4e..a433bb357da5865144ade7d3663b1c9b36199f8e 100644
--- a/third_party/crashpad/crashpad/util/net/http_transport_mac.mm
+++ b/third_party/crashpad/crashpad/util/net/http_transport_mac.mm
@@ -293,7 +293,7 @@ bool HTTPTransportMac::ExecuteSynchronously(std::string* response_body) {
return false;
}
NSInteger http_status = [http_response statusCode];
- if (http_status != 200) {
+ if (http_status < 200 || http_status > 203) {
LOG(ERROR) << base::StringPrintf("HTTP status %ld",
implicit_cast<long>(http_status));
return false;
diff --git a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc
index f0e2dc14a8a487b5960d700be57100c9bed4f271..34d8deeb5c25f6b49fd0acadce67a3816869d3da 100644
--- a/third_party/crashpad/crashpad/util/net/http_transport_socket.cc
+++ b/third_party/crashpad/crashpad/util/net/http_transport_socket.cc
@@ -457,10 +457,18 @@ bool ReadResponseLine(Stream* stream) {
LOG(ERROR) << "ReadLine";
return false;
}
- static constexpr const char kHttp10[] = "HTTP/1.0 200 ";
- static constexpr const char kHttp11[] = "HTTP/1.1 200 ";
- return StartsWith(response_line, kHttp10, strlen(kHttp10)) ||
- StartsWith(response_line, kHttp11, strlen(kHttp11));
+ static constexpr const char kHttp10[] = "HTTP/1.0 ";
+ static constexpr const char kHttp11[] = "HTTP/1.1 ";
+ if (!(StartsWith(response_line, kHttp10, strlen(kHttp10)) ||
+ StartsWith(response_line, kHttp11, strlen(kHttp11))) ||
+ response_line.size() < strlen(kHttp10) + 3 ||
+ response_line.at(strlen(kHttp10) + 3) != ' ') {
+ return false;
+ }
+ unsigned int http_status = 0;
+ return base::StringToUint(response_line.substr(strlen(kHttp10), 3),
+ &http_status) &&
+ http_status >= 200 && http_status <= 203;
}
bool ReadResponseHeaders(Stream* stream, HTTPHeaders* headers) {
diff --git a/third_party/crashpad/crashpad/util/net/http_transport_test.cc b/third_party/crashpad/crashpad/util/net/http_transport_test.cc
index 7b5f41dfd1e18b212d7dd349cff8f4396e20dbc3..d73dc99217e08f7c84ded50868cbef02141a6b9b 100644
--- a/third_party/crashpad/crashpad/util/net/http_transport_test.cc
+++ b/third_party/crashpad/crashpad/util/net/http_transport_test.cc
@@ -137,7 +137,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
std::string response_body;
bool success = transport->ExecuteSynchronously(&response_body);
- if (response_code_ == 200) {
+ if (response_code_ >= 200 && response_code_ <= 203) {
EXPECT_TRUE(success);
std::string expect_response_body = random_string + "\r\n";
EXPECT_EQ(response_body, expect_response_body);
diff --git a/third_party/crashpad/crashpad/util/net/http_transport_win.cc b/third_party/crashpad/crashpad/util/net/http_transport_win.cc
index 18d343ccef0396ee6679f4b5fd8316c3109003f4..2919bc11d0ba4bf84a11e146bf2961b830db35fe 100644
--- a/third_party/crashpad/crashpad/util/net/http_transport_win.cc
+++ b/third_party/crashpad/crashpad/util/net/http_transport_win.cc
@@ -375,7 +375,7 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) {
return false;
}
- if (status_code != 200) {
+ if (status_code < 200 || status_code > 203) {
LOG(ERROR) << base::StringPrintf("HTTP status %lu", status_code);
return false;
}

View file

@ -14,26 +14,32 @@ Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605435}
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.cc b/chrome/browser/ui/libgtkui/gtk_ui.cc
index 23542f2cd7a58bd4b4f51847a47740fc40560dad..77e42d5ed707670cae384b44fd1630c768c21775 100644
index 3e2f37380b1d23d2eaec82ca532843775b2f61d6..082162ce707bc575d7a0491471b430db041371da 100644
--- a/chrome/browser/ui/libgtkui/gtk_ui.cc
+++ b/chrome/browser/ui/libgtkui/gtk_ui.cc
@@ -274,9 +274,6 @@ typedef std::unique_ptr<GIcon, GObjectDeleter> ScopedGIcon;
@@ -234,11 +234,6 @@ typedef std::unique_ptr<GIcon, GObjectDeleter> ScopedGIcon;
typedef std::unique_ptr<GtkIconInfo, GtkIconInfoDeleter> ScopedGtkIconInfo;
typedef std::unique_ptr<GdkPixbuf, GObjectDeleter> ScopedGdkPixbuf;
-#if !GTK_CHECK_VERSION(3, 90, 0)
-// Prefix for app indicator ids
-const char kAppIndicatorIdPrefix[] = "chrome_app_indicator_";
-#endif
-
// Number of app indicators used (used as part of app-indicator id).
int indicators_count;
@@ -645,12 +642,13 @@ bool GtkUi::IsStatusIconSupported() const {
@@ -600,7 +595,8 @@ bool GtkUi::IsStatusIconSupported() const {
std::unique_ptr<views::StatusIconLinux> GtkUi::CreateLinuxStatusIcon(
const gfx::ImageSkia& image,
- const base::string16& tool_tip) const {
+ const base::string16& tool_tip,
+ const char* id_prefix) const {
#if GTK_CHECK_VERSION(3, 90, 0)
NOTIMPLEMENTED();
return nullptr;
@@ -608,8 +604,8 @@ std::unique_ptr<views::StatusIconLinux> GtkUi::CreateLinuxStatusIcon(
if (AppIndicatorIcon::CouldOpen()) {
++indicators_count;
return std::unique_ptr<views::StatusIconLinux>(new AppIndicatorIcon(
@ -43,9 +49,9 @@ index 23542f2cd7a58bd4b4f51847a47740fc40560dad..77e42d5ed707670cae384b44fd1630c7
+ tool_tip));
} else {
return std::unique_ptr<views::StatusIconLinux>(
new Gtk2StatusIcon(image, tool_tip));
new GtkStatusIcon(image, tool_tip));
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.h b/chrome/browser/ui/libgtkui/gtk_ui.h
index 8f3539e3aa339fc69fa1db68a32f9f04d4bedc3a..99760afb4a1ed2e6519a1be4dbcbde45f0e458b7 100644
index 6f4899402ec5d7b8107c9dc2c43bd040492fd8dd..c52874dd745463d3a1b1e798992ac17e64937ea2 100644
--- a/chrome/browser/ui/libgtkui/gtk_ui.h
+++ b/chrome/browser/ui/libgtkui/gtk_ui.h
@@ -92,7 +92,8 @@ class GtkUi : public views::LinuxUI {
@ -87,10 +93,10 @@ index eed6bb2eaf756189be016c382673e23eb7ca18e0..4694a9a920b1f9150399e183038f04ac
return base::WrapUnique(
new StatusIconLinuxWrapper(std::move(status_icon)));
diff --git a/ui/views/linux_ui/linux_ui.h b/ui/views/linux_ui/linux_ui.h
index c1f14d5c65aa5c1c58633c59431c1e7c5c720a0b..7c27b61e93f83b7f277461df94fb3c939e7702d3 100644
index 86a3c0a78cb748f679e2313db569ac0029c8da0f..bd01febaf6e0b3712e86183f7a56122d7f1ee666 100644
--- a/ui/views/linux_ui/linux_ui.h
+++ b/ui/views/linux_ui/linux_ui.h
@@ -137,10 +137,12 @@ class VIEWS_EXPORT LinuxUI : public ui::LinuxInputMethodContextFactory,
@@ -132,10 +132,12 @@ class VIEWS_EXPORT LinuxUI : public ui::LinuxInputMethodContextFactory,
// Checks for platform support for status icons.
virtual bool IsStatusIconSupported() const = 0;

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