Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: content/renderer/render_view.cc

Issue 7517001: Switch from WebDocument::insertStyleText to ::insertUserStyleSheet for programatic CSS injection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view.h" 5 #include "content/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after
3344 } 3344 }
3345 3345
3346 void RenderView::OnScriptEvalRequest(const string16& frame_xpath, 3346 void RenderView::OnScriptEvalRequest(const string16& frame_xpath,
3347 const string16& jscript, 3347 const string16& jscript,
3348 int id, 3348 int id,
3349 bool notify_result) { 3349 bool notify_result) {
3350 EvaluateScript(frame_xpath, jscript, id, notify_result); 3350 EvaluateScript(frame_xpath, jscript, id, notify_result);
3351 } 3351 }
3352 3352
3353 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, 3353 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath,
3354 const std::string& css, 3354 const std::string& css) {
3355 const std::string& id) {
3356 WebFrame* frame = GetChildFrame(frame_xpath); 3355 WebFrame* frame = GetChildFrame(frame_xpath);
3357 if (!frame) 3356 if (!frame)
3358 return; 3357 return;
3359 3358
3360 frame->document().insertStyleText(WebString::fromUTF8(css), 3359 frame->document().insertUserStyleSheet(
3361 WebString::fromUTF8(id)); 3360 WebString::fromUTF8(css),
3361 WebDocument::UserStyleAuthorLevel);
3362 } 3362 }
3363 3363
3364 void RenderView::OnAllowBindings(int enabled_bindings_flags) { 3364 void RenderView::OnAllowBindings(int enabled_bindings_flags) {
3365 enabled_bindings_ |= enabled_bindings_flags; 3365 enabled_bindings_ |= enabled_bindings_flags;
3366 } 3366 }
3367 3367
3368 void RenderView::OnSetWebUIProperty(const std::string& name, 3368 void RenderView::OnSetWebUIProperty(const std::string& name,
3369 const std::string& value) { 3369 const std::string& value) {
3370 DCHECK(BindingsPolicy::is_web_ui_enabled(enabled_bindings_)); 3370 DCHECK(BindingsPolicy::is_web_ui_enabled(enabled_bindings_));
3371 GetWebUIBindings()->SetProperty(name, value); 3371 GetWebUIBindings()->SetProperty(name, value);
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 } 4307 }
4308 #endif 4308 #endif
4309 4309
4310 void RenderView::OnContextMenuClosed( 4310 void RenderView::OnContextMenuClosed(
4311 const webkit_glue::CustomContextMenuContext& custom_context) { 4311 const webkit_glue::CustomContextMenuContext& custom_context) {
4312 if (custom_context.is_pepper_menu) 4312 if (custom_context.is_pepper_menu)
4313 pepper_delegate_.OnContextMenuClosed(custom_context); 4313 pepper_delegate_.OnContextMenuClosed(custom_context);
4314 else 4314 else
4315 context_menu_node_.reset(); 4315 context_menu_node_.reset();
4316 } 4316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698