| 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 #include "ppapi/proxy/plugin_dispatcher.h" | 5 #include "ppapi/proxy/plugin_dispatcher.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool PluginDispatcher::SendToBrowser(IPC::Message* msg) { | 194 bool PluginDispatcher::SendToBrowser(IPC::Message* msg) { |
| 195 return plugin_delegate_->SendToBrowser(msg); | 195 return plugin_delegate_->SendToBrowser(msg); |
| 196 } | 196 } |
| 197 | 197 |
| 198 WebKitForwarding* PluginDispatcher::GetWebKitForwarding() { | 198 WebKitForwarding* PluginDispatcher::GetWebKitForwarding() { |
| 199 return plugin_delegate_->GetWebKitForwarding(); | 199 return plugin_delegate_->GetWebKitForwarding(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 FunctionGroupBase* PluginDispatcher::GetFunctionAPI(InterfaceID id) { | 202 FunctionGroupBase* PluginDispatcher::GetFunctionAPI(ApiID id) { |
| 203 return GetInterfaceProxy(id); | 203 return GetInterfaceProxy(id); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void PluginDispatcher::ForceFreeAllInstances() { | 206 void PluginDispatcher::ForceFreeAllInstances() { |
| 207 if (!g_instance_to_dispatcher) | 207 if (!g_instance_to_dispatcher) |
| 208 return; | 208 return; |
| 209 | 209 |
| 210 // Iterating will remove each item from the map, so we need to make a copy | 210 // Iterating will remove each item from the map, so we need to make a copy |
| 211 // to avoid things changing out from under is. | 211 // to avoid things changing out from under is. |
| 212 InstanceToDispatcherMap temp_map = *g_instance_to_dispatcher; | 212 InstanceToDispatcherMap temp_map = *g_instance_to_dispatcher; |
| 213 for (InstanceToDispatcherMap::iterator i = temp_map.begin(); | 213 for (InstanceToDispatcherMap::iterator i = temp_map.begin(); |
| 214 i != temp_map.end(); ++i) { | 214 i != temp_map.end(); ++i) { |
| 215 if (i->second == this) { | 215 if (i->second == this) { |
| 216 // Synthesize an "instance destroyed" message, this will notify the | 216 // Synthesize an "instance destroyed" message, this will notify the |
| 217 // plugin and also remove it from our list of tracked plugins. | 217 // plugin and also remove it from our list of tracked plugins. |
| 218 PpapiMsg_PPPInstance_DidDestroy msg(INTERFACE_ID_PPP_INSTANCE, i->first); | 218 PpapiMsg_PPPInstance_DidDestroy msg(API_ID_PPP_INSTANCE, i->first); |
| 219 OnMessageReceived(msg); | 219 OnMessageReceived(msg); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 void PluginDispatcher::OnMsgSupportsInterface( | 224 void PluginDispatcher::OnMsgSupportsInterface( |
| 225 const std::string& interface_name, | 225 const std::string& interface_name, |
| 226 bool* result) { | 226 bool* result) { |
| 227 *result = !!GetPluginInterface(interface_name); | 227 *result = !!GetPluginInterface(interface_name); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { | 230 void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) { |
| 231 // The renderer may send us preferences more than once (currently this | 231 // The renderer may send us preferences more than once (currently this |
| 232 // happens every time a new plugin instance is created). Since we don't have | 232 // happens every time a new plugin instance is created). Since we don't have |
| 233 // a way to signal to the plugin that the preferences have changed, changing | 233 // a way to signal to the plugin that the preferences have changed, changing |
| 234 // the default fonts and such in the middle of a running plugin could be | 234 // the default fonts and such in the middle of a running plugin could be |
| 235 // confusing to it. As a result, we never allow the preferences to be changed | 235 // confusing to it. As a result, we never allow the preferences to be changed |
| 236 // once they're set. The user will have to restart to get new font prefs | 236 // once they're set. The user will have to restart to get new font prefs |
| 237 // propogated to plugins. | 237 // propogated to plugins. |
| 238 if (!received_preferences_) { | 238 if (!received_preferences_) { |
| 239 received_preferences_ = true; | 239 received_preferences_ = true; |
| 240 preferences_ = prefs; | 240 preferences_ = prefs; |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace proxy | 244 } // namespace proxy |
| 245 } // namespace ppapi | 245 } // namespace ppapi |
| OLD | NEW |