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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return GURL(data_source->request().url()); | 257 return GURL(data_source->request().url()); |
258 } | 258 } |
259 | 259 |
260 void UserScriptSlave::InjectScripts(WebFrame* frame, | 260 void UserScriptSlave::InjectScripts(WebFrame* frame, |
261 UserScript::RunLocation location) { | 261 UserScript::RunLocation location) { |
262 GURL data_source_url = GetDataSourceURLForFrame(frame); | 262 GURL data_source_url = GetDataSourceURLForFrame(frame); |
263 if (data_source_url.is_empty()) | 263 if (data_source_url.is_empty()) |
264 return; | 264 return; |
265 | 265 |
266 if (frame->isViewSourceModeEnabled()) | 266 if (frame->isViewSourceModeEnabled()) |
267 data_source_url = GURL(chrome::kViewSourceScheme + std::string(":") + | 267 data_source_url = GURL(content::kViewSourceScheme + std::string(":") + |
268 data_source_url.spec()); | 268 data_source_url.spec()); |
269 | 269 |
270 PerfTimer timer; | 270 PerfTimer timer; |
271 int num_css = 0; | 271 int num_css = 0; |
272 int num_scripts = 0; | 272 int num_scripts = 0; |
273 | 273 |
274 ExecutingScriptsMap extensions_executing_scripts; | 274 ExecutingScriptsMap extensions_executing_scripts; |
275 | 275 |
276 for (size_t i = 0; i < scripts_.size(); ++i) { | 276 for (size_t i = 0; i < scripts_.size(); ++i) { |
277 std::vector<WebScriptSource> sources; | 277 std::vector<WebScriptSource> sources; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } else if (location == UserScript::DOCUMENT_IDLE) { | 379 } else if (location == UserScript::DOCUMENT_IDLE) { |
380 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); | 380 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); |
381 if (num_scripts) | 381 if (num_scripts) |
382 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); | 382 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); |
383 } else { | 383 } else { |
384 NOTREACHED(); | 384 NOTREACHED(); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 } // namespace extensions | 388 } // namespace extensions |
OLD | NEW |