Skip to content

Commit 97fe4c7

Browse files
authored
build: fix broken Views build (electron#22621)
1 parent b607cfa commit 97fe4c7

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

shell/browser/api/views/electron_api_box_layout.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
#include "shell/browser/api/electron_api_view.h"
1010
#include "shell/common/gin_helper/constructor.h"
1111
#include "shell/common/gin_helper/dictionary.h"
12+
#include "shell/common/gin_helper/object_template_builder.h"
1213
#include "shell/common/node_includes.h"
1314

14-
namespace mate {
15+
namespace gin {
1516

1617
template <>
1718
struct Converter<views::BoxLayout::Orientation> {
@@ -31,7 +32,7 @@ struct Converter<views::BoxLayout::Orientation> {
3132
}
3233
};
3334

34-
} // namespace mate
35+
} // namespace gin
3536

3637
namespace electron {
3738

@@ -52,14 +53,14 @@ gin_helper::WrappableBase* BoxLayout::New(
5253
gin_helper::Arguments* args,
5354
views::BoxLayout::Orientation orientation) {
5455
auto* layout = new BoxLayout(orientation);
55-
layout->InitWith(args->isolate(), args->GetThis());
56+
layout->InitWithArgs(args);
5657
return layout;
5758
}
5859

5960
// static
6061
void BoxLayout::BuildPrototype(v8::Isolate* isolate,
6162
v8::Local<v8::FunctionTemplate> prototype) {
62-
prototype->SetClassName(gin_helper::StringTov8(isolate, "BoxLayout"));
63+
prototype->SetClassName(gin::StringToV8(isolate, "BoxLayout"));
6364
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
6465
.SetMethod("setFlexForView", &BoxLayout::SetFlexForView);
6566
}

shell/browser/api/views/electron_api_button.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ gin_helper::WrappableBase* Button::New(gin_helper::Arguments* args) {
3333
// static
3434
void Button::BuildPrototype(v8::Isolate* isolate,
3535
v8::Local<v8::FunctionTemplate> prototype) {
36-
prototype->SetClassName(gin_helper::StringTov8(isolate, "Button"));
36+
prototype->SetClassName(gin::StringToV8(isolate, "Button"));
3737
}
3838

3939
} // namespace api

shell/browser/api/views/electron_api_label_button.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "base/strings/utf_string_conversions.h"
88
#include "shell/common/gin_helper/constructor.h"
99
#include "shell/common/gin_helper/dictionary.h"
10+
#include "shell/common/gin_helper/object_template_builder.h"
1011
#include "shell/common/node_includes.h"
1112

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

3132
bool LabelButton::IsDefault() const {
32-
return label_button()->is_default();
33+
return label_button()->GetIsDefault();
3334
}
3435

3536
void LabelButton::SetIsDefault(bool is_default) {
@@ -41,14 +42,14 @@ gin_helper::WrappableBase* LabelButton::New(gin_helper::Arguments* args,
4142
const std::string& text) {
4243
// Constructor call.
4344
auto* view = new LabelButton(text);
44-
view->InitWith(args->isolate(), args->GetThis());
45+
view->InitWithArgs(args);
4546
return view;
4647
}
4748

4849
// static
4950
void LabelButton::BuildPrototype(v8::Isolate* isolate,
5051
v8::Local<v8::FunctionTemplate> prototype) {
51-
prototype->SetClassName(gin_helper::StringTov8(isolate, "LabelButton"));
52+
prototype->SetClassName(gin::StringToV8(isolate, "LabelButton"));
5253
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
5354
.SetMethod("getText", &LabelButton::GetText)
5455
.SetMethod("setText", &LabelButton::SetText)

shell/browser/api/views/electron_api_md_text_button.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace electron {
1414
namespace api {
1515

1616
MdTextButton::MdTextButton(const std::string& text)
17-
: LabelButton(views::MdTextButton::Create(this, base::UTF8ToUTF16(text))) {}
17+
: LabelButton(
18+
views::MdTextButton::Create(this, base::UTF8ToUTF16(text)).get()) {}
1819

1920
MdTextButton::~MdTextButton() {}
2021

@@ -23,14 +24,14 @@ gin_helper::WrappableBase* MdTextButton::New(gin_helper::Arguments* args,
2324
const std::string& text) {
2425
// Constructor call.
2526
auto* view = new MdTextButton(text);
26-
view->InitWith(args->isolate(), args->GetThis());
27+
view->InitWithArgs(args);
2728
return view;
2829
}
2930

3031
// static
3132
void MdTextButton::BuildPrototype(v8::Isolate* isolate,
3233
v8::Local<v8::FunctionTemplate> prototype) {
33-
prototype->SetClassName(gin_helper::StringTov8(isolate, "MdTextButton"));
34+
prototype->SetClassName(gin::StringToV8(isolate, "MdTextButton"));
3435
}
3536

3637
} // namespace api

shell/browser/api/views/electron_api_resize_area.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ void ResizeArea::OnResize(int resize_amount, bool done_resizing) {
2626
gin_helper::WrappableBase* ResizeArea::New(gin_helper::Arguments* args) {
2727
// Constructor call.
2828
auto* view = new ResizeArea();
29-
view->InitWith(args->isolate(), args->GetThis());
29+
view->InitWithArgs(args);
3030
return view;
3131
}
3232

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

3939
} // namespace api

shell/browser/api/views/electron_api_text_field.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "shell/common/gin_helper/constructor.h"
88
#include "shell/common/gin_helper/dictionary.h"
9+
#include "shell/common/gin_helper/object_template_builder.h"
910
#include "shell/common/node_includes.h"
1011

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

2526
base::string16 TextField::GetText() const {
26-
return text_field()->text();
27+
return text_field()->GetText();
2728
}
2829

2930
// static
3031
gin_helper::WrappableBase* TextField::New(gin_helper::Arguments* args) {
3132
// Constructor call.
3233
auto* view = new TextField();
33-
view->InitWith(args->isolate(), args->GetThis());
34+
view->InitWithArgs(args);
3435
return view;
3536
}
3637

3738
// static
3839
void TextField::BuildPrototype(v8::Isolate* isolate,
3940
v8::Local<v8::FunctionTemplate> prototype) {
40-
prototype->SetClassName(gin_helper::StringTov8(isolate, "TextField"));
41+
prototype->SetClassName(gin::StringToV8(isolate, "TextField"));
4142
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
4243
.SetMethod("setText", &TextField::SetText)
4344
.SetMethod("getText", &TextField::GetText);

0 commit comments

Comments
 (0)