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

Side by Side Diff: extensions/renderer/script_injection.cc

Issue 2250263004: [Extensions] Reduce string copy in renderer/ UserScript. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/script_injection.h" 5 #include "extensions/renderer/script_injection.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // asynchronously, and we should run it. 305 // asynchronously, and we should run it.
306 if (!async_completion_callback_.is_null()) { 306 if (!async_completion_callback_.is_null()) {
307 injector_->OnInjectionComplete(std::move(execution_result_), run_location_, 307 injector_->OnInjectionComplete(std::move(execution_result_), run_location_,
308 render_frame_); 308 render_frame_);
309 // Warning: this object can be destroyed after this line! 309 // Warning: this object can be destroyed after this line!
310 async_completion_callback_.Run(this); 310 async_completion_callback_.Run(this);
311 } 311 }
312 } 312 }
313 313
314 void ScriptInjection::InjectCss() { 314 void ScriptInjection::InjectCss() {
315 std::vector<std::string> css_sources = 315 std::vector<blink::WebString> css_sources =
316 injector_->GetCssSources(run_location_); 316 injector_->GetCssSources(run_location_);
317 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame(); 317 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame();
318 for (const std::string& css : css_sources) 318 for (const blink::WebString& css : css_sources)
319 web_frame->document().insertStyleSheet(blink::WebString::fromUTF8(css)); 319 web_frame->document().insertStyleSheet(css);
320 } 320 }
321 321
322 } // namespace extensions 322 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/programmatic_script_injector.cc ('k') | extensions/renderer/script_injector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698