| 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_GLUE_PLUGINS_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ | |
| 6 #define WEBKIT_GLUE_PLUGINS_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ | |
| 7 | |
| 8 #include <Carbon/Carbon.h> | |
| 9 #include <map> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 | |
| 13 // This is really a WebPluginDelegateImpl, but that class is private to the | |
| 14 // framework, and these functions are called from a dylib. | |
| 15 typedef void* OpaquePluginRef; | |
| 16 | |
| 17 // Creates and tracks the invisible windows that are necessary for | |
| 18 // Carbon-event-model plugins. | |
| 19 // | |
| 20 // Serves as a bridge between plugin delegate instances and the Carbon | |
| 21 // interposing library. The Carbon functions we interpose work in terms of | |
| 22 // WindowRefs, and we need to be able to map from those back to the plugin | |
| 23 // delegates that know what we should claim about the state of the window. | |
| 24 class __attribute__((visibility("default"))) CarbonPluginWindowTracker { | |
| 25 public: | |
| 26 CarbonPluginWindowTracker(); | |
| 27 | |
| 28 // Returns the shared window tracker instance. | |
| 29 static CarbonPluginWindowTracker* SharedInstance(); | |
| 30 | |
| 31 // Creates a new carbon window associated with |delegate|. | |
| 32 WindowRef CreateDummyWindowForDelegate(OpaquePluginRef delegate); | |
| 33 | |
| 34 // Returns the WebPluginDelegate associated with the given dummy window. | |
| 35 OpaquePluginRef GetDelegateForDummyWindow(WindowRef window) const; | |
| 36 | |
| 37 // Returns the dummy window associated with |delegate|. | |
| 38 WindowRef GetDummyWindowForDelegate(OpaquePluginRef delegate) const; | |
| 39 | |
| 40 // Destroys the dummy window for |delegate|. | |
| 41 void DestroyDummyWindowForDelegate(OpaquePluginRef delegate, | |
| 42 WindowRef window); | |
| 43 | |
| 44 private: | |
| 45 typedef std::map<WindowRef, OpaquePluginRef> WindowToDelegateMap; | |
| 46 typedef std::map<OpaquePluginRef, WindowRef> DelegateToWindowMap; | |
| 47 WindowToDelegateMap window_to_delegate_map_; | |
| 48 DelegateToWindowMap delegate_to_window_map_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(CarbonPluginWindowTracker); | |
| 51 }; | |
| 52 | |
| 53 #endif // WEBKIT_GLUE_PLUGINS_CARBON_PLUGIN_WINDOW_TRACKER_MAC_H_ | |
| OLD | NEW |