chore: remove unused classes of views API (#22861)

* chore: remove unused views API classes

* chore: remove LayoutManager code

* chore: no more need to make View inherit from TrackabeObject

* chore: make enable_view_api default to true

* chore: enable_view_api => enable_views_api
This commit is contained in:
Cheng Zhao 2020-03-28 15:44:57 +09:00 committed by GitHub
parent d5cae424d8
commit 76ae3b7ecb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 16 additions and 948 deletions

View file

@ -10,22 +10,21 @@
#include "electron/buildflags/buildflags.h"
#include "gin/handle.h"
#include "shell/browser/api/views/electron_api_layout_manager.h"
#include "shell/common/gin_helper/wrappable.h"
#include "ui/views/view.h"
namespace electron {
namespace api {
class View : public gin_helper::TrackableObject<View> {
class View : public gin_helper::Wrappable<View> {
public:
static gin_helper::WrappableBase* New(gin::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
#if BUILDFLAG(ENABLE_VIEW_API)
void SetLayoutManager(gin::Handle<LayoutManager> layout_manager);
#if BUILDFLAG(ENABLE_VIEWS_API)
void AddChildView(gin::Handle<View> view);
void AddChildViewAt(gin::Handle<View> view, size_t index);
#endif
@ -41,7 +40,6 @@ class View : public gin_helper::TrackableObject<View> {
void set_delete_view(bool should) { delete_view_ = should; }
private:
v8::Global<v8::Object> layout_manager_;
std::vector<v8::Global<v8::Object>> child_views_;
bool delete_view_ = true;
@ -54,21 +52,4 @@ class View : public gin_helper::TrackableObject<View> {
} // namespace electron
namespace gin {
template <>
struct Converter<views::View*> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
views::View** out) {
electron::api::View* view;
if (!Converter<electron::api::View*>::FromV8(isolate, val, &view))
return false;
*out = view->view();
return true;
}
};
} // namespace gin
#endif // SHELL_BROWSER_API_ELECTRON_API_VIEW_H_