OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/user_script_slave.h" | 5 #include "chrome/renderer/user_script_slave.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "app/resource_bundle.h" | |
10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
11 #include "base/logging.h" | 10 #include "base/logging.h" |
12 #include "base/perftimer.h" | 11 #include "base/perftimer.h" |
13 #include "base/pickle.h" | 12 #include "base/pickle.h" |
14 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
15 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
16 #include "base/string_util.h" | 15 #include "base/string_util.h" |
17 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
19 #include "chrome/renderer/extension_groups.h" | 18 #include "chrome/renderer/extension_groups.h" |
20 #include "chrome/renderer/extensions/extension_renderer_info.h" | 19 #include "chrome/renderer/extensions/extension_renderer_info.h" |
21 #include "chrome/renderer/render_thread.h" | 20 #include "chrome/renderer/render_thread.h" |
22 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "grit/renderer_resources.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
26 | 26 #include "ui/base/resource/resource_bundle.h" |
27 #include "grit/renderer_resources.h" | |
28 | 27 |
29 using WebKit::WebFrame; | 28 using WebKit::WebFrame; |
30 using WebKit::WebString; | 29 using WebKit::WebString; |
31 using WebKit::WebVector; | 30 using WebKit::WebVector; |
32 using WebKit::WebView; | 31 using WebKit::WebView; |
33 | 32 |
34 // These two strings are injected before and after the Greasemonkey API and | 33 // These two strings are injected before and after the Greasemonkey API and |
35 // user script to wrap it in an anonymous scope. | 34 // user script to wrap it in an anonymous scope. |
36 static const char kUserScriptHead[] = "(function (unsafeWindow) {\n"; | 35 static const char kUserScriptHead[] = "(function (unsafeWindow) {\n"; |
37 static const char kUserScriptTail[] = "\n})(window);"; | 36 static const char kUserScriptTail[] = "\n})(window);"; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 if (num_scripts) | 281 if (num_scripts) |
283 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); | 282 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); |
284 } else if (location == UserScript::DOCUMENT_IDLE) { | 283 } else if (location == UserScript::DOCUMENT_IDLE) { |
285 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); | 284 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); |
286 if (num_scripts) | 285 if (num_scripts) |
287 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); | 286 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); |
288 } else { | 287 } else { |
289 NOTREACHED(); | 288 NOTREACHED(); |
290 } | 289 } |
291 } | 290 } |
OLD | NEW |