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

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

Issue 9903010: Extract ExtensionRequestSender from SchemaGeneratedBindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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_EXTENSION_DISPATCHER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
14 #include "base/timer.h" 14 #include "base/timer.h"
15 #include "content/public/renderer/render_process_observer.h" 15 #include "content/public/renderer/render_process_observer.h"
16 #include "chrome/common/extensions/extension_set.h" 16 #include "chrome/common/extensions/extension_set.h"
17 #include "chrome/common/extensions/feature.h" 17 #include "chrome/common/extensions/feature.h"
18 #include "chrome/renderer/extensions/chrome_v8_context.h" 18 #include "chrome/renderer/extensions/chrome_v8_context.h"
19 #include "chrome/renderer/extensions/chrome_v8_context_set.h" 19 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
20 #include "chrome/renderer/extensions/v8_schema_registry.h" 20 #include "chrome/renderer/extensions/v8_schema_registry.h"
21 #include "chrome/renderer/resource_bundle_source_map.h" 21 #include "chrome/renderer/resource_bundle_source_map.h"
22 #include "v8/include/v8.h" 22 #include "v8/include/v8.h"
23 23
24 class ModuleSystem; 24 class ModuleSystem;
25 class GURL; 25 class GURL;
26 class URLPattern; 26 class URLPattern;
27 class UserScriptSlave; 27 class UserScriptSlave;
28 class ExtensionRequestSender;
not at google - send to devlin 2012/03/30 03:14:31 nit: alphabetical order
koz (OOO until 15th September) 2012/04/03 00:15:17 Done.
28 struct ExtensionMsg_Loaded_Params; 29 struct ExtensionMsg_Loaded_Params;
29 30
30 namespace WebKit { 31 namespace WebKit {
31 class WebFrame; 32 class WebFrame;
32 } 33 }
33 34
34 namespace base { 35 namespace base {
35 class ListValue; 36 class ListValue;
36 } 37 }
37 38
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool IsAdblockWithWebRequestInstalled() const { 96 bool IsAdblockWithWebRequestInstalled() const {
96 return webrequest_adblock_; 97 return webrequest_adblock_;
97 } 98 }
98 bool IsAdblockPlusWithWebRequestInstalled() const { 99 bool IsAdblockPlusWithWebRequestInstalled() const {
99 return webrequest_adblock_plus_; 100 return webrequest_adblock_plus_;
100 } 101 }
101 bool IsOtherExtensionWithWebRequestInstalled() const { 102 bool IsOtherExtensionWithWebRequestInstalled() const {
102 return webrequest_other_; 103 return webrequest_other_;
103 } 104 }
104 105
106 void OnExtensionResponse(int request_id,
107 bool success,
108 const std::string& response,
109 const std::string& error);
110
111 // Checks that the current context contains an extension that has permission
112 // to execute the specified function. If it does not, a v8 exception is thrown
113 // and the method returns false. Otherwise returns true.
114 bool CheckCurrentContextAccessToExtensionAPI(
115 const std::string& function_name) const;
116
105 private: 117 private:
106 friend class RenderViewTest; 118 friend class RenderViewTest;
107 typedef void (*BindingInstaller)(ModuleSystem* module_system, 119 typedef void (*BindingInstaller)(ModuleSystem* module_system,
108 v8::Handle<v8::Object> chrome, 120 v8::Handle<v8::Object> chrome,
109 v8::Handle<v8::Object> chrome_hidden); 121 v8::Handle<v8::Object> chrome_hidden);
110 122
111 // RenderProcessObserver implementation: 123 // RenderProcessObserver implementation:
112 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; 124 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
113 virtual void WebKitInitialized() OVERRIDE; 125 virtual void WebKitInitialized() OVERRIDE;
114 virtual void IdleNotification() OVERRIDE; 126 virtual void IdleNotification() OVERRIDE;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 225
214 ResourceBundleSourceMap source_map_; 226 ResourceBundleSourceMap source_map_;
215 227
216 // Cache for the v8 representation of extension API schemas. 228 // Cache for the v8 representation of extension API schemas.
217 extensions::V8SchemaRegistry v8_schema_registry_; 229 extensions::V8SchemaRegistry v8_schema_registry_;
218 230
219 // Bindings that are defined lazily and have BindingInstallers to install 231 // Bindings that are defined lazily and have BindingInstallers to install
220 // them. 232 // them.
221 std::map<std::string, BindingInstaller> lazy_bindings_map_; 233 std::map<std::string, BindingInstaller> lazy_bindings_map_;
222 234
235 // Sends API requests to the extension host.
236 scoped_ptr<ExtensionRequestSender> request_sender_;
237
223 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); 238 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
224 }; 239 };
225 240
226 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 241 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698