From 05db963f874051475e91179d68d98680232cd5ea Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 3 Jun 2023 10:40:44 -0500 Subject: [PATCH] chore: remove unused electron::api::View code (#38561) chore: remove unused electron::api::View methods Remove code that was added in 2c8dc9e but never used. --- shell/browser/api/electron_api_view.cc | 19 ------------------- shell/browser/api/electron_api_view.h | 10 ---------- 2 files changed, 29 deletions(-) diff --git a/shell/browser/api/electron_api_view.cc b/shell/browser/api/electron_api_view.cc index 89ca29c08e..54d8047da0 100644 --- a/shell/browser/api/electron_api_view.cc +++ b/shell/browser/api/electron_api_view.cc @@ -21,20 +21,6 @@ View::~View() { delete view_; } -#if BUILDFLAG(ENABLE_VIEWS_API) -void View::AddChildView(gin::Handle child) { - AddChildViewAt(child, child_views_.size()); -} - -void View::AddChildViewAt(gin::Handle child, size_t index) { - if (index > child_views_.size()) - return; - child_views_.emplace(child_views_.begin() + index, // index - isolate(), child->GetWrapper()); // v8::Global(args...) - view()->AddChildViewAt(child->view(), index); -} -#endif - // static gin_helper::WrappableBase* View::New(gin::Arguments* args) { auto* view = new View(); @@ -46,11 +32,6 @@ gin_helper::WrappableBase* View::New(gin::Arguments* args) { void View::BuildPrototype(v8::Isolate* isolate, v8::Local prototype) { prototype->SetClassName(gin::StringToV8(isolate, "View")); -#if BUILDFLAG(ENABLE_VIEWS_API) - gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) - .SetMethod("addChildView", &View::AddChildView) - .SetMethod("addChildViewAt", &View::AddChildViewAt); -#endif } } // namespace electron::api diff --git a/shell/browser/api/electron_api_view.h b/shell/browser/api/electron_api_view.h index 2a905cb263..758a33a5a8 100644 --- a/shell/browser/api/electron_api_view.h +++ b/shell/browser/api/electron_api_view.h @@ -5,10 +5,7 @@ #ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_ #define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_ -#include - #include "base/memory/raw_ptr.h" -#include "electron/buildflags/buildflags.h" #include "gin/handle.h" #include "shell/common/gin_helper/wrappable.h" #include "ui/views/view.h" @@ -22,11 +19,6 @@ class View : public gin_helper::Wrappable { static void BuildPrototype(v8::Isolate* isolate, v8::Local prototype); -#if BUILDFLAG(ENABLE_VIEWS_API) - void AddChildView(gin::Handle child); - void AddChildViewAt(gin::Handle child, size_t index); -#endif - views::View* view() const { return view_; } // disable copy @@ -42,8 +34,6 @@ class View : public gin_helper::Wrappable { void set_delete_view(bool should) { delete_view_ = should; } private: - std::vector> child_views_; - bool delete_view_ = true; raw_ptr view_ = nullptr; };