From 941e455373dbbe837fe2e82d139af4dec1d35ddb Mon Sep 17 00:00:00 2001 From: "stuartmorgan@chromium.org" Date: Mon, 1 Feb 2010 21:23:43 +0000 Subject: Add tab switch notification to the Mac plugin plumbing. Using the new notification: - Update plugin clip rect when it's not in a visible tab. - Update plugin idle event rate when it's not in a visible tab. - Switch the unfocus-on-tab-switch event to be based on the this new notification, instead of a browser-level broadcast. Related changes: - Stop sending redundant focus events to plugins. - Send window activation to Carbon event plugins too, not just Cocoa. - Now that plugins are getting window and tab de-focus events directly, remove the older hack to force all plugins to lose focus any window or tab loses focus. BUG=29371, 32229, 30838 TEST=Flash should still only register keystrokes when it is in the active window+tab. Plugins in background tabs should use less CPU. Review URL: http://codereview.chromium.org/548224 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37743 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/plugins/webplugin_delegate_impl.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'webkit/glue/plugins/webplugin_delegate_impl.h') diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index ce19bb5..eb05e27 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -119,14 +119,11 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { static WebPluginDelegateImpl* GetActiveDelegate(); // Returns a vector of currently active delegates in this process. static std::set GetActiveDelegates(); - // Informs the delegate which plugin instance has just received keyboard focus - // so that it can notify the plugin as appropriate. If |process_id| and - // |instance_id| are both 0, this signifies that no plugin has keyboard - // focus. - void FocusNotify(WebPluginDelegateImpl* focused_delegate); + // Informs the delegate that it has gained or lost focus. + void FocusChanged(bool has_focus); // Set a notifier function that gets called when the delegate is accepting // the focus. If no notifier function has been set, the delegate will just - // call FocusNotify(this). This is used in a multiprocess environment to + // call FocusChanged(true). This is used in a multiprocess environment to // propagate focus notifications to all running plugin processes. void SetFocusNotifier(void (*notifier)(WebPluginDelegateImpl*)) { focus_notifier_ = notifier; @@ -135,6 +132,8 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { void SetWindowHasFocus(bool has_focus); // Returns whether or not the window the plugin is in has focus. bool GetWindowHasFocus() const { return containing_window_has_focus_; } + // Informs the plugin that its tab has been hidden or shown. + void SetContainerVisibility(bool is_visible); // Informs the delegate that the plugin set a Carbon ThemeCursor. void SetThemeCursor(ThemeCursor cursor); // Informs the delegate that the plugin set a Carbon Cursor. @@ -362,6 +361,8 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { void (*focus_notifier_)(WebPluginDelegateImpl* notifier); bool containing_window_has_focus_; + bool container_is_visible_; + bool have_called_set_window_; #endif // Called by the message filter hook when the plugin enters a modal loop. -- cgit v1.1