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.
This commit is contained in:
Charles Kerr 2023-06-03 10:40:44 -05:00 committed by GitHub
parent f247ca3f62
commit 05db963f87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 29 deletions

View file

@ -21,20 +21,6 @@ View::~View() {
delete view_;
}
#if BUILDFLAG(ENABLE_VIEWS_API)
void View::AddChildView(gin::Handle<View> child) {
AddChildViewAt(child, child_views_.size());
}
void View::AddChildViewAt(gin::Handle<View> 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<v8::FunctionTemplate> 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

View file

@ -5,10 +5,7 @@
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_
#include <vector>
#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<View> {
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
#if BUILDFLAG(ENABLE_VIEWS_API)
void AddChildView(gin::Handle<View> child);
void AddChildViewAt(gin::Handle<View> child, size_t index);
#endif
views::View* view() const { return view_; }
// disable copy
@ -42,8 +34,6 @@ class View : public gin_helper::Wrappable<View> {
void set_delete_view(bool should) { delete_view_ = should; }
private:
std::vector<v8::Global<v8::Object>> child_views_;
bool delete_view_ = true;
raw_ptr<views::View> view_ = nullptr;
};