Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/renderer/extensions/user_script_slave.cc

Issue 10696176: Move UserScript and related into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/extensions/user_script_slave.h ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 #include "ui/base/layout.h" 35 #include "ui/base/layout.h"
36 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
37 37
38 using WebKit::WebFrame; 38 using WebKit::WebFrame;
39 using WebKit::WebSecurityOrigin; 39 using WebKit::WebSecurityOrigin;
40 using WebKit::WebSecurityPolicy; 40 using WebKit::WebSecurityPolicy;
41 using WebKit::WebString; 41 using WebKit::WebString;
42 using WebKit::WebVector; 42 using WebKit::WebVector;
43 using WebKit::WebView; 43 using WebKit::WebView;
44 using content::RenderThread; 44 using content::RenderThread;
45 using extensions::Extension; 45
46 namespace extensions {
46 47
47 // These two strings are injected before and after the Greasemonkey API and 48 // These two strings are injected before and after the Greasemonkey API and
48 // user script to wrap it in an anonymous scope. 49 // user script to wrap it in an anonymous scope.
49 static const char kUserScriptHead[] = "(function (unsafeWindow) {\n"; 50 static const char kUserScriptHead[] = "(function (unsafeWindow) {\n";
50 static const char kUserScriptTail[] = "\n})(window);"; 51 static const char kUserScriptTail[] = "\n})(window);";
51 52
52 int UserScriptSlave::GetIsolatedWorldIdForExtension( 53 int UserScriptSlave::GetIsolatedWorldIdForExtension(
53 const Extension* extension, WebFrame* frame) { 54 const Extension* extension, WebFrame* frame) {
54 static int g_next_isolated_world_id = 1; 55 static int g_next_isolated_world_id = 1;
55 56
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 if (num_scripts) 362 if (num_scripts)
362 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); 363 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed());
363 } else if (location == UserScript::DOCUMENT_IDLE) { 364 } else if (location == UserScript::DOCUMENT_IDLE) {
364 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); 365 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts);
365 if (num_scripts) 366 if (num_scripts)
366 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); 367 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed());
367 } else { 368 } else {
368 NOTREACHED(); 369 NOTREACHED();
369 } 370 }
370 } 371 }
372
373 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/user_script_slave.h ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698