summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/plugin_carbon_interpose_mac.cc25
-rw-r--r--chrome/browser/plugin_process_host.cc20
-rw-r--r--chrome/browser/plugin_process_host.h11
-rw-r--r--chrome/browser/plugin_process_host_mac.cc43
4 files changed, 99 insertions, 0 deletions
diff --git a/chrome/browser/plugin_carbon_interpose_mac.cc b/chrome/browser/plugin_carbon_interpose_mac.cc
index 315cdfa..0443476 100644
--- a/chrome/browser/plugin_carbon_interpose_mac.cc
+++ b/chrome/browser/plugin_carbon_interpose_mac.cc
@@ -4,8 +4,18 @@
#include <Carbon/Carbon.h>
+#include "base/gfx/rect.h"
#include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h"
+namespace webkit_glue {
+
+void NotifyBrowserOfPluginSelectWindow(uint32 window_id, CGRect bounds);
+void NotifyBrowserOfPluginShowWindow(uint32 window_id, CGRect bounds);
+void NotifyBrowserOfPluginHideWindow(uint32 window_id, CGRect bounds);
+void NotifyBrowserOfPluginDisposeWindow(uint32 window_id, CGRect bounds);
+
+}
+
// The process that was frontmost when a plugin created a new window; generally
// we expect this to be the browser UI process.
static ProcessSerialNumber g_saved_front_process = { 0, 0 };
@@ -64,23 +74,38 @@ static Boolean ChromePluginIsWindowHilited(WindowRef window) {
return isHilited;
}
+static CGRect CGRectForWindow(WindowRef window) {
+ CGRect bounds = { { 0, 0 }, { 0, 0 } };
+ HIWindowGetBounds(window, kWindowContentRgn, kHICoordSpace72DPIGlobal,
+ &bounds);
+ return bounds;
+}
+
static void ChromePluginSelectWindow(WindowRef window) {
SwitchToPluginProcess();
SelectWindow(window);
+ webkit_glue::NotifyBrowserOfPluginSelectWindow(HIWindowGetCGWindowID(window),
+ CGRectForWindow(window));
}
static void ChromePluginShowWindow(WindowRef window) {
SwitchToPluginProcess();
ShowWindow(window);
+ webkit_glue::NotifyBrowserOfPluginShowWindow(HIWindowGetCGWindowID(window),
+ CGRectForWindow(window));
}
static void ChromePluginDisposeWindow(WindowRef window) {
SwitchToSavedProcess();
+ webkit_glue::NotifyBrowserOfPluginDisposeWindow(HIWindowGetCGWindowID(window),
+ CGRectForWindow(window));
DisposeWindow(window);
}
static void ChromePluginHideWindow(WindowRef window) {
SwitchToSavedProcess();
+ webkit_glue::NotifyBrowserOfPluginHideWindow(HIWindowGetCGWindowID(window),
+ CGRectForWindow(window));
HideWindow(window);
}
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 4c1d949..142315d 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -27,7 +27,10 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/thread.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_window.h"
#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/chrome_plugin_browsing_context.h"
#include "chrome/browser/chrome_thread.h"
@@ -325,6 +328,13 @@ PluginProcessHost::~PluginProcessHost() {
window_index++) {
PostMessage(*window_index, WM_CLOSE, 0, 0);
}
+#elif defined(OS_MACOSX)
+ // If the plugin process crashed but had windows open at the time, make
+ // sure that the menu bar is visible if the browser window is not also in
+ // fullscreen mode.
+ if (!plugin_visible_windows_set_.empty()) {
+ SetSystemUIMode(kUIModeNormal, 0);
+ }
#endif
}
@@ -477,6 +487,16 @@ void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId,
OnMapNativeViewId)
#endif
+#if defined(OS_MACOSX)
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow,
+ OnPluginSelectWindow)
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow,
+ OnPluginShowWindow)
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginHideWindow,
+ OnPluginHideWindow)
+ IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginDisposeWindow,
+ OnPluginDisposeWindow)
+#endif
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
}
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index 36f8d1e..6c5e17f 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -112,6 +112,13 @@ class PluginProcessHost : public ChildProcessHost,
void OnMapNativeViewId(gfx::NativeViewId id, gfx::PluginWindowHandle* output);
#endif
+#if defined(OS_MACOSX)
+ void OnPluginSelectWindow(uint32 window_id, gfx::Rect window_rect);
+ void OnPluginShowWindow(uint32 window_id, gfx::Rect window_rect);
+ void OnPluginHideWindow(uint32 window_id, gfx::Rect window_rect);
+ void OnPluginDisposeWindow(uint32 window_id, gfx::Rect window_rect);
+#endif
+
virtual bool CanShutdown() { return sent_requests_.empty(); }
struct ChannelRequest {
@@ -143,6 +150,10 @@ class PluginProcessHost : public ChildProcessHost,
// Tracks plugin parent windows created on the UI thread.
std::set<HWND> plugin_parent_windows_set_;
#endif
+#if defined(OS_MACOSX)
+ // Tracks plugin windows currently visible
+ std::set<uint32> plugin_visible_windows_set_;
+#endif
DISALLOW_COPY_AND_ASSIGN(PluginProcessHost);
};
diff --git a/chrome/browser/plugin_process_host_mac.cc b/chrome/browser/plugin_process_host_mac.cc
new file mode 100644
index 0000000..d222880
--- /dev/null
+++ b/chrome/browser/plugin_process_host_mac.cc
@@ -0,0 +1,43 @@
+// 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.
+
+#include <Carbon/Carbon.h>
+
+#include "build/build_config.h"
+
+#include <vector>
+
+#include "base/logging.h"
+#include "chrome/browser/plugin_process_host.h"
+
+void PluginProcessHost::OnPluginSelectWindow(uint32 window_id,
+ gfx::Rect window_rect) {
+ plugin_visible_windows_set_.insert(window_id);
+}
+
+void PluginProcessHost::OnPluginShowWindow(uint32 window_id,
+ gfx::Rect window_rect) {
+ plugin_visible_windows_set_.insert(window_id);
+ CGRect window_bounds = {
+ { window_rect.x(), window_rect.y() },
+ { window_rect.width(), window_rect.height() }
+ };
+ CGRect main_display_bounds = CGDisplayBounds(CGMainDisplayID());
+ if (CGRectEqualToRect(window_bounds, main_display_bounds)) {
+ // If the plugin has just shown a window that's the same dimensions as
+ // the main display, hide the menubar so that it has the whole screen.
+ SetSystemUIMode(kUIModeAllSuppressed, kUIOptionAutoShowMenuBar);
+ }
+}
+
+void PluginProcessHost::OnPluginHideWindow(uint32 window_id,
+ gfx::Rect window_rect) {
+ plugin_visible_windows_set_.erase(window_id);
+ SetSystemUIMode(kUIModeNormal, 0);
+}
+
+void PluginProcessHost::OnPluginDisposeWindow(uint32 window_id,
+ gfx::Rect window_rect) {
+ plugin_visible_windows_set_.erase(window_id);
+}