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

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

Issue 420543002: Declarative content scripts: Browser-side: per-extension shared memory regions (lazily loaded) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor UserScriptMaster into UserScriptLoader, managed by SharedUserScriptMaster and DeclarativeU… Created 6 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/user_script_set.h" 5 #include "extensions/renderer/user_script_set.h"
6 6
7 #include "content/public/common/url_constants.h" 7 #include "content/public/common/url_constants.h"
8 #include "content/public/renderer/render_thread.h" 8 #include "content/public/renderer/render_thread.h"
9 #include "extensions/common/extension.h" 9 #include "extensions/common/extension.h"
10 #include "extensions/common/extension_messages.h" 10 #include "extensions/common/extension_messages.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const Extension* extension = extensions_->GetByID((*iter)->extension_id()); 71 const Extension* extension = extensions_->GetByID((*iter)->extension_id());
72 if (!extension) 72 if (!extension)
73 continue; 73 continue;
74 scoped_ptr<ScriptInjection> injection = GetInjectionForScript( 74 scoped_ptr<ScriptInjection> injection = GetInjectionForScript(
75 *iter, web_frame, tab_id, run_location, document_url, extension); 75 *iter, web_frame, tab_id, run_location, document_url, extension);
76 if (injection.get()) 76 if (injection.get())
77 injections->push_back(injection.release()); 77 injections->push_back(injection.release());
78 } 78 }
79 } 79 }
80 80
81 bool UserScriptSet::UpdateUserScripts( 81 bool UserScriptSet::OnUpdateUserScripts(
82 base::SharedMemoryHandle shared_memory, 82 base::SharedMemoryHandle shared_memory,
83 const std::set<std::string>& changed_extensions) { 83 const std::set<std::string>& changed_extensions) {
84 bool only_inject_incognito = 84 bool only_inject_incognito =
85 ExtensionsRendererClient::Get()->IsIncognitoProcess(); 85 ExtensionsRendererClient::Get()->IsIncognitoProcess();
86 86
87 // Create the shared memory object (read only). 87 // Create the shared memory object (read only).
88 shared_memory_.reset(new base::SharedMemory(shared_memory, true)); 88 shared_memory_.reset(new base::SharedMemory(shared_memory, true));
89 if (!shared_memory_.get()) 89 if (!shared_memory_.get())
90 return false; 90 return false;
91 91
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 scoped_ptr<ScriptInjector>(new UserScriptInjector(script, this)), 179 scoped_ptr<ScriptInjector>(new UserScriptInjector(script, this)),
180 web_frame, 180 web_frame,
181 extension->id(), 181 extension->id(),
182 run_location, 182 run_location,
183 tab_id)); 183 tab_id));
184 } 184 }
185 return injection.Pass(); 185 return injection.Pass();
186 } 186 }
187 187
188 } // namespace extensions 188 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698