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

Side by Side Diff: chrome/renderer/user_script_slave.h

Issue 1585013: Localize CSS files in content scripts (but don't localize JS files).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | chrome/renderer/user_script_slave.cc » ('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) 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 #ifndef CHROME_RENDERER_USER_SCRIPT_SLAVE_H_ 5 #ifndef CHROME_RENDERER_USER_SCRIPT_SLAVE_H_
6 #define CHROME_RENDERER_USER_SCRIPT_SLAVE_H_ 6 #define CHROME_RENDERER_USER_SCRIPT_SLAVE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/shared_memory.h" 14 #include "base/shared_memory.h"
15 #include "base/stl_util-inl.h" 15 #include "base/stl_util-inl.h"
16 #include "base/string_piece.h" 16 #include "base/string_piece.h"
17 #include "chrome/common/extensions/user_script.h" 17 #include "chrome/common/extensions/user_script.h"
18 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" 18 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
19 19
20 class RenderThreadBase;
21
20 namespace WebKit { 22 namespace WebKit {
21 class WebFrame; 23 class WebFrame;
22 } 24 }
23 25
24 using WebKit::WebScriptSource; 26 using WebKit::WebScriptSource;
25 27
26 // Manages installed UserScripts for a render process. 28 // Manages installed UserScripts for a render process.
27 class UserScriptSlave { 29 class UserScriptSlave {
28 public: 30 public:
29 UserScriptSlave(); 31 explicit UserScriptSlave(RenderThreadBase* render_thread);
30 32
31 // Returns the unique set of extension IDs this UserScriptSlave knows about. 33 // Returns the unique set of extension IDs this UserScriptSlave knows about.
32 void GetActiveExtensions(std::set<std::string>* extension_ids); 34 void GetActiveExtensions(std::set<std::string>* extension_ids);
33 35
34 // Update the parsed scripts from shared memory. 36 // Update the parsed scripts from shared memory.
35 bool UpdateScripts(base::SharedMemoryHandle shared_memory); 37 bool UpdateScripts(base::SharedMemoryHandle shared_memory,
38 bool is_incognito_process);
36 39
37 // Inject the appropriate scripts into a frame based on its URL. 40 // Inject the appropriate scripts into a frame based on its URL.
38 // TODO(aa): Extract a UserScriptFrame interface out of this to improve 41 // TODO(aa): Extract a UserScriptFrame interface out of this to improve
39 // testability. 42 // testability.
40 bool InjectScripts(WebKit::WebFrame* frame, UserScript::RunLocation location); 43 bool InjectScripts(WebKit::WebFrame* frame, UserScript::RunLocation location);
41 44
42 static int GetIsolatedWorldId(const std::string& extension_id); 45 static int GetIsolatedWorldId(const std::string& extension_id);
43 46
44 static void InsertInitExtensionCode(std::vector<WebScriptSource>* sources, 47 static void InsertInitExtensionCode(std::vector<WebScriptSource>* sources,
45 const std::string& extension_id); 48 const std::string& extension_id);
46 private: 49 private:
50 friend class UserScriptSlaveTest;
51
47 // Shared memory containing raw script data. 52 // Shared memory containing raw script data.
48 scoped_ptr<base::SharedMemory> shared_memory_; 53 scoped_ptr<base::SharedMemory> shared_memory_;
49 54
50 // Parsed script data. 55 // Parsed script data.
51 std::vector<UserScript*> scripts_; 56 std::vector<UserScript*> scripts_;
52 STLElementDeleter<std::vector<UserScript*> > script_deleter_; 57 STLElementDeleter<std::vector<UserScript*> > script_deleter_;
53 58
59 // RPC message sender for fetching message catalogs.
60 RenderThreadBase* render_thread_;
61
54 // Greasemonkey API source that is injected with the scripts. 62 // Greasemonkey API source that is injected with the scripts.
55 base::StringPiece api_js_; 63 base::StringPiece api_js_;
56 64
57 DISALLOW_COPY_AND_ASSIGN(UserScriptSlave); 65 DISALLOW_COPY_AND_ASSIGN(UserScriptSlave);
58 }; 66 };
59 67
60 #endif // CHROME_RENDERER_USER_SCRIPT_SLAVE_H_ 68 #endif // CHROME_RENDERER_USER_SCRIPT_SLAVE_H_
OLDNEW
« no previous file with comments | « chrome/renderer/render_thread.cc ('k') | chrome/renderer/user_script_slave.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698