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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (frame->parent() && !script->match_all_frames()) | 205 if (frame->parent() && !script->match_all_frames()) |
206 continue; // Only match subframes if the script declared it wanted to. | 206 continue; // Only match subframes if the script declared it wanted to. |
207 | 207 |
208 const Extension* extension = extensions_->GetByID(script->extension_id()); | 208 const Extension* extension = extensions_->GetByID(script->extension_id()); |
209 | 209 |
210 // Since extension info is sent separately from user script info, they can | 210 // Since extension info is sent separately from user script info, they can |
211 // be out of sync. We just ignore this situation. | 211 // be out of sync. We just ignore this situation. |
212 if (!extension) | 212 if (!extension) |
213 continue; | 213 continue; |
214 | 214 |
| 215 const GURL& document_url = ScriptContext::GetEffectiveDocumentURL( |
| 216 frame, data_source_url, script->match_about_blank()); |
| 217 |
215 // Content scripts are not tab-specific. | 218 // Content scripts are not tab-specific. |
216 const int kNoTabId = -1; | 219 const int kNoTabId = -1; |
217 // We don't have a process id in this context. | 220 // We don't have a process id in this context. |
218 const int kNoProcessId = -1; | 221 const int kNoProcessId = -1; |
219 if (!PermissionsData::CanExecuteScriptOnPage(extension, | 222 if (!PermissionsData::CanExecuteScriptOnPage(extension, |
220 data_source_url, | 223 document_url, |
221 top_frame->document().url(), | 224 top_frame->document().url(), |
222 kNoTabId, | 225 kNoTabId, |
223 script, | 226 script, |
224 kNoProcessId, | 227 kNoProcessId, |
225 NULL)) { | 228 NULL)) { |
226 continue; | 229 continue; |
227 } | 230 } |
228 | 231 |
229 if (location == UserScript::DOCUMENT_START) { | 232 if (location == UserScript::DOCUMENT_START) { |
230 num_css += script->css_scripts().size(); | 233 num_css += script->css_scripts().size(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } else if (location == UserScript::DOCUMENT_IDLE) { | 318 } else if (location == UserScript::DOCUMENT_IDLE) { |
316 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); | 319 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); |
317 if (num_scripts) | 320 if (num_scripts) |
318 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); | 321 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); |
319 } else { | 322 } else { |
320 NOTREACHED(); | 323 NOTREACHED(); |
321 } | 324 } |
322 } | 325 } |
323 | 326 |
324 } // namespace extensions | 327 } // namespace extensions |
OLD | NEW |