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 #ifndef CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 blink::WebFrame* frame); | 57 blink::WebFrame* frame); |
58 | 58 |
59 // Gets the id of the extension running in a given isolated world. If no such | 59 // Gets the id of the extension running in a given isolated world. If no such |
60 // isolated world exists, or no extension is running in it, returns empty | 60 // isolated world exists, or no extension is running in it, returns empty |
61 // string. | 61 // string. |
62 std::string GetExtensionIdForIsolatedWorld(int isolated_world_id); | 62 std::string GetExtensionIdForIsolatedWorld(int isolated_world_id); |
63 | 63 |
64 void RemoveIsolatedWorld(const std::string& extension_id); | 64 void RemoveIsolatedWorld(const std::string& extension_id); |
65 | 65 |
66 private: | 66 private: |
67 static void InitializeIsolatedWorld(int isolated_world_id, | |
68 const Extension* extension); | |
69 | |
70 // Shared memory containing raw script data. | 67 // Shared memory containing raw script data. |
71 scoped_ptr<base::SharedMemory> shared_memory_; | 68 scoped_ptr<base::SharedMemory> shared_memory_; |
72 | 69 |
73 // Parsed script data. | 70 // Parsed script data. |
74 std::vector<UserScript*> scripts_; | 71 std::vector<UserScript*> scripts_; |
75 STLElementDeleter<std::vector<UserScript*> > script_deleter_; | 72 STLElementDeleter<std::vector<UserScript*> > script_deleter_; |
76 | 73 |
77 // Greasemonkey API source that is injected with the scripts. | 74 // Greasemonkey API source that is injected with the scripts. |
78 base::StringPiece api_js_; | 75 base::StringPiece api_js_; |
79 | 76 |
80 // Extension metadata. | 77 // Extension metadata. |
81 const ExtensionSet* extensions_; | 78 const ExtensionSet* extensions_; |
82 | 79 |
83 typedef std::map<std::string, int> IsolatedWorldMap; | 80 typedef std::map<std::string, int> IsolatedWorldMap; |
84 IsolatedWorldMap isolated_world_ids_; | 81 IsolatedWorldMap isolated_world_ids_; |
85 | 82 |
86 DISALLOW_COPY_AND_ASSIGN(UserScriptSlave); | 83 DISALLOW_COPY_AND_ASSIGN(UserScriptSlave); |
87 }; | 84 }; |
88 | 85 |
89 } // namespace extensions | 86 } // namespace extensions |
90 | 87 |
91 #endif // CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ | 88 #endif // CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ |
OLD | NEW |