Skip to content

Commit bad0e04

Browse files
committed
SendEvent with multiple arguments
1 parent 8c2cf39 commit bad0e04

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/nw_shell.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,20 @@ Shell::~Shell() {
207207
}
208208

209209
void Shell::SendEvent(const std::string& event, const std::string& arg1) {
210+
base::ListValue args;
211+
if (!arg1.empty())
212+
args.AppendString(arg1);
213+
SendEvent(event, args);
214+
}
215+
216+
void Shell::SendEvent(const std::string& event, const base::ListValue& args) {
210217

211218
if (id() < 0)
212219
return;
213220

214221
DVLOG(1) << "Shell::SendEvent " << event << " id():"
215222
<< id() << " RoutingID: " << web_contents()->GetRoutingID();
216223

217-
base::ListValue args;
218-
if (!arg1.empty())
219-
args.AppendString(arg1);
220-
221224
WebContents* web_contents;
222225
if (is_devtools_ && devtools_owner_.get())
223226
web_contents = devtools_owner_->web_contents();

src/nw_shell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class Shell : public WebContentsDelegate,
102102
bool devToolsOpen() { return devtools_window_.get() != NULL; }
103103
// Send an event to renderer.
104104
void SendEvent(const std::string& event, const std::string& arg1 = "");
105+
void SendEvent(const std::string& event, const base::ListValue& args);
105106

106107
// Decide whether we should close the window.
107108
bool ShouldCloseWindow();

0 commit comments

Comments
 (0)