Skip to content

Commit

Permalink
build: fix broken Views build (#22642)
Browse files Browse the repository at this point in the history
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
trop[bot] and codebytere committed Mar 11, 2020
1 parent 7ee7890 commit a76ea62
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
9 changes: 5 additions & 4 deletions shell/browser/api/views/electron_api_box_layout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
#include "shell/browser/api/electron_api_view.h"
#include "shell/common/gin_helper/constructor.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"

namespace mate {
namespace gin {

template <>
struct Converter<views::BoxLayout::Orientation> {
Expand All @@ -31,7 +32,7 @@ struct Converter<views::BoxLayout::Orientation> {
}
};

} // namespace mate
} // namespace gin

namespace electron {

Expand All @@ -52,14 +53,14 @@ gin_helper::WrappableBase* BoxLayout::New(
gin_helper::Arguments* args,
views::BoxLayout::Orientation orientation) {
auto* layout = new BoxLayout(orientation);
layout->InitWith(args->isolate(), args->GetThis());
layout->InitWithArgs(args);
return layout;
}

// static
void BoxLayout::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "BoxLayout"));
prototype->SetClassName(gin::StringToV8(isolate, "BoxLayout"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("setFlexForView", &BoxLayout::SetFlexForView);
}
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/api/views/electron_api_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ gin_helper::WrappableBase* Button::New(gin_helper::Arguments* args) {
// static
void Button::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "Button"));
prototype->SetClassName(gin::StringToV8(isolate, "Button"));
}

} // namespace api
Expand Down
7 changes: 4 additions & 3 deletions shell/browser/api/views/electron_api_label_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/strings/utf_string_conversions.h"
#include "shell/common/gin_helper/constructor.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"

namespace electron {
Expand All @@ -29,7 +30,7 @@ void LabelButton::SetText(const base::string16& text) {
}

bool LabelButton::IsDefault() const {
return label_button()->is_default();
return label_button()->GetIsDefault();
}

void LabelButton::SetIsDefault(bool is_default) {
Expand All @@ -41,14 +42,14 @@ gin_helper::WrappableBase* LabelButton::New(gin_helper::Arguments* args,
const std::string& text) {
// Constructor call.
auto* view = new LabelButton(text);
view->InitWith(args->isolate(), args->GetThis());
view->InitWithArgs(args);
return view;
}

// static
void LabelButton::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "LabelButton"));
prototype->SetClassName(gin::StringToV8(isolate, "LabelButton"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("getText", &LabelButton::GetText)
.SetMethod("setText", &LabelButton::SetText)
Expand Down
7 changes: 4 additions & 3 deletions shell/browser/api/views/electron_api_md_text_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace electron {
namespace api {

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() {}

Expand All @@ -23,14 +24,14 @@ gin_helper::WrappableBase* MdTextButton::New(gin_helper::Arguments* args,
const std::string& text) {
// Constructor call.
auto* view = new MdTextButton(text);
view->InitWith(args->isolate(), args->GetThis());
view->InitWithArgs(args);
return view;
}

// static
void MdTextButton::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "MdTextButton"));
prototype->SetClassName(gin::StringToV8(isolate, "MdTextButton"));
}

} // namespace api
Expand Down
4 changes: 2 additions & 2 deletions shell/browser/api/views/electron_api_resize_area.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ void ResizeArea::OnResize(int resize_amount, bool done_resizing) {
gin_helper::WrappableBase* ResizeArea::New(gin_helper::Arguments* args) {
// Constructor call.
auto* view = new ResizeArea();
view->InitWith(args->isolate(), args->GetThis());
view->InitWithArgs(args);
return view;
}

// static
void ResizeArea::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "ResizeArea"));
prototype->SetClassName(gin::StringToV8(isolate, "ResizeArea"));
}

} // namespace api
Expand Down
7 changes: 4 additions & 3 deletions shell/browser/api/views/electron_api_text_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "shell/common/gin_helper/constructor.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"

namespace electron {
Expand All @@ -23,21 +24,21 @@ void TextField::SetText(const base::string16& new_text) {
}

base::string16 TextField::GetText() const {
return text_field()->text();
return text_field()->GetText();
}

// static
gin_helper::WrappableBase* TextField::New(gin_helper::Arguments* args) {
// Constructor call.
auto* view = new TextField();
view->InitWith(args->isolate(), args->GetThis());
view->InitWithArgs(args);
return view;
}

// static
void TextField::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin_helper::StringTov8(isolate, "TextField"));
prototype->SetClassName(gin::StringToV8(isolate, "TextField"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("setText", &TextField::SetText)
.SetMethod("getText", &TextField::GetText);
Expand Down

0 comments on commit a76ea62

Please sign in to comment.