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