Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix broken Views build #22642

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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