OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 int GetIsolatedWorldIdForExtension(const Extension* extension, | 50 int GetIsolatedWorldIdForExtension(const Extension* extension, |
51 WebKit::WebFrame* frame); | 51 WebKit::WebFrame* frame); |
52 | 52 |
53 // Gets the id of the extension running in a given isolated world. If no such | 53 // Gets the id of the extension running in a given isolated world. If no such |
54 // isolated world exists, or no extension is running in it, returns empty | 54 // isolated world exists, or no extension is running in it, returns empty |
55 // string. | 55 // string. |
56 std::string GetExtensionIdForIsolatedWorld(int isolated_world_id); | 56 std::string GetExtensionIdForIsolatedWorld(int isolated_world_id); |
57 | 57 |
58 void RemoveIsolatedWorld(const std::string& extension_id); | 58 void RemoveIsolatedWorld(const std::string& extension_id); |
59 | 59 |
60 static void InsertInitExtensionCode(std::vector<WebScriptSource>* sources, | |
61 const std::string& extension_id); | |
62 private: | 60 private: |
63 static void InitializeIsolatedWorld(int isolated_world_id, | 61 static void InitializeIsolatedWorld(int isolated_world_id, |
64 const Extension* extension); | 62 const Extension* extension); |
65 | 63 |
66 // Shared memory containing raw script data. | 64 // Shared memory containing raw script data. |
67 scoped_ptr<base::SharedMemory> shared_memory_; | 65 scoped_ptr<base::SharedMemory> shared_memory_; |
68 | 66 |
69 // Parsed script data. | 67 // Parsed script data. |
70 std::vector<UserScript*> scripts_; | 68 std::vector<UserScript*> scripts_; |
71 STLElementDeleter<std::vector<UserScript*> > script_deleter_; | 69 STLElementDeleter<std::vector<UserScript*> > script_deleter_; |
72 | 70 |
73 // Greasemonkey API source that is injected with the scripts. | 71 // Greasemonkey API source that is injected with the scripts. |
74 base::StringPiece api_js_; | 72 base::StringPiece api_js_; |
75 | 73 |
76 // Extension metadata. | 74 // Extension metadata. |
77 const ExtensionSet* extensions_; | 75 const ExtensionSet* extensions_; |
78 | 76 |
79 typedef std::map<std::string, int> IsolatedWorldMap; | 77 typedef std::map<std::string, int> IsolatedWorldMap; |
80 IsolatedWorldMap isolated_world_ids_; | 78 IsolatedWorldMap isolated_world_ids_; |
81 | 79 |
82 DISALLOW_COPY_AND_ASSIGN(UserScriptSlave); | 80 DISALLOW_COPY_AND_ASSIGN(UserScriptSlave); |
83 }; | 81 }; |
84 | 82 |
85 #endif // CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ | 83 #endif // CHROME_RENDERER_EXTENSIONS_USER_SCRIPT_SLAVE_H_ |
OLD | NEW |