|
@@ -325,11 +325,22 @@ void InsertText(v8::Local<v8::Value> window, const std::string& text) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void InsertCSS(v8::Local<v8::Value> window, const std::string& css) {
|
|
|
+base::string16 InsertCSS(v8::Local<v8::Value> window, const std::string& css) {
|
|
|
blink::WebFrame* web_frame = GetRenderFrame(window)->GetWebFrame();
|
|
|
if (web_frame->IsWebLocalFrame()) {
|
|
|
- web_frame->ToWebLocalFrame()->GetDocument().InsertStyleSheet(
|
|
|
- blink::WebString::FromUTF8(css));
|
|
|
+ return web_frame->ToWebLocalFrame()
|
|
|
+ ->GetDocument()
|
|
|
+ .InsertStyleSheet(blink::WebString::FromUTF8(css))
|
|
|
+ .Utf16();
|
|
|
+ }
|
|
|
+ return base::string16();
|
|
|
+}
|
|
|
+
|
|
|
+void RemoveInsertedCSS(v8::Local<v8::Value> window, const base::string16& key) {
|
|
|
+ blink::WebFrame* web_frame = GetRenderFrame(window)->GetWebFrame();
|
|
|
+ if (web_frame->IsWebLocalFrame()) {
|
|
|
+ web_frame->ToWebLocalFrame()->GetDocument().RemoveInsertedStyleSheet(
|
|
|
+ blink::WebString::FromUTF16(key));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -546,6 +557,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|
|
dict.SetMethod("setSpellCheckProvider", &SetSpellCheckProvider);
|
|
|
dict.SetMethod("insertText", &InsertText);
|
|
|
dict.SetMethod("insertCSS", &InsertCSS);
|
|
|
+ dict.SetMethod("removeInsertedCSS", &RemoveInsertedCSS);
|
|
|
dict.SetMethod("executeJavaScript", &ExecuteJavaScript);
|
|
|
dict.SetMethod("executeJavaScriptInIsolatedWorld",
|
|
|
&ExecuteJavaScriptInIsolatedWorld);
|