return web_contents()->GetUserAgentOverride();
}
-void WebContents::InsertCSS(const std::string& css) {
- // FIXME(zcbenz): Redirect this method to webFrame.
-}
-
bool WebContents::SavePage(const base::FilePath& full_file_path,
const content::SavePageType& save_type,
const SavePageHandler::SavePageCallback& callback) {
.SetMethod("isCrashed", &WebContents::IsCrashed)
.SetMethod("setUserAgent", &WebContents::SetUserAgent)
.SetMethod("getUserAgent", &WebContents::GetUserAgent)
- .SetMethod("insertCSS", &WebContents::InsertCSS)
.SetMethod("savePage", &WebContents::SavePage)
.SetMethod("openDevTools", &WebContents::OpenDevTools)
.SetMethod("closeDevTools", &WebContents::CloseDevTools)
web_frame_->insertText(blink::WebString::fromUTF8(text));
}
+void WebFrame::InsertCSS(const std::string& css) {
+ web_frame_->document().insertStyleSheet(blink::WebString::fromUTF8(css));
+}
+
+
void WebFrame::ExecuteJavaScript(const base::string16& code,
mate::Arguments* args) {
bool has_user_gesture = false;
.SetMethod("registerURLSchemeAsPrivileged",
&WebFrame::RegisterURLSchemeAsPrivileged)
.SetMethod("insertText", &WebFrame::InsertText)
+ .SetMethod("insertCSS", &WebFrame::InsertCSS)
.SetMethod("executeJavaScript", &WebFrame::ExecuteJavaScript)
.SetMethod("getResourceUsage", &WebFrame::GetResourceUsage)
.SetMethod("clearCache", &WebFrame::ClearCache)
// Editing.
void InsertText(const std::string& text);
+ void InsertCSS(const std::string& css);
// Excecuting scripts.
void ExecuteJavaScript(const base::string16& code, mate::Arguments* args);
// Following methods are mapped to webFrame.
const webFrameMethods = [
+ 'insertCSS',
'insertText',
'setLayoutZoomLevelLimits',
'setVisualZoomLevelLimits',