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 CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <map> | 10 #include <map> |
(...skipping 27 matching lines...) Expand all Loading... |
38 struct WebPluginInfo; | 38 struct WebPluginInfo; |
39 namespace ppapi { | 39 namespace ppapi { |
40 class PepperFilePath; | 40 class PepperFilePath; |
41 class PluginInstance; | 41 class PluginInstance; |
42 class PluginModule; | 42 class PluginModule; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 namespace WebKit { | 46 namespace WebKit { |
47 class WebFileChooserCompletion; | 47 class WebFileChooserCompletion; |
| 48 class WebMouseEvent; |
48 struct WebFileChooserParams; | 49 struct WebFileChooserParams; |
49 } | 50 } |
50 | 51 |
51 namespace webkit_glue { | 52 namespace webkit_glue { |
52 struct CustomContextMenuContext; | 53 struct CustomContextMenuContext; |
53 } | 54 } |
54 | 55 |
55 class TransportDIB; | 56 class TransportDIB; |
56 | 57 |
57 // This object is NOT thread-safe. | 58 // This object is NOT thread-safe. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Removes broker from pending_connect_broker_ if present. Returns true if so. | 162 // Removes broker from pending_connect_broker_ if present. Returns true if so. |
162 bool StopWaitingForPpapiBrokerConnection(PpapiBrokerImpl* broker); | 163 bool StopWaitingForPpapiBrokerConnection(PpapiBrokerImpl* broker); |
163 | 164 |
164 // Notification that the render view has been focused or defocused. This | 165 // Notification that the render view has been focused or defocused. This |
165 // notifies all of the plugins. | 166 // notifies all of the plugins. |
166 void OnSetFocus(bool has_focus); | 167 void OnSetFocus(bool has_focus); |
167 | 168 |
168 // Returns whether or not a Pepper plugin is focused. | 169 // Returns whether or not a Pepper plugin is focused. |
169 bool IsPluginFocused() const; | 170 bool IsPluginFocused() const; |
170 | 171 |
| 172 // Notification that the request to lock the mouse has completed. |
| 173 void OnLockMouseACK(bool succeeded); |
| 174 // Notification that the plugin instance has lost the mouse lock. |
| 175 void OnMouseLockLost(); |
| 176 // Dispatches mouse events directly to the owner of the mouse lock. |
| 177 // True indicates currently the mouse is locked and the event has been |
| 178 // dispatched to the owner. |
| 179 bool DispatchLockedMouseEvent(const WebKit::WebMouseEvent& event); |
| 180 |
171 // PluginDelegate implementation. | 181 // PluginDelegate implementation. |
172 virtual void PluginFocusChanged(bool focused) OVERRIDE; | 182 virtual void PluginFocusChanged(bool focused) OVERRIDE; |
173 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); | 183 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); |
174 virtual void InstanceCreated( | 184 virtual void InstanceCreated( |
175 webkit::ppapi::PluginInstance* instance); | 185 webkit::ppapi::PluginInstance* instance); |
176 virtual void InstanceDeleted( | 186 virtual void InstanceDeleted( |
177 webkit::ppapi::PluginInstance* instance); | 187 webkit::ppapi::PluginInstance* instance); |
178 virtual SkBitmap* GetSadPluginBitmap(); | 188 virtual SkBitmap* GetSadPluginBitmap(); |
179 virtual PlatformAudio* CreateAudio( | 189 virtual PlatformAudio* CreateAudio( |
180 uint32_t sample_rate, | 190 uint32_t sample_rate, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 virtual void DidStopLoading() OVERRIDE; | 308 virtual void DidStopLoading() OVERRIDE; |
299 virtual void SetContentRestriction(int restrictions) OVERRIDE; | 309 virtual void SetContentRestriction(int restrictions) OVERRIDE; |
300 virtual void SaveURLAs(const GURL& url) OVERRIDE; | 310 virtual void SaveURLAs(const GURL& url) OVERRIDE; |
301 virtual content::P2PSocketDispatcher* GetP2PSocketDispatcher() OVERRIDE; | 311 virtual content::P2PSocketDispatcher* GetP2PSocketDispatcher() OVERRIDE; |
302 virtual webkit_glue::P2PTransport* CreateP2PTransport() OVERRIDE; | 312 virtual webkit_glue::P2PTransport* CreateP2PTransport() OVERRIDE; |
303 virtual double GetLocalTimeZoneOffset(base::Time t) OVERRIDE; | 313 virtual double GetLocalTimeZoneOffset(base::Time t) OVERRIDE; |
304 virtual std::string GetFlashCommandLineArgs() OVERRIDE; | 314 virtual std::string GetFlashCommandLineArgs() OVERRIDE; |
305 virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size) | 315 virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size) |
306 OVERRIDE; | 316 OVERRIDE; |
307 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; | 317 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; |
| 318 virtual void LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
| 319 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
308 | 320 |
309 CONTENT_EXPORT int GetRoutingId() const; | 321 CONTENT_EXPORT int GetRoutingId() const; |
310 | 322 |
311 private: | 323 private: |
312 void PublishInitialPolicy( | 324 void PublishInitialPolicy( |
313 scoped_refptr<webkit::ppapi::PluginInstance> instance, | 325 scoped_refptr<webkit::ppapi::PluginInstance> instance, |
314 const std::string& policy); | 326 const std::string& policy); |
315 | 327 |
316 // Asynchronously attempts to create a PPAPI broker for the given plugin. | 328 // Asynchronously attempts to create a PPAPI broker for the given plugin. |
317 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( | 329 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( |
318 webkit::ppapi::PluginModule* plugin_module); | 330 webkit::ppapi::PluginModule* plugin_module); |
319 | 331 |
| 332 bool MouseLockedOrPending() const { |
| 333 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; |
| 334 } |
| 335 |
320 // Pointer to the RenderView that owns us. | 336 // Pointer to the RenderView that owns us. |
321 RenderView* render_view_; | 337 RenderView* render_view_; |
322 | 338 |
323 std::set<webkit::ppapi::PluginInstance*> active_instances_; | 339 std::set<webkit::ppapi::PluginInstance*> active_instances_; |
324 | 340 |
325 // Used to send a single context menu "completion" upon menu close. | 341 // Used to send a single context menu "completion" upon menu close. |
326 bool has_saved_context_menu_action_; | 342 bool has_saved_context_menu_action_; |
327 unsigned saved_context_menu_action_; | 343 unsigned saved_context_menu_action_; |
328 | 344 |
329 // TODO(viettrungluu): Get rid of |id_generator_| -- just use |IDMap::Add()|. | 345 // TODO(viettrungluu): Get rid of |id_generator_| -- just use |IDMap::Add()|. |
(...skipping 10 matching lines...) Expand all Loading... |
340 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; | 356 typedef IDMap<scoped_refptr<PpapiBrokerImpl>, IDMapOwnPointer> BrokerMap; |
341 BrokerMap pending_connect_broker_; | 357 BrokerMap pending_connect_broker_; |
342 | 358 |
343 // Whether or not the focus is on a PPAPI plugin | 359 // Whether or not the focus is on a PPAPI plugin |
344 bool is_pepper_plugin_focused_; | 360 bool is_pepper_plugin_focused_; |
345 | 361 |
346 // Set of instances to receive a notification when the enterprise policy has | 362 // Set of instances to receive a notification when the enterprise policy has |
347 // been updated. | 363 // been updated. |
348 std::set<webkit::ppapi::PluginInstance*> subscribed_to_policy_updates_; | 364 std::set<webkit::ppapi::PluginInstance*> subscribed_to_policy_updates_; |
349 | 365 |
| 366 // |mouse_lock_owner_| is not owned by this class. We can know about when it |
| 367 // is destroyed via InstanceDeleted(). |
| 368 // |mouse_lock_owner_| being non-NULL doesn't indicate that currently the |
| 369 // mouse has been locked. It is possible that a request to lock the mouse has |
| 370 // been sent, but the response hasn't arrived yet. |
| 371 webkit::ppapi::PluginInstance* mouse_lock_owner_; |
| 372 bool mouse_locked_; |
| 373 // If both |pending_lock_request_| and |pending_unlock_request_| are true, |
| 374 // it means a lock request was sent before an unlock request and we haven't |
| 375 // received responses for them. |
| 376 // The logic in LockMouse() makes sure that a lock request won't be sent when |
| 377 // there is a pending unlock request. |
| 378 bool pending_lock_request_; |
| 379 bool pending_unlock_request_; |
| 380 |
350 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 381 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
351 }; | 382 }; |
352 | 383 |
353 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 384 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |