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 PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/process.h" | 12 #include "base/process.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "ppapi/c/pp_rect.h" | 14 #include "ppapi/c/pp_rect.h" |
15 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
16 #include "ppapi/proxy/dispatcher.h" | 16 #include "ppapi/proxy/dispatcher.h" |
17 #include "ppapi/shared_impl/function_group_base.h" | 17 #include "ppapi/shared_impl/function_group_base.h" |
| 18 #include "ppapi/shared_impl/ppapi_preferences.h" |
18 | 19 |
19 class MessageLoop; | 20 class MessageLoop; |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class WaitableEvent; | 23 class WaitableEvent; |
23 } | 24 } |
24 | 25 |
| 26 namespace ppapi { |
| 27 struct Preferences; |
| 28 } |
| 29 |
25 namespace pp { | 30 namespace pp { |
26 namespace proxy { | 31 namespace proxy { |
27 | 32 |
28 // Used to keep track of per-instance data. | 33 // Used to keep track of per-instance data. |
29 struct InstanceData { | 34 struct InstanceData { |
30 InstanceData() : fullscreen(PP_FALSE) {} | 35 InstanceData() : fullscreen(PP_FALSE) {} |
31 PP_Rect position; | 36 PP_Rect position; |
32 PP_Bool fullscreen; | 37 PP_Bool fullscreen; |
33 }; | 38 }; |
34 | 39 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Posts the given task to the WebKit thread. | 106 // Posts the given task to the WebKit thread. |
102 void PostToWebKitThread(const tracked_objects::Location& from_here, | 107 void PostToWebKitThread(const tracked_objects::Location& from_here, |
103 const base::Closure& task); | 108 const base::Closure& task); |
104 | 109 |
105 // Calls the PluginDelegate.SendToBrowser function. | 110 // Calls the PluginDelegate.SendToBrowser function. |
106 bool SendToBrowser(IPC::Message* msg); | 111 bool SendToBrowser(IPC::Message* msg); |
107 | 112 |
108 // Returns the WebKitForwarding object used to forward events to WebKit. | 113 // Returns the WebKitForwarding object used to forward events to WebKit. |
109 ppapi::WebKitForwarding* GetWebKitForwarding(); | 114 ppapi::WebKitForwarding* GetWebKitForwarding(); |
110 | 115 |
| 116 // Returns the Preferences. |
| 117 const ppapi::Preferences& preferences() const { return preferences_; } |
| 118 |
111 // Returns the "new-style" function API for the given interface ID, creating | 119 // Returns the "new-style" function API for the given interface ID, creating |
112 // it if necessary. | 120 // it if necessary. |
113 // TODO(brettw) this is in progress. It should be merged with the target | 121 // TODO(brettw) this is in progress. It should be merged with the target |
114 // proxies so there is one list to consult. | 122 // proxies so there is one list to consult. |
115 ppapi::FunctionGroupBase* GetFunctionAPI( | 123 ppapi::FunctionGroupBase* GetFunctionAPI( |
116 pp::proxy::InterfaceID id); | 124 pp::proxy::InterfaceID id); |
117 | 125 |
118 private: | 126 private: |
119 friend class PluginDispatcherTest; | 127 friend class PluginDispatcherTest; |
120 | 128 |
121 // Notifies all live instances that they're now closed. This is used when | 129 // Notifies all live instances that they're now closed. This is used when |
122 // a renderer crashes or some other error is received. | 130 // a renderer crashes or some other error is received. |
123 void ForceFreeAllInstances(); | 131 void ForceFreeAllInstances(); |
124 | 132 |
125 // IPC message handlers. | 133 // IPC message handlers. |
126 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); | 134 void OnMsgSupportsInterface(const std::string& interface_name, bool* result); |
| 135 void OnMsgSetPreferences(const ::ppapi::Preferences& prefs); |
127 | 136 |
128 PluginDelegate* plugin_delegate_; | 137 PluginDelegate* plugin_delegate_; |
129 | 138 |
130 // All target proxies currently created. These are ones that receive | 139 // All target proxies currently created. These are ones that receive |
131 // messages. | 140 // messages. |
132 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; | 141 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; |
133 | 142 |
134 // Function proxies created for "new-style" FunctionGroups. | 143 // Function proxies created for "new-style" FunctionGroups. |
135 // TODO(brettw) this is in progress. It should be merged with the target | 144 // TODO(brettw) this is in progress. It should be merged with the target |
136 // proxies so there is one list to consult. | 145 // proxies so there is one list to consult. |
137 scoped_ptr< ::ppapi::FunctionGroupBase > | 146 scoped_ptr< ::ppapi::FunctionGroupBase > |
138 function_proxies_[INTERFACE_ID_COUNT]; | 147 function_proxies_[INTERFACE_ID_COUNT]; |
139 | 148 |
140 typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap; | 149 typedef base::hash_map<PP_Instance, InstanceData> InstanceDataMap; |
141 InstanceDataMap instance_map_; | 150 InstanceDataMap instance_map_; |
142 | 151 |
| 152 ppapi::Preferences preferences_; |
| 153 |
143 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); | 154 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); |
144 }; | 155 }; |
145 | 156 |
146 } // namespace proxy | 157 } // namespace proxy |
147 } // namespace pp | 158 } // namespace pp |
148 | 159 |
149 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 160 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
OLD | NEW |