From 1289b98a04a44eb64e74aeefa7c8affcde6ae89c Mon Sep 17 00:00:00 2001 From: "stuartmorgan@chromium.org" Date: Tue, 8 Dec 2009 19:41:08 +0000 Subject: Add Cocoa window interposing for plugin process Adds support for noticing window show/hide done via Cocoa APIs. Also adds interposing on a couple more Carbon calls that I came across while debugging. Refactors to make things a bit less messy: - Moves responsibility for re-activating the browser when the last plugin window closes into the browser, to simplify that logic. - Moves utility method for activating the plugin process into the plugin, rather than the interpose library, so the Cocoa code can use it too. - Add a data-holder and a couple of wrapper methods to reduce code duplication in the window show/hide handling. BUG=28009, 29321 TEST=Plugin-opened windows (Gmail attachments, full-screen Flash, etc.) should work as expected again. Review URL: http://codereview.chromium.org/465111 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34074 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/plugin/plugin_interpose_util_mac.h | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 chrome/plugin/plugin_interpose_util_mac.h (limited to 'chrome/plugin/plugin_interpose_util_mac.h') diff --git a/chrome/plugin/plugin_interpose_util_mac.h b/chrome/plugin/plugin_interpose_util_mac.h new file mode 100644 index 0000000..c68d1f2 --- /dev/null +++ b/chrome/plugin/plugin_interpose_util_mac.h @@ -0,0 +1,38 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_PLUGIN_PLUGIN_INTERPOSE_UTIL_MAC_H_ +#define CHROME_PLUGIN_PLUGIN_INTERPOSE_UTIL_MAC_H_ + +#include + +#import "base/basictypes.h" + +namespace mac_plugin_interposing { + +// Swizzles methods we need to watch in order to manage process and window +// focus correctly. +void SetUpCocoaInterposing(); + +// Brings the plugin process to the front so that the user can see its windows. +void SwitchToPluginProcess(); + +// Sends a message to the browser process to inform it that the given window +// has been brought forward. +void NotifyBrowserOfPluginSelectWindow(uint32 window_id, CGRect bounds, + bool modal); + +// Sends a message to the browser process to inform it that the given window +// has been shown. +void NotifyBrowserOfPluginShowWindow(uint32 window_id, CGRect bounds, + bool modal); + +// Sends a message to the browser process to inform it that the given window +// has been hidden, and switches focus back to the browser process if there are +// no remaining plugin windows. +void NotifyBrowserOfPluginHideWindow(uint32 window_id, CGRect bounds); + +} // namespace MacPluginInterpose + +#endif // CHROME_PLUGIN_PLUGIN_INTERPOSE_UTIL_MAC_H_ -- cgit v1.1