Add WebContents.insertCSS
This commit is contained in:
parent
1f08d50e98
commit
e214ce6bc4
4 changed files with 15 additions and 3 deletions
|
@ -293,6 +293,10 @@ void WebContents::SetUserAgent(const std::string& user_agent) {
|
||||||
web_contents()->SetUserAgentOverride(user_agent);
|
web_contents()->SetUserAgentOverride(user_agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebContents::InsertCSS(const std::string& css) {
|
||||||
|
web_contents()->InsertCSS(css);
|
||||||
|
}
|
||||||
|
|
||||||
void WebContents::ExecuteJavaScript(const base::string16& code) {
|
void WebContents::ExecuteJavaScript(const base::string16& code) {
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScript(code);
|
web_contents()->GetMainFrame()->ExecuteJavaScript(code);
|
||||||
}
|
}
|
||||||
|
@ -365,6 +369,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
|
||||||
.SetMethod("getProcessId", &WebContents::GetProcessID)
|
.SetMethod("getProcessId", &WebContents::GetProcessID)
|
||||||
.SetMethod("isCrashed", &WebContents::IsCrashed)
|
.SetMethod("isCrashed", &WebContents::IsCrashed)
|
||||||
.SetMethod("setUserAgent", &WebContents::SetUserAgent)
|
.SetMethod("setUserAgent", &WebContents::SetUserAgent)
|
||||||
|
.SetMethod("insertCSS", &WebContents::InsertCSS)
|
||||||
.SetMethod("_executeJavaScript", &WebContents::ExecuteJavaScript)
|
.SetMethod("_executeJavaScript", &WebContents::ExecuteJavaScript)
|
||||||
.SetMethod("_send", &WebContents::SendIPCMessage)
|
.SetMethod("_send", &WebContents::SendIPCMessage)
|
||||||
.SetMethod("setAutoSize", &WebContents::SetAutoSize)
|
.SetMethod("setAutoSize", &WebContents::SetAutoSize)
|
||||||
|
|
|
@ -55,6 +55,7 @@ class WebContents : public mate::EventEmitter,
|
||||||
int GetProcessID() const;
|
int GetProcessID() const;
|
||||||
bool IsCrashed() const;
|
bool IsCrashed() const;
|
||||||
void SetUserAgent(const std::string& user_agent);
|
void SetUserAgent(const std::string& user_agent);
|
||||||
|
void InsertCSS(const std::string& css);
|
||||||
void ExecuteJavaScript(const base::string16& code);
|
void ExecuteJavaScript(const base::string16& code);
|
||||||
bool SendIPCMessage(const base::string16& channel,
|
bool SendIPCMessage(const base::string16& channel,
|
||||||
const base::ListValue& args);
|
const base::ListValue& args);
|
||||||
|
|
|
@ -511,11 +511,11 @@ registerWebViewElement = ->
|
||||||
"goToIndex"
|
"goToIndex"
|
||||||
"goToOffset"
|
"goToOffset"
|
||||||
"isCrashed"
|
"isCrashed"
|
||||||
"executeJavaScript"
|
|
||||||
"send"
|
|
||||||
"setUserAgent"
|
"setUserAgent"
|
||||||
|
"executeJavaScript"
|
||||||
|
"insertCSS"
|
||||||
|
"send"
|
||||||
# "getZoom"
|
# "getZoom"
|
||||||
# "insertCSS"
|
|
||||||
# "print"
|
# "print"
|
||||||
# "setZoom"
|
# "setZoom"
|
||||||
# "terminate"
|
# "terminate"
|
||||||
|
|
|
@ -612,6 +612,12 @@ Whether the renderer process has crashed.
|
||||||
|
|
||||||
Overrides the user agent for this page.
|
Overrides the user agent for this page.
|
||||||
|
|
||||||
|
### WebContents.insertCSS(css)
|
||||||
|
|
||||||
|
* `css` String
|
||||||
|
|
||||||
|
Injects CSS into this page.
|
||||||
|
|
||||||
### WebContents.executeJavaScript(code)
|
### WebContents.executeJavaScript(code)
|
||||||
|
|
||||||
* `code` String
|
* `code` String
|
||||||
|
|
Loading…
Reference in a new issue