diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 17:27:08 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 17:27:08 +0000 |
commit | a96ec6a0045c0b1926c9e4c553b67e42a43a430b (patch) | |
tree | 017387bccd62964c28a0892b78614a0f1820282e /chrome/browser/plugin_carbon_interpose_mac.cc | |
parent | 39a2e833dc1983b78e9cf78df3d8f3cda3f150c9 (diff) | |
download | chromium_src-a96ec6a0045c0b1926c9e4c553b67e42a43a430b.zip chromium_src-a96ec6a0045c0b1926c9e4c553b67e42a43a430b.tar.gz chromium_src-a96ec6a0045c0b1926c9e4c553b67e42a43a430b.tar.bz2 |
Don't allow the browser to stay above a modal plugin window (Mac)
There's a flicker of the modal window being hidden then coming forward again, and the menus still work, so we'll most likely have fake the modality more aggressively at some point. This gets us the basic infrastructure though, and solves the severe usability problem.
BUG=20798
TEST=Open a modal plugin window (e.g., Gmail upload). Switch to another app, then back to Chrome; the plugin window should come to the front.
Review URL: http://codereview.chromium.org/355021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30965 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_carbon_interpose_mac.cc')
-rw-r--r-- | chrome/browser/plugin_carbon_interpose_mac.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/plugin_carbon_interpose_mac.cc b/chrome/browser/plugin_carbon_interpose_mac.cc index e9a4997..1957f47 100644 --- a/chrome/browser/plugin_carbon_interpose_mac.cc +++ b/chrome/browser/plugin_carbon_interpose_mac.cc @@ -9,8 +9,10 @@ namespace webkit_glue { -void NotifyBrowserOfPluginSelectWindow(uint32 window_id, CGRect bounds); -void NotifyBrowserOfPluginShowWindow(uint32 window_id, CGRect bounds); +void NotifyBrowserOfPluginSelectWindow(uint32 window_id, CGRect bounds, + bool modal); +void NotifyBrowserOfPluginShowWindow(uint32 window_id, CGRect bounds, + bool modal); void NotifyBrowserOfPluginHideWindow(uint32 window_id, CGRect bounds); void NotifyBrowserOfPluginDisposeWindow(uint32 window_id, CGRect bounds); @@ -75,6 +77,14 @@ static void MaybeReactivateSavedProcess() { SwitchToSavedProcess(); } +// Returns true if the given window is modal. +static bool IsModalWindow(WindowRef window) { + WindowModality modality = kWindowModalityNone; + WindowRef modal_target = NULL; + OSStatus status = GetWindowModality(window, &modality, &modal_target); + return (status == noErr) && (modality != kWindowModalityNone); +} + #pragma mark - static Boolean ChromePluginIsWindowHilited(WindowRef window) { @@ -100,14 +110,16 @@ static void ChromePluginSelectWindow(WindowRef window) { SwitchToPluginProcess(); SelectWindow(window); webkit_glue::NotifyBrowserOfPluginSelectWindow(HIWindowGetCGWindowID(window), - CGRectForWindow(window)); + CGRectForWindow(window), + IsModalWindow(window)); } static void ChromePluginShowWindow(WindowRef window) { SwitchToPluginProcess(); ShowWindow(window); webkit_glue::NotifyBrowserOfPluginShowWindow(HIWindowGetCGWindowID(window), - CGRectForWindow(window)); + CGRectForWindow(window), + IsModalWindow(window)); } static void ChromePluginDisposeWindow(WindowRef window) { |