| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/perftimer.h" | 10 #include "base/perftimer.h" |
| 11 #include "base/pickle.h" | 11 #include "base/pickle.h" |
| 12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "chrome/renderer/extension_groups.h" | 14 #include "chrome/renderer/extension_groups.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "webkit/api/public/WebFrame.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 17 | 17 |
| 18 #include "grit/renderer_resources.h" | 18 #include "grit/renderer_resources.h" |
| 19 | 19 |
| 20 using WebKit::WebFrame; | 20 using WebKit::WebFrame; |
| 21 using WebKit::WebString; | 21 using WebKit::WebString; |
| 22 | 22 |
| 23 // These two strings are injected before and after the Greasemonkey API and | 23 // These two strings are injected before and after the Greasemonkey API and |
| 24 // user script to wrap it in an anonymous scope. | 24 // user script to wrap it in an anonymous scope. |
| 25 static const char kUserScriptHead[] = "(function (unsafeWindow) {\n"; | 25 static const char kUserScriptHead[] = "(function (unsafeWindow) {\n"; |
| 26 static const char kUserScriptTail[] = "\n})(window);"; | 26 static const char kUserScriptTail[] = "\n})(window);"; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 if (num_scripts) | 204 if (num_scripts) |
| 205 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); | 205 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); |
| 206 } else { | 206 } else { |
| 207 NOTREACHED(); | 207 NOTREACHED(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 LOG(INFO) << "Injected " << num_scripts << " scripts and " << num_css << | 210 LOG(INFO) << "Injected " << num_scripts << " scripts and " << num_css << |
| 211 "css files into " << frame->url().spec().data(); | 211 "css files into " << frame->url().spec().data(); |
| 212 return true; | 212 return true; |
| 213 } | 213 } |
| OLD | NEW |