Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1842)

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 399090: Mac: Simulate the OS-level focus handling that windows and linux plugins... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/plugin_process_host_mac.cc ('k') | chrome/common/plugin_messages_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 32617)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -10,12 +10,14 @@
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_trial.h"
#import "chrome/browser/cocoa/rwhvm_editcommand_helper.h"
+#include "chrome/browser/plugin_process_host.h"
#include "chrome/browser/renderer_host/backing_store.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/browser/spellchecker_platform_engine.h"
#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/edit_command.h"
+#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/WebKit/chromium/public/mac/WebInputEventFactory.h"
@@ -48,6 +50,26 @@
// Maximum number of characters we allow in a tooltip.
const size_t kMaxTooltipLength = 1024;
+class NotifyPluginProcessHostTask : public Task {
+ public:
+ NotifyPluginProcessHostTask(uint32 process_id, uint32 instance_id)
+ : process_id_(process_id), instance_id_(instance_id) { }
+
+ private:
+ void Run() {
+ for (ChildProcessHost::Iterator iter(ChildProcessInfo::PLUGIN_PROCESS);
+ !iter.Done(); ++iter) {
+ PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter);
+ uint32 plugin_pid = plugin->handle();
+ uint32 instance = (plugin_pid == process_id_) ? instance_id_ : 0;
+ plugin->Send(new PluginProcessMsg_PluginFocusNotify(instance));
+ }
+ }
+
+ uint32 process_id_;
+ uint32 instance_id_;
+};
+
}
// RenderWidgetHostView --------------------------------------------------------
@@ -134,6 +156,10 @@
// everything again when we become selected again.
is_hidden_ = true;
+ // tell any plugins that thought they had the focus that they do not now.
+ ChromeThread::PostTask(ChromeThread::IO, FROM_HERE,
+ new NotifyPluginProcessHostTask(0, 0));
+
// If we have a renderer, then inform it that we are being hidden so it can
// reduce its resource utilization.
render_widget_host_->WasHidden();
@@ -453,6 +479,10 @@
void RenderWidgetHostViewMac::SetActive(bool active) {
if (render_widget_host_)
render_widget_host_->SetActive(active);
+ if (!active)
+ // tell any plugins that thought they had the focus that they do not now.
+ ChromeThread::PostTask(ChromeThread::IO, FROM_HERE,
+ new NotifyPluginProcessHostTask(0, 0));
}
void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) {
« no previous file with comments | « chrome/browser/plugin_process_host_mac.cc ('k') | chrome/common/plugin_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698