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 // Exposes extension APIs into the extension process. | 5 // Exposes extension APIs into the extension process. |
6 | 6 |
7 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ | 7 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ |
8 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ | 8 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 22 matching lines...) Expand all Loading... |
33 const std::vector<std::string>& page_actions); | 33 const std::vector<std::string>& page_actions); |
34 | 34 |
35 // Sets the API permissions for a particular extension. | 35 // Sets the API permissions for a particular extension. |
36 static void SetAPIPermissions(const std::string& extension_id, | 36 static void SetAPIPermissions(const std::string& extension_id, |
37 const std::vector<std::string>& permissions); | 37 const std::vector<std::string>& permissions); |
38 | 38 |
39 // Sets the host permissions for a particular extension. | 39 // Sets the host permissions for a particular extension. |
40 static void SetHostPermissions(const GURL& extension_url, | 40 static void SetHostPermissions(const GURL& extension_url, |
41 const std::vector<URLPattern>& permissions); | 41 const std::vector<URLPattern>& permissions); |
42 | 42 |
| 43 // Set l10n messages for a particular extension. |
| 44 static void SetL10nMessages( |
| 45 const std::string& extension_id, |
| 46 const std::map<std::string, std::string>& l10n_messages); |
| 47 |
43 // Check if the extension in the currently running context has permission to | 48 // Check if the extension in the currently running context has permission to |
44 // access the given extension function. Must be called with a valid V8 | 49 // access the given extension function. Must be called with a valid V8 |
45 // context in scope. | 50 // context in scope. |
46 static bool CurrentContextHasPermission(const std::string& function_name); | 51 static bool CurrentContextHasPermission(const std::string& function_name); |
47 | 52 |
48 // Throw a V8 exception indicating that permission to access function_name was | 53 // Throw a V8 exception indicating that permission to access function_name was |
49 // denied. Must be called with a valid V8 context in scope. | 54 // denied. Must be called with a valid V8 context in scope. |
50 static v8::Handle<v8::Value> ThrowPermissionDeniedException( | 55 static v8::Handle<v8::Value> ThrowPermissionDeniedException( |
51 const std::string& function_name); | 56 const std::string& function_name); |
52 | 57 |
53 // For EXTENSION_* |type| values, adds/replaces a special class name on to | 58 // For EXTENSION_* |type| values, adds/replaces a special class name on to |
54 // the document element (e.g. "extension_toolstrip", "extension_mole") so | 59 // the document element (e.g. "extension_toolstrip", "extension_mole") so |
55 // that the page can use CSS rules to control its display appropriately. | 60 // that the page can use CSS rules to control its display appropriately. |
56 static void SetViewType(WebView* view, ViewType::Type type); | 61 static void SetViewType(WebView* view, ViewType::Type type); |
57 }; | 62 }; |
58 | 63 |
59 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ | 64 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ |
OLD | NEW |