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_process_host_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_process_host_mac.cc')
-rw-r--r-- | chrome/browser/plugin_process_host_mac.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/chrome/browser/plugin_process_host_mac.cc b/chrome/browser/plugin_process_host_mac.cc index 6e6bb18..f003a4c 100644 --- a/chrome/browser/plugin_process_host_mac.cc +++ b/chrome/browser/plugin_process_host_mac.cc @@ -14,13 +14,19 @@ #include "chrome/browser/plugin_process_host.h" void PluginProcessHost::OnPluginSelectWindow(uint32 window_id, - gfx::Rect window_rect) { + gfx::Rect window_rect, + bool modal) { plugin_visible_windows_set_.insert(window_id); + if (modal) + plugin_modal_windows_set_.insert(window_id); } void PluginProcessHost::OnPluginShowWindow(uint32 window_id, - gfx::Rect window_rect) { + gfx::Rect window_rect, + bool modal) { plugin_visible_windows_set_.insert(window_id); + if (modal) + plugin_modal_windows_set_.insert(window_id); CGRect window_bounds = { { window_rect.x(), window_rect.y() }, { window_rect.width(), window_rect.height() } @@ -39,6 +45,7 @@ void PluginProcessHost::OnPluginShowWindow(uint32 window_id, void PluginProcessHost::OnPluginHideWindow(uint32 window_id, gfx::Rect window_rect) { plugin_visible_windows_set_.erase(window_id); + plugin_modal_windows_set_.erase(window_id); if (plugin_fullscreen_windows_set_.find(window_id) != plugin_fullscreen_windows_set_.end()) { plugin_fullscreen_windows_set_.erase(window_id); @@ -52,3 +59,15 @@ void PluginProcessHost::OnPluginDisposeWindow(uint32 window_id, gfx::Rect window_rect) { OnPluginHideWindow(window_id, window_rect); } + +void PluginProcessHost::OnAppActivation() { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); + + // If our plugin process has any modal windows up, we need to bring it forward + // so that they act more like an in-process modal window would. + if (!plugin_modal_windows_set_.empty()) { + ChromeThread::PostTask( + ChromeThread::UI, FROM_HERE, + NewRunnableFunction(mac_util::ActivateProcess, handle())); + } +} |