| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_PLUGINS_NPAPI_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ | |
| 6 #define WEBKIT_PLUGINS_NPAPI_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ | |
| 7 | |
| 8 #include <Carbon/Carbon.h> | |
| 9 #include <map> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 | |
| 13 namespace webkit { | |
| 14 namespace npapi { | |
| 15 | |
| 16 // This is really a WebPluginDelegateImpl, but that class is private to the | |
| 17 // framework, and these functions are called from a dylib. | |
| 18 typedef void* OpaquePluginRef; | |
| 19 | |
| 20 // Creates and tracks the invisible windows that are necessary for | |
| 21 // Carbon-event-model plugins. | |
| 22 // | |
| 23 // Serves as a bridge between plugin delegate instances and the Carbon | |
| 24 // interposing library. The Carbon functions we interpose work in terms of | |
| 25 // WindowRefs, and we need to be able to map from those back to the plugin | |
| 26 // delegates that know what we should claim about the state of the window. | |
| 27 class __attribute__((visibility("default"))) CarbonPluginWindowTracker { | |
| 28 public: | |
| 29 // Returns the shared window tracker instance. | |
| 30 static CarbonPluginWindowTracker* SharedInstance(); | |
| 31 | |
| 32 // Creates a new carbon window associated with |delegate|. | |
| 33 WindowRef CreateDummyWindowForDelegate(OpaquePluginRef delegate); | |
| 34 | |
| 35 // Returns the WebPluginDelegate associated with the given dummy window. | |
| 36 OpaquePluginRef GetDelegateForDummyWindow(WindowRef window) const; | |
| 37 | |
| 38 // Returns the dummy window associated with |delegate|. | |
| 39 WindowRef GetDummyWindowForDelegate(OpaquePluginRef delegate) const; | |
| 40 | |
| 41 // Destroys the dummy window for |delegate|. | |
| 42 void DestroyDummyWindowForDelegate(OpaquePluginRef delegate, | |
| 43 WindowRef window); | |
| 44 | |
| 45 private: | |
| 46 typedef std::map<WindowRef, OpaquePluginRef> WindowToDelegateMap; | |
| 47 typedef std::map<OpaquePluginRef, WindowRef> DelegateToWindowMap; | |
| 48 | |
| 49 CarbonPluginWindowTracker(); | |
| 50 ~CarbonPluginWindowTracker(); | |
| 51 | |
| 52 WindowToDelegateMap window_to_delegate_map_; | |
| 53 DelegateToWindowMap delegate_to_window_map_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(CarbonPluginWindowTracker); | |
| 56 }; | |
| 57 | |
| 58 } // namespace npapi | |
| 59 } // namespace webkit | |
| 60 | |
| 61 #endif // WEBKIT_PLUGINS_NPAPI_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ | |
| OLD | NEW |