diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 4bd1e9b6d6e8..b79338548063 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -733,6 +733,14 @@ void WebContents::ReplaceMisspelling(const base::string16& word) { web_contents()->ReplaceMisspelling(word); } +void WebContents::Focus() { + web_contents()->Focus(); +} + +void WebContents::TabTraverse(bool reverse) { + web_contents()->FocusThroughTabTraversal(reverse); +} + bool WebContents::SendIPCMessage(const base::string16& channel, const base::ListValue& args) { return Send(new AtomViewMsg_Message(routing_id(), channel, args)); @@ -792,6 +800,8 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( .SetMethod("unselect", &WebContents::Unselect) .SetMethod("replace", &WebContents::Replace) .SetMethod("replaceMisspelling", &WebContents::ReplaceMisspelling) + .SetMethod("focus", &WebContents::Focus) + .SetMethod("tabTraverse", &WebContents::TabTraverse) .SetMethod("_send", &WebContents::SendIPCMessage, true) .SetMethod("setSize", &WebContents::SetSize) .SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index e3dc363972d4..1dcf5f4f6d29 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -96,6 +96,10 @@ class WebContents : public mate::TrackableObject, void Replace(const base::string16& word); void ReplaceMisspelling(const base::string16& word); + // Focus. + void Focus(); + void TabTraverse(bool reverse); + // Sending messages to browser. bool SendIPCMessage(const base::string16& channel, const base::ListValue& args);