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

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

Issue 2227193002: Make UserScript non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott 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
« no previous file with comments | « extensions/renderer/user_script_set.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/user_script_set.h" 5 #include "extensions/renderer/user_script_set.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 std::unique_ptr<UserScript> script(new UserScript()); 118 std::unique_ptr<UserScript> script(new UserScript());
119 script->Unpickle(pickle, &iter); 119 script->Unpickle(pickle, &iter);
120 120
121 // Note that this is a pointer into shared memory. We don't own it. It gets 121 // Note that this is a pointer into shared memory. We don't own it. It gets
122 // cleared up when the last renderer or browser process drops their 122 // cleared up when the last renderer or browser process drops their
123 // reference to the shared memory. 123 // reference to the shared memory.
124 for (size_t j = 0; j < script->js_scripts().size(); ++j) { 124 for (size_t j = 0; j < script->js_scripts().size(); ++j) {
125 const char* body = NULL; 125 const char* body = NULL;
126 int body_length = 0; 126 int body_length = 0;
127 CHECK(iter.ReadData(&body, &body_length)); 127 CHECK(iter.ReadData(&body, &body_length));
128 script->js_scripts()[j].set_external_content( 128 script->js_scripts()[j]->set_external_content(
129 base::StringPiece(body, body_length)); 129 base::StringPiece(body, body_length));
130 } 130 }
131 for (size_t j = 0; j < script->css_scripts().size(); ++j) { 131 for (size_t j = 0; j < script->css_scripts().size(); ++j) {
132 const char* body = NULL; 132 const char* body = NULL;
133 int body_length = 0; 133 int body_length = 0;
134 CHECK(iter.ReadData(&body, &body_length)); 134 CHECK(iter.ReadData(&body, &body_length));
135 script->css_scripts()[j].set_external_content( 135 script->css_scripts()[j]->set_external_content(
136 base::StringPiece(body, body_length)); 136 base::StringPiece(body, body_length));
137 } 137 }
138 138
139 if (only_inject_incognito && !script->is_incognito_enabled()) 139 if (only_inject_incognito && !script->is_incognito_enabled())
140 continue; // This script shouldn't run in an incognito tab. 140 continue; // This script shouldn't run in an incognito tab.
141 141
142 const Extension* extension = 142 const Extension* extension =
143 RendererExtensionRegistry::Get()->GetByID(script->extension_id()); 143 RendererExtensionRegistry::Get()->GetByID(script->extension_id());
144 if (whitelisted_only && 144 if (whitelisted_only &&
145 (!extension || 145 (!extension ||
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 !script->js_scripts().empty() && script->run_location() == run_location; 220 !script->js_scripts().empty() && script->run_location() == run_location;
221 if (inject_css || inject_js) { 221 if (inject_css || inject_js) {
222 injection.reset(new ScriptInjection(std::move(injector), render_frame, 222 injection.reset(new ScriptInjection(std::move(injector), render_frame,
223 std::move(injection_host), run_location, 223 std::move(injection_host), run_location,
224 log_activity)); 224 log_activity));
225 } 225 }
226 return injection; 226 return injection;
227 } 227 }
228 228
229 } // namespace extensions 229 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/user_script_set.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698