Put View APIs under a build flag
This commit is contained in:
parent
2c8dc9e0bd
commit
0f7c25fc63
6 changed files with 35 additions and 8 deletions
|
@ -23,6 +23,7 @@ View::~View() {
|
|||
delete view_;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_VIEW_API)
|
||||
void View::SetLayoutManager(mate::Handle<LayoutManager> layout_manager) {
|
||||
layout_manager_.Reset(isolate(), layout_manager->GetWrapper());
|
||||
// TODO(zcbenz): New versions of Chrome takes std::unique_ptr instead of raw
|
||||
|
@ -41,6 +42,7 @@ void View::AddChildViewAt(mate::Handle<View> child, size_t index) {
|
|||
isolate(), child->GetWrapper()); // v8::Global(args...)
|
||||
view()->AddChildViewAt(child->view(), index);
|
||||
}
|
||||
#endif
|
||||
|
||||
// static
|
||||
mate::WrappableBase* View::New(mate::Arguments* args) {
|
||||
|
@ -53,10 +55,12 @@ mate::WrappableBase* View::New(mate::Arguments* args) {
|
|||
void View::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "View"));
|
||||
#if defined(ENABLE_VIEW_API)
|
||||
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
.SetMethod("setLayoutManager", &View::SetLayoutManager)
|
||||
.SetMethod("addChildView", &View::AddChildView)
|
||||
.SetMethod("addChildViewAt", &View::AddChildViewAt);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
|
|
@ -23,9 +23,11 @@ class View : public mate::TrackableObject<View> {
|
|||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
||||
#if defined(ENABLE_VIEW_API)
|
||||
void SetLayoutManager(mate::Handle<LayoutManager> layout_manager);
|
||||
void AddChildView(mate::Handle<View> view);
|
||||
void AddChildViewAt(mate::Handle<View> view, size_t index);
|
||||
#endif
|
||||
|
||||
views::View* view() const { return view_; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue