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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.h

Issue 11359063: Refactor the way singleton-style resources are exposed via PPB_Instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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
« no previous file with comments | « ppapi/thunk/ppb_instance_api.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 20 matching lines...) Expand all
31 #include "ppapi/c/ppb_input_event.h" 31 #include "ppapi/c/ppb_input_event.h"
32 #include "ppapi/c/ppb_gamepad.h" 32 #include "ppapi/c/ppb_gamepad.h"
33 #include "ppapi/c/ppp_graphics_3d.h" 33 #include "ppapi/c/ppp_graphics_3d.h"
34 #include "ppapi/c/ppp_input_event.h" 34 #include "ppapi/c/ppp_input_event.h"
35 #include "ppapi/c/ppp_messaging.h" 35 #include "ppapi/c/ppp_messaging.h"
36 #include "ppapi/c/ppp_mouse_lock.h" 36 #include "ppapi/c/ppp_mouse_lock.h"
37 #include "ppapi/c/private/ppb_content_decryptor_private.h" 37 #include "ppapi/c/private/ppb_content_decryptor_private.h"
38 #include "ppapi/c/private/ppp_instance_private.h" 38 #include "ppapi/c/private/ppp_instance_private.h"
39 #include "ppapi/shared_impl/ppb_instance_shared.h" 39 #include "ppapi/shared_impl/ppb_instance_shared.h"
40 #include "ppapi/shared_impl/ppb_view_shared.h" 40 #include "ppapi/shared_impl/ppb_view_shared.h"
41 #include "ppapi/thunk/ppb_flash_clipboard_api.h" 41 #include "ppapi/shared_impl/singleton_resource_id.h"
42 #include "ppapi/thunk/ppb_flash_functions_api.h" 42 #include "ppapi/shared_impl/tracked_callback.h"
43 #include "ppapi/thunk/ppb_gamepad_api.h" 43 #include "ppapi/thunk/ppb_gamepad_api.h"
44 #include "ppapi/thunk/resource_creation_api.h" 44 #include "ppapi/thunk/resource_creation_api.h"
45 #include "ppapi/shared_impl/tracked_callback.h"
46 #include "third_party/skia/include/core/SkRefCnt.h" 45 #include "third_party/skia/include/core/SkRefCnt.h"
47 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" 46 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h"
48 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 47 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
50 #include "ui/base/ime/text_input_type.h" 49 #include "ui/base/ime/text_input_type.h"
51 #include "ui/gfx/rect.h" 50 #include "ui/gfx/rect.h"
52 #include "webkit/plugins/ppapi/plugin_delegate.h" 51 #include "webkit/plugins/ppapi/plugin_delegate.h"
53 #include "webkit/plugins/ppapi/ppb_flash_impl.h" 52 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
54 #include "webkit/plugins/ppapi/ppp_pdf.h" 53 #include "webkit/plugins/ppapi/ppp_pdf.h"
55 #include "webkit/plugins/webkit_plugins_export.h" 54 #include "webkit/plugins/webkit_plugins_export.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 virtual void NumberOfFindResultsChanged(PP_Instance instance, 358 virtual void NumberOfFindResultsChanged(PP_Instance instance,
360 int32_t total, 359 int32_t total,
361 PP_Bool final_result) OVERRIDE; 360 PP_Bool final_result) OVERRIDE;
362 virtual void SelectedFindResultChanged(PP_Instance instance, 361 virtual void SelectedFindResultChanged(PP_Instance instance,
363 int32_t index) OVERRIDE; 362 int32_t index) OVERRIDE;
364 virtual PP_Bool SetFullscreen(PP_Instance instance, 363 virtual PP_Bool SetFullscreen(PP_Instance instance,
365 PP_Bool fullscreen) OVERRIDE; 364 PP_Bool fullscreen) OVERRIDE;
366 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) 365 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size)
367 OVERRIDE; 366 OVERRIDE;
368 virtual ::ppapi::thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE; 367 virtual ::ppapi::thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE;
369 virtual ::ppapi::thunk::PPB_Flash_Clipboard_API* GetFlashClipboardAPI( 368 virtual ::ppapi::Resource* GetSingletonResource(PP_Instance instance,
370 PP_Instance instance) OVERRIDE; 369 ::ppapi::SingletonResourceID id) OVERRIDE;
371 virtual ::ppapi::thunk::PPB_Flash_Functions_API* GetFlashFunctionsAPI(
372 PP_Instance instance) OVERRIDE;
373 virtual ::ppapi::thunk::PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance)
374 OVERRIDE;
375 virtual int32_t RequestInputEvents(PP_Instance instance, 370 virtual int32_t RequestInputEvents(PP_Instance instance,
376 uint32_t event_classes) OVERRIDE; 371 uint32_t event_classes) OVERRIDE;
377 virtual int32_t RequestFilteringInputEvents(PP_Instance instance, 372 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
378 uint32_t event_classes) OVERRIDE; 373 uint32_t event_classes) OVERRIDE;
379 virtual void ClearInputEventRequest(PP_Instance instance, 374 virtual void ClearInputEventRequest(PP_Instance instance,
380 uint32_t event_classes) OVERRIDE; 375 uint32_t event_classes) OVERRIDE;
381 virtual void ClosePendingUserGesture(PP_Instance instance, 376 virtual void ClosePendingUserGesture(PP_Instance instance,
382 PP_TimeTicks timestamp); 377 PP_TimeTicks timestamp);
383 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE; 378 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE;
384 virtual void ZoomLimitsChanged(PP_Instance instance, 379 virtual void ZoomLimitsChanged(PP_Instance instance,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if 454 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if
460 // necessary). 455 // necessary).
461 // This is for use with the NaCl proxy. 456 // This is for use with the NaCl proxy.
462 bool ResetAsProxied(scoped_refptr<PluginModule> module); 457 bool ResetAsProxied(scoped_refptr<PluginModule> module);
463 458
464 private: 459 private:
465 friend class PpapiUnittest; 460 friend class PpapiUnittest;
466 461
467 // Implements PPB_Gamepad_API. This is just to avoid having an excessive 462 // Implements PPB_Gamepad_API. This is just to avoid having an excessive
468 // number of interfaces implemented by PluginInstance. 463 // number of interfaces implemented by PluginInstance.
469 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API { 464 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API,
465 public ::ppapi::Resource {
470 public: 466 public:
471 explicit GamepadImpl(PluginDelegate* delegate); 467 explicit GamepadImpl(PluginDelegate* delegate);
468 // Resource implementation.
469 virtual ::ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE;
472 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE; 470 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE;
473 private: 471 private:
474 PluginDelegate* delegate_; 472 PluginDelegate* delegate_;
475 }; 473 };
476 474
477 // See the static Create functions above for creating PluginInstance objects. 475 // See the static Create functions above for creating PluginInstance objects.
478 // This constructor is private so that we can hide the PPP_Instance_Combined 476 // This constructor is private so that we can hide the PPP_Instance_Combined
479 // details while still having 1 constructor to maintain for member 477 // details while still having 1 constructor to maintain for member
480 // initialization. 478 // initialization.
481 PluginInstance(PluginDelegate* delegate, 479 PluginInstance(PluginDelegate* delegate,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_| 655 // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_|
658 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible 656 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible
659 // to generate the entire PDF given the variables below: 657 // to generate the entire PDF given the variables below:
660 // 658 //
661 // The most recently used WebCanvas, guaranteed to be valid. 659 // The most recently used WebCanvas, guaranteed to be valid.
662 SkRefPtr<WebKit::WebCanvas> canvas_; 660 SkRefPtr<WebKit::WebCanvas> canvas_;
663 // An array of page ranges. 661 // An array of page ranges.
664 std::vector<PP_PrintPageNumberRange_Dev> ranges_; 662 std::vector<PP_PrintPageNumberRange_Dev> ranges_;
665 #endif // OS_LINUX || OS_WIN 663 #endif // OS_LINUX || OS_WIN
666 664
667 GamepadImpl gamepad_impl_; 665 scoped_refptr< ::ppapi::Resource> gamepad_impl_;
668 666
669 // The plugin print interface. 667 // The plugin print interface.
670 const PPP_Printing_Dev* plugin_print_interface_; 668 const PPP_Printing_Dev* plugin_print_interface_;
671 669
672 // The plugin 3D interface. 670 // The plugin 3D interface.
673 const PPP_Graphics3D* plugin_graphics_3d_interface_; 671 const PPP_Graphics3D* plugin_graphics_3d_interface_;
674 672
675 // Contains the cursor if it's set by the plugin. 673 // Contains the cursor if it's set by the plugin.
676 scoped_ptr<WebKit::WebCursorInfo> cursor_; 674 scoped_ptr<WebKit::WebCursorInfo> cursor_;
677 675
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 // calls and handles PPB_ContentDecryptor_Private calls. 758 // calls and handles PPB_ContentDecryptor_Private calls.
761 scoped_ptr<ContentDecryptorDelegate> content_decryptor_delegate_; 759 scoped_ptr<ContentDecryptorDelegate> content_decryptor_delegate_;
762 760
763 DISALLOW_COPY_AND_ASSIGN(PluginInstance); 761 DISALLOW_COPY_AND_ASSIGN(PluginInstance);
764 }; 762 };
765 763
766 } // namespace ppapi 764 } // namespace ppapi
767 } // namespace webkit 765 } // namespace webkit
768 766
769 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 767 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_instance_api.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698