diff --git a/BUILD.gn b/BUILD.gn index 0d364cef47ef..e945ec6da6c6 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 9094fd5476bb..888b2aa76825 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) {