-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
will-frame-navigate
event (#34418)
- Loading branch information
Milan Burda
committed
Apr 12, 2023
1 parent
5161e96
commit 1219649
Showing
17 changed files
with
683 additions
and
35 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2023 Salesforce, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "shell/common/gin_helper/event_new.h" | ||
#include "gin/dictionary.h" | ||
#include "gin/object_template_builder.h" | ||
|
||
namespace gin_helper::internal { | ||
|
||
// static | ||
gin::Handle<Event> Event::New(v8::Isolate* isolate) { | ||
return gin::CreateHandle(isolate, new Event()); | ||
} | ||
// static | ||
v8::Local<v8::ObjectTemplate> Event::FillObjectTemplate( | ||
v8::Isolate* isolate, | ||
v8::Local<v8::ObjectTemplate> templ) { | ||
return gin::ObjectTemplateBuilder(isolate, "Event", templ) | ||
.SetMethod("preventDefault", &Event::PreventDefault) | ||
.SetProperty("defaultPrevented", &Event::GetDefaultPrevented) | ||
.Build(); | ||
} | ||
|
||
Event::Event() = default; | ||
|
||
Event::~Event() = default; | ||
|
||
gin::WrapperInfo Event::kWrapperInfo = {gin::kEmbedderNativeGin}; | ||
|
||
} // namespace gin_helper::internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) 2023 Salesforce, Inc. | ||
// Use of this source code is governed by the MIT license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_NEW_H_ | ||
#define ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_NEW_H_ | ||
|
||
#include "gin/handle.h" | ||
#include "gin/wrappable.h" | ||
#include "shell/common/gin_helper/constructible.h" | ||
|
||
namespace v8 { | ||
class Isolate; | ||
template <typename T> | ||
class Local; | ||
class Object; | ||
class ObjectTemplate; | ||
} // namespace v8 | ||
|
||
namespace gin_helper::internal { | ||
|
||
class Event : public gin::Wrappable<Event>, | ||
public gin_helper::Constructible<Event> { | ||
public: | ||
// gin_helper::Constructible | ||
static gin::Handle<Event> New(v8::Isolate* isolate); | ||
static v8::Local<v8::ObjectTemplate> FillObjectTemplate( | ||
v8::Isolate* isolate, | ||
v8::Local<v8::ObjectTemplate> prototype); | ||
|
||
// gin::Wrappable | ||
static gin::WrapperInfo kWrapperInfo; | ||
|
||
~Event() override; | ||
|
||
void PreventDefault() { default_prevented_ = true; } | ||
|
||
bool GetDefaultPrevented() { return default_prevented_; } | ||
|
||
private: | ||
Event(); | ||
|
||
bool default_prevented_ = false; | ||
}; | ||
|
||
} // namespace gin_helper::internal | ||
|
||
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_NEW_H_ |
Oops, something went wrong.