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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_PLUGIN_PLUGIN_INTERPOSE_UTIL_MAC_H_ 6 #define CONTENT_PLUGIN_PLUGIN_INTERPOSE_UTIL_MAC_H_ 7 8 #include <Carbon/Carbon.h> 9 10 #import "base/basictypes.h" 11 12 // This is really a WebPluginDelegateImpl, but that class is private to the 13 // framework, and these functions are called from a dylib. 14 typedef void* OpaquePluginRef; 15 16 namespace mac_plugin_interposing { 17 18 // Swizzles methods we need to watch in order to manage process and window 19 // focus correctly. 20 void SetUpCocoaInterposing(); 21 22 // Brings the plugin process to the front so that the user can see its windows. 23 void SwitchToPluginProcess(); 24 25 // Returns the delegate currently processing events. 26 OpaquePluginRef GetActiveDelegate(); 27 28 // Sends a message to the browser process to inform it that the given window 29 // has been brought forward. 30 void NotifyBrowserOfPluginSelectWindow(uint32 window_id, CGRect bounds, 31 bool modal); 32 33 // Sends a message to the browser process to inform it that the given window 34 // has been shown. 35 void NotifyBrowserOfPluginShowWindow(uint32 window_id, CGRect bounds, 36 bool modal); 37 38 // Sends a message to the browser process to inform it that the given window 39 // has been hidden, and switches focus back to the browser process if there are 40 // no remaining plugin windows. 41 void NotifyBrowserOfPluginHideWindow(uint32 window_id, CGRect bounds); 42 43 } // namespace MacPluginInterpose 44 45 #endif // CONTENT_PLUGIN_PLUGIN_INTERPOSE_UTIL_MAC_H_ 46