| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/user_script_slave.h" | 5 #include "chrome/renderer/extensions/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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 const Extension* extension = extensions_->GetByID(script->extension_id()); | 274 const Extension* extension = extensions_->GetByID(script->extension_id()); |
| 275 | 275 |
| 276 // Since extension info is sent separately from user script info, they can | 276 // Since extension info is sent separately from user script info, they can |
| 277 // be out of sync. We just ignore this situation. | 277 // be out of sync. We just ignore this situation. |
| 278 if (!extension) | 278 if (!extension) |
| 279 continue; | 279 continue; |
| 280 | 280 |
| 281 // Content scripts are not tab-specific. | 281 // Content scripts are not tab-specific. |
| 282 int kNoTabId = -1; | 282 int kNoTabId = -1; |
| 283 if (!extension->CanExecuteScriptOnPage(data_source_url, | 283 if (!extension->CanExecuteScriptOnPage(data_source_url, |
| 284 frame->top()->document().url(), |
| 284 kNoTabId, | 285 kNoTabId, |
| 285 script, | 286 script, |
| 286 NULL)) { | 287 NULL)) { |
| 287 continue; | 288 continue; |
| 288 } | 289 } |
| 289 | 290 |
| 290 // We rely on WebCore for CSS injection, but it's still useful to know how | 291 // We rely on WebCore for CSS injection, but it's still useful to know how |
| 291 // many css files there are. | 292 // many css files there are. |
| 292 if (location == UserScript::DOCUMENT_START) | 293 if (location == UserScript::DOCUMENT_START) |
| 293 num_css += script->css_scripts().size(); | 294 num_css += script->css_scripts().size(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } else if (location == UserScript::DOCUMENT_IDLE) { | 361 } else if (location == UserScript::DOCUMENT_IDLE) { |
| 361 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); | 362 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); |
| 362 if (num_scripts) | 363 if (num_scripts) |
| 363 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); | 364 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); |
| 364 } else { | 365 } else { |
| 365 NOTREACHED(); | 366 NOTREACHED(); |
| 366 } | 367 } |
| 367 } | 368 } |
| 368 | 369 |
| 369 } // namespace extensions | 370 } // namespace extensions |
| OLD | NEW |