return web_contents()->IsCrashed();
}
+void WebContents::SetUserAgent(const std::string& user_agent) {
+ web_contents()->SetUserAgentOverride(user_agent);
+}
+
void WebContents::ExecuteJavaScript(const base::string16& code) {
web_contents()->GetMainFrame()->ExecuteJavaScript(code);
}
.SetMethod("getRoutingId", &WebContents::GetRoutingID)
.SetMethod("getProcessId", &WebContents::GetProcessID)
.SetMethod("isCrashed", &WebContents::IsCrashed)
+ .SetMethod("setUserAgent", &WebContents::SetUserAgent)
.SetMethod("_executeJavaScript", &WebContents::ExecuteJavaScript)
.SetMethod("_send", &WebContents::SendIPCMessage)
.SetMethod("setAutoSize", &WebContents::SetAutoSize)
#ifndef ATOM_BROWSER_API_ATOM_API_WEB_CONTENTS_H_
#define ATOM_BROWSER_API_ATOM_API_WEB_CONTENTS_H_
+#include <string>
+
#include "atom/browser/api/event_emitter.h"
#include "content/public/browser/browser_plugin_guest_delegate.h"
#include "content/public/browser/web_contents_delegate.h"
int GetRoutingID() const;
int GetProcessID() const;
bool IsCrashed() const;
+ void SetUserAgent(const std::string& user_agent);
void ExecuteJavaScript(const base::string16& code);
bool SendIPCMessage(const base::string16& channel,
const base::ListValue& args);
Whether the renderer process has crashed.
+### WebContents.setUserAgent(userAgent)
+
+* `userAgent` String
+
+Overrides the user agent for this page.
+
### WebContents.executeJavaScript(code)
* `code` String