| 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 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Sets the API permissions for a particular extension. | 42 // Sets the API permissions for a particular extension. |
| 43 static void SetAPIPermissions(const std::string& extension_id, | 43 static void SetAPIPermissions(const std::string& extension_id, |
| 44 const std::vector<std::string>& permissions); | 44 const std::vector<std::string>& permissions); |
| 45 | 45 |
| 46 // Sets the host permissions for a particular extension. | 46 // Sets the host permissions for a particular extension. |
| 47 static void SetHostPermissions(const GURL& extension_url, | 47 static void SetHostPermissions(const GURL& extension_url, |
| 48 const std::vector<URLPattern>& permissions); | 48 const std::vector<URLPattern>& permissions); |
| 49 | 49 |
| 50 // Sets whether incognito is enabled for a particular extension. | 50 // Sets whether incognito is enabled for a particular extension. |
| 51 static void SetIncognitoEnabled(const std::string& extension_id, | 51 static void SetIncognitoEnabled(const std::string& extension_id, |
| 52 bool enabled); | 52 bool enabled, |
| 53 bool incognito_split_mode); |
| 53 | 54 |
| 54 // Checks whether incognito is enabled for a particular extension. | 55 // Checks whether the given extension can see events/data from another |
| 55 static bool HasIncognitoEnabled(const std::string& extension_id); | 56 // profile (normal to incognito or vice versa). |
| 57 static bool AllowCrossProfile(const std::string& extension_id); |
| 56 | 58 |
| 57 // Check if the extension in the currently running context has permission to | 59 // Check if the extension in the currently running context has permission to |
| 58 // access the given extension function. Must be called with a valid V8 | 60 // access the given extension function. Must be called with a valid V8 |
| 59 // context in scope. | 61 // context in scope. |
| 60 static bool CurrentContextHasPermission(const std::string& function_name); | 62 static bool CurrentContextHasPermission(const std::string& function_name); |
| 61 | 63 |
| 62 // Checks whether |permission| is enabled for |extension_id|. |permission| | 64 // Checks whether |permission| is enabled for |extension_id|. |permission| |
| 63 // may be a raw permission name (from Extension::kPermissionNames), a | 65 // may be a raw permission name (from Extension::kPermissionNames), a |
| 64 // function name (e.g. "tabs.create") or an event name (e.g. "contextMenus/id" | 66 // function name (e.g. "tabs.create") or an event name (e.g. "contextMenus/id" |
| 65 // or "devtools.tabid.name"). | 67 // or "devtools.tabid.name"). |
| 66 // TODO(erikkay) We should standardize the naming scheme for our events. | 68 // TODO(erikkay) We should standardize the naming scheme for our events. |
| 67 static bool HasPermission(const std::string& extension_id, | 69 static bool HasPermission(const std::string& extension_id, |
| 68 const std::string& permission); | 70 const std::string& permission); |
| 69 | 71 |
| 70 // Throw a V8 exception indicating that permission to access function_name was | 72 // Throw a V8 exception indicating that permission to access function_name was |
| 71 // denied. Must be called with a valid V8 context in scope. | 73 // denied. Must be called with a valid V8 context in scope. |
| 72 static v8::Handle<v8::Value> ThrowPermissionDeniedException( | 74 static v8::Handle<v8::Value> ThrowPermissionDeniedException( |
| 73 const std::string& function_name); | 75 const std::string& function_name); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ | 78 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ |
| OLD | NEW |