OLD | NEW |
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_slave.h" | 5 #include "extensions/renderer/user_script_slave.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 script_injections_.begin(); | 177 script_injections_.begin(); |
178 iter != script_injections_.end(); | 178 iter != script_injections_.end(); |
179 ++iter) { | 179 ++iter) { |
180 ScriptInjection* injection = *iter; | 180 ScriptInjection* injection = *iter; |
181 if (!injection->WantsToRun(frame, location, document_url)) | 181 if (!injection->WantsToRun(frame, location, document_url)) |
182 continue; | 182 continue; |
183 | 183 |
184 const Extension* extension = GetExtension(injection->extension_id()); | 184 const Extension* extension = GetExtension(injection->extension_id()); |
185 DCHECK(extension); | 185 DCHECK(extension); |
186 | 186 |
187 if (PermissionsData::RequiresActionForScriptExecution( | 187 if (PermissionsData::ForExtension(extension) |
188 extension, | 188 ->RequiresActionForScriptExecution( |
189 ExtensionHelper::Get(top_render_view)->tab_id(), | 189 extension, |
190 document_url)) { | 190 ExtensionHelper::Get(top_render_view)->tab_id(), |
| 191 document_url)) { |
191 // TODO(rdevlin.cronin): Right now, this is just a notification, but soon | 192 // TODO(rdevlin.cronin): Right now, this is just a notification, but soon |
192 // we should block without user consent. | 193 // we should block without user consent. |
193 top_render_view->Send( | 194 top_render_view->Send( |
194 new ExtensionHostMsg_NotifyExtensionScriptExecution( | 195 new ExtensionHostMsg_NotifyExtensionScriptExecution( |
195 top_render_view->GetRoutingID(), | 196 top_render_view->GetRoutingID(), |
196 extension->id(), | 197 extension->id(), |
197 top_render_view->GetPageId())); | 198 top_render_view->GetPageId())); |
198 } | 199 } |
199 | 200 |
200 injection->Inject(frame, location, &scripts_run_info); | 201 injection->Inject(frame, location, &scripts_run_info); |
(...skipping 30 matching lines...) Expand all Loading... |
231 } else if (location == UserScript::DOCUMENT_IDLE) { | 232 } else if (location == UserScript::DOCUMENT_IDLE) { |
232 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", info.num_js); | 233 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", info.num_js); |
233 if (info.num_js) | 234 if (info.num_js) |
234 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", info.timer.Elapsed()); | 235 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", info.timer.Elapsed()); |
235 } else { | 236 } else { |
236 NOTREACHED(); | 237 NOTREACHED(); |
237 } | 238 } |
238 } | 239 } |
239 | 240 |
240 } // namespace extensions | 241 } // namespace extensions |
OLD | NEW |