build: fix broken Views build (#22621)

This commit is contained in:
Shelley Vohr 2020-03-10 20:03:41 +00:00 committed by GitHub
parent b607cfa220
commit 97fe4c7718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 16 deletions

View file

@ -9,9 +9,10 @@
#include "shell/browser/api/electron_api_view.h" #include "shell/browser/api/electron_api_view.h"
#include "shell/common/gin_helper/constructor.h" #include "shell/common/gin_helper/constructor.h"
#include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h" #include "shell/common/node_includes.h"
namespace mate { namespace gin {
template <> template <>
struct Converter<views::BoxLayout::Orientation> { struct Converter<views::BoxLayout::Orientation> {
@ -31,7 +32,7 @@ struct Converter<views::BoxLayout::Orientation> {
} }
}; };
} // namespace mate } // namespace gin
namespace electron { namespace electron {
@ -52,14 +53,14 @@ gin_helper::WrappableBase* BoxLayout::New(
gin_helper::Arguments* args, gin_helper::Arguments* args,
views::BoxLayout::Orientation orientation) { views::BoxLayout::Orientation orientation) {
auto* layout = new BoxLayout(orientation); auto* layout = new BoxLayout(orientation);
layout->InitWith(args->isolate(), args->GetThis()); layout->InitWithArgs(args);
return layout; return layout;
} }
// static // static
void BoxLayout::BuildPrototype(v8::Isolate* isolate, void BoxLayout::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) { v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "BoxLayout")); prototype->SetClassName(gin::StringToV8(isolate, "BoxLayout"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("setFlexForView", &BoxLayout::SetFlexForView); .SetMethod("setFlexForView", &BoxLayout::SetFlexForView);
} }

View file

@ -33,7 +33,7 @@ gin_helper::WrappableBase* Button::New(gin_helper::Arguments* args) {
// static // static
void Button::BuildPrototype(v8::Isolate* isolate, void Button::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) { v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "Button")); prototype->SetClassName(gin::StringToV8(isolate, "Button"));
} }
} // namespace api } // namespace api

View file

@ -7,6 +7,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "shell/common/gin_helper/constructor.h" #include "shell/common/gin_helper/constructor.h"
#include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h" #include "shell/common/node_includes.h"
namespace electron { namespace electron {
@ -29,7 +30,7 @@ void LabelButton::SetText(const base::string16& text) {
} }
bool LabelButton::IsDefault() const { bool LabelButton::IsDefault() const {
return label_button()->is_default(); return label_button()->GetIsDefault();
} }
void LabelButton::SetIsDefault(bool is_default) { void LabelButton::SetIsDefault(bool is_default) {
@ -41,14 +42,14 @@ gin_helper::WrappableBase* LabelButton::New(gin_helper::Arguments* args,
const std::string& text) { const std::string& text) {
// Constructor call. // Constructor call.
auto* view = new LabelButton(text); auto* view = new LabelButton(text);
view->InitWith(args->isolate(), args->GetThis()); view->InitWithArgs(args);
return view; return view;
} }
// static // static
void LabelButton::BuildPrototype(v8::Isolate* isolate, void LabelButton::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) { v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "LabelButton")); prototype->SetClassName(gin::StringToV8(isolate, "LabelButton"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("getText", &LabelButton::GetText) .SetMethod("getText", &LabelButton::GetText)
.SetMethod("setText", &LabelButton::SetText) .SetMethod("setText", &LabelButton::SetText)

View file

@ -14,7 +14,8 @@ namespace electron {
namespace api { namespace api {
MdTextButton::MdTextButton(const std::string& text) MdTextButton::MdTextButton(const std::string& text)
: LabelButton(views::MdTextButton::Create(this, base::UTF8ToUTF16(text))) {} : LabelButton(
views::MdTextButton::Create(this, base::UTF8ToUTF16(text)).get()) {}
MdTextButton::~MdTextButton() {} MdTextButton::~MdTextButton() {}
@ -23,14 +24,14 @@ gin_helper::WrappableBase* MdTextButton::New(gin_helper::Arguments* args,
const std::string& text) { const std::string& text) {
// Constructor call. // Constructor call.
auto* view = new MdTextButton(text); auto* view = new MdTextButton(text);
view->InitWith(args->isolate(), args->GetThis()); view->InitWithArgs(args);
return view; return view;
} }
// static // static
void MdTextButton::BuildPrototype(v8::Isolate* isolate, void MdTextButton::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) { v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "MdTextButton")); prototype->SetClassName(gin::StringToV8(isolate, "MdTextButton"));
} }
} // namespace api } // namespace api

View file

@ -26,14 +26,14 @@ void ResizeArea::OnResize(int resize_amount, bool done_resizing) {
gin_helper::WrappableBase* ResizeArea::New(gin_helper::Arguments* args) { gin_helper::WrappableBase* ResizeArea::New(gin_helper::Arguments* args) {
// Constructor call. // Constructor call.
auto* view = new ResizeArea(); auto* view = new ResizeArea();
view->InitWith(args->isolate(), args->GetThis()); view->InitWithArgs(args);
return view; return view;
} }
// static // static
void ResizeArea::BuildPrototype(v8::Isolate* isolate, void ResizeArea::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) { v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "ResizeArea")); prototype->SetClassName(gin::StringToV8(isolate, "ResizeArea"));
} }
} // namespace api } // namespace api

View file

@ -6,6 +6,7 @@
#include "shell/common/gin_helper/constructor.h" #include "shell/common/gin_helper/constructor.h"
#include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h" #include "shell/common/node_includes.h"
namespace electron { namespace electron {
@ -23,21 +24,21 @@ void TextField::SetText(const base::string16& new_text) {
} }
base::string16 TextField::GetText() const { base::string16 TextField::GetText() const {
return text_field()->text(); return text_field()->GetText();
} }
// static // static
gin_helper::WrappableBase* TextField::New(gin_helper::Arguments* args) { gin_helper::WrappableBase* TextField::New(gin_helper::Arguments* args) {
// Constructor call. // Constructor call.
auto* view = new TextField(); auto* view = new TextField();
view->InitWith(args->isolate(), args->GetThis()); view->InitWithArgs(args);
return view; return view;
} }
// static // static
void TextField::BuildPrototype(v8::Isolate* isolate, void TextField::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) { v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "TextField")); prototype->SetClassName(gin::StringToV8(isolate, "TextField"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("setText", &TextField::SetText) .SetMethod("setText", &TextField::SetText)
.SetMethod("getText", &TextField::GetText); .SetMethod("getText", &TextField::GetText);