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

Side by Side Diff: chrome/renderer/extensions/extension_process_bindings.h

Issue 173166: Implement granular cross-origin XHR for extensions. (Closed)
Patch Set: some cleanup Created 11 years, 4 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
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 // 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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "v8/include/v8.h" 14 #include "v8/include/v8.h"
15 15
16 class GURL;
17 class URLPattern;
18
16 class ExtensionProcessBindings { 19 class ExtensionProcessBindings {
17 public: 20 public:
18 static void SetFunctionNames(const std::vector<std::string>& names); 21 static void SetFunctionNames(const std::vector<std::string>& names);
19 static v8::Extension* Get(); 22 static v8::Extension* Get();
20 23
21 // Handles a response to an API request. 24 // Handles a response to an API request.
22 static void HandleResponse(int request_id, bool success, 25 static void HandleResponse(int request_id, bool success,
23 const std::string& response, 26 const std::string& response,
24 const std::string& error); 27 const std::string& error);
25 28
26 // Sets the page action ids for a particular extension. 29 // Sets the page action ids for a particular extension.
27 static void SetPageActions(const std::string& extension_id, 30 static void SetPageActions(const std::string& extension_id,
28 const std::vector<std::string>& page_actions); 31 const std::vector<std::string>& page_actions);
29 32
30 // Sets the permissions for a particular extension. 33 // Sets the API permissions for a particular extension.
31 static void SetPermissions(const std::string& extension_id, 34 static void SetAPIPermissions(const std::string& extension_id,
32 const std::vector<std::string>& permissions); 35 const std::vector<std::string>& permissions);
36
37 // Sets the host permissions for a particular extension.
38 static void SetHostPermissions(const GURL& extension_url,
39 const std::vector<URLPattern>& permissions);
33 40
34 // Check if the extension in the currently running context has permission to 41 // Check if the extension in the currently running context has permission to
35 // access the given extension function. Must be called with a valid V8 42 // access the given extension function. Must be called with a valid V8
36 // context in scope. 43 // context in scope.
37 static bool CurrentContextHasPermission(const std::string& function_name); 44 static bool CurrentContextHasPermission(const std::string& function_name);
38 45
39 // Throw a V8 exception indicating that permission to access function_name was 46 // Throw a V8 exception indicating that permission to access function_name was
40 // denied. Must be called with a valid V8 context in scope. 47 // denied. Must be called with a valid V8 context in scope.
41 static v8::Handle<v8::Value> ThrowPermissionDeniedException( 48 static v8::Handle<v8::Value> ThrowPermissionDeniedException(
42 const std::string& function_name); 49 const std::string& function_name);
43 }; 50 };
44 51
45 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ 52 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698