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

Side by Side Diff: chrome/renderer/extensions/user_script_scheduler.cc

Issue 154113008: Switch from WebDocument::insertUserStyleSheet() to insertStyleSheet(). (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/user_script_scheduler.h" 5 #include "chrome/renderer/extensions/user_script_scheduler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chrome/common/extensions/extension_messages.h" 10 #include "chrome/common/extensions/extension_messages.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // V8ValueConverterImpl shouldn't actually care about the context scope, 231 // V8ValueConverterImpl shouldn't actually care about the context scope,
232 // and it switches to v8::Object's creation context when encountered. 232 // and it switches to v8::Object's creation context when encountered.
233 v8::Local<v8::Context> context = child_frame->mainWorldScriptContext(); 233 v8::Local<v8::Context> context = child_frame->mainWorldScriptContext();
234 base::Value* result = v8_converter->FromV8Value(script_value, context); 234 base::Value* result = v8_converter->FromV8Value(script_value, context);
235 // Always append an execution result (i.e. no result == null result) so 235 // Always append an execution result (i.e. no result == null result) so
236 // that |execution_results| lines up with the frames. 236 // that |execution_results| lines up with the frames.
237 execution_results.Append( 237 execution_results.Append(
238 result ? result : base::Value::CreateNullValue()); 238 result ? result : base::Value::CreateNullValue());
239 } 239 }
240 } else { 240 } else {
241 child_frame->document().insertUserStyleSheet( 241 child_frame->document().insertStyleSheet(WebString::fromUTF8(params.code)) ;
Finnur 2014/02/11 13:16:45 nit: >80 cols. (split this into two lines)
242 WebString::fromUTF8(params.code),
243 // Author level is consistent with WebView::injectStyleSheet.
244 WebDocument::UserStyleAuthorLevel);
245 } 242 }
246 } 243 }
247 244
248 render_view->Send(new ExtensionHostMsg_ExecuteCodeFinished( 245 render_view->Send(new ExtensionHostMsg_ExecuteCodeFinished(
249 render_view->GetRoutingID(), 246 render_view->GetRoutingID(),
250 params.request_id, 247 params.request_id,
251 error, 248 error,
252 render_view->GetPageId(), 249 render_view->GetPageId(),
253 UserScriptSlave::GetDataSourceURLForFrame(frame_), 250 UserScriptSlave::GetDataSourceURLForFrame(frame_),
254 execution_results)); 251 execution_results));
255 } 252 }
256 253
257 bool UserScriptScheduler::GetAllChildFrames( 254 bool UserScriptScheduler::GetAllChildFrames(
258 WebFrame* parent_frame, 255 WebFrame* parent_frame,
259 std::vector<WebFrame*>* frames_vector) const { 256 std::vector<WebFrame*>* frames_vector) const {
260 if (!parent_frame) 257 if (!parent_frame)
261 return false; 258 return false;
262 259
263 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; 260 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame;
264 child_frame = child_frame->nextSibling()) { 261 child_frame = child_frame->nextSibling()) {
265 frames_vector->push_back(child_frame); 262 frames_vector->push_back(child_frame);
266 GetAllChildFrames(child_frame, frames_vector); 263 GetAllChildFrames(child_frame, frames_vector);
267 } 264 }
268 return true; 265 return true;
269 } 266 }
270 267
271 } // namespace extensions 268 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698