From 7edd37bca153c824e56142d7dd0792820de49155 Mon Sep 17 00:00:00 2001 From: Alexey Kuzmin Date: Tue, 28 Aug 2018 19:55:31 +0200 Subject: [PATCH] build: add missing enable_view_api flag (#14351) * build: add missing enable_view_api flag Fixes #14340. * fix: properly pass a pointer to a SetLayoutManager() call --- BUILD.gn | 29 +++++++++++++++++++++++++++++ atom/browser/api/atom_api_view.cc | 4 +--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 0d364cef47e..e945ec6da6c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -38,6 +38,8 @@ declare_args() { # need to test with chromium's location provider. # Should not be enabled for release build. enable_fake_location_provider = !is_official_build + + enable_view_api = false } if (is_mas_build) { @@ -72,6 +74,9 @@ config("features") { if (enable_osr) { defines += [ "ENABLE_OSR=1" ] } + if (enable_view_api) { + defines += [ "ENABLE_VIEW_API" ] + } } npm_action("atom_browserify_sandbox") { @@ -175,6 +180,15 @@ asar("js2asar") { "lib/renderer/api/desktop-capturer.js", ] } + if (enable_view_api) { + sources += [ + "lib/browser/api/box-layout.js", + "lib/browser/api/button.js", + "lib/browser/api/label-button.js", + "lib/browser/api/layout-manager.js", + "lib/browser/api/text-field.js", + ] + } outputs = [ "$root_out_dir/resources/electron.asar", ] @@ -397,6 +411,21 @@ static_library("electron_lib") { "atom/browser/api/atom_api_desktop_capturer.h", ] } + + if (enable_view_api) { + sources += [ + "atom/browser/api/atom_api_box_layout.cc", + "atom/browser/api/atom_api_box_layout.h", + "atom/browser/api/atom_api_button.cc", + "atom/browser/api/atom_api_button.h", + "atom/browser/api/atom_api_label_button.cc", + "atom/browser/api/atom_api_label_button.h", + "atom/browser/api/atom_api_layout_manager.cc", + "atom/browser/api/atom_api_layout_manager.h", + "atom/browser/api/atom_api_text_field.cc", + "atom/browser/api/atom_api_text_field.h", + ] + } } electron_paks("packed_resources") { diff --git a/atom/browser/api/atom_api_view.cc b/atom/browser/api/atom_api_view.cc index 9094fd5476b..888b2aa7682 100644 --- a/atom/browser/api/atom_api_view.cc +++ b/atom/browser/api/atom_api_view.cc @@ -26,9 +26,7 @@ View::~View() { #if defined(ENABLE_VIEW_API) void View::SetLayoutManager(mate::Handle layout_manager) { layout_manager_.Reset(isolate(), layout_manager->GetWrapper()); - // TODO(zcbenz): New versions of Chrome takes std::unique_ptr instead of raw - // pointer, remove the "release()" call when we upgraded to it. - view()->SetLayoutManager(layout_manager->TakeOver().release()); + view()->SetLayoutManager(layout_manager->TakeOver()); } void View::AddChildView(mate::Handle child) {