summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-01 21:23:43 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-01 21:23:43 +0000
commit941e455373dbbe837fe2e82d139af4dec1d35ddb (patch)
tree07cfc55341b2e0a62d38f821e0ca423db7f146ce /chrome/plugin
parentb51cda7cb0bddadb1f4cca4c18eb27313300aa21 (diff)
downloadchromium_src-941e455373dbbe837fe2e82d139af4dec1d35ddb.zip
chromium_src-941e455373dbbe837fe2e82d139af4dec1d35ddb.tar.gz
chromium_src-941e455373dbbe837fe2e82d139af4dec1d35ddb.tar.bz2
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
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/plugin_thread.cc5
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc8
-rw-r--r--chrome/plugin/webplugin_delegate_stub.h1
3 files changed, 11 insertions, 3 deletions
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index fb02ac5..0a9ef12 100644
--- a/chrome/plugin/plugin_thread.cc
+++ b/chrome/plugin/plugin_thread.cc
@@ -149,14 +149,15 @@ void PluginThread::OnPluginMessage(const std::vector<unsigned char> &data) {
#if defined(OS_MACOSX)
void PluginThread::OnPluginFocusNotify(uint32 instance_id) {
- WebPluginDelegateImpl* instance =
+ WebPluginDelegateImpl* focused_instance =
reinterpret_cast<WebPluginDelegateImpl*>(instance_id);
std::set<WebPluginDelegateImpl*> active_delegates =
WebPluginDelegateImpl::GetActiveDelegates();
for (std::set<WebPluginDelegateImpl*>::iterator iter =
active_delegates.begin();
iter != active_delegates.end(); iter++) {
- (*iter)->FocusNotify(instance);
+ WebPluginDelegateImpl* instance = *iter;
+ instance->FocusChanged(instance == focused_instance);
}
}
#endif
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index 253d7cf..cf6e842 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -123,6 +123,8 @@ void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
OnSendJavaScriptStream)
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(PluginMsg_SetWindowFocus, OnSetWindowFocus)
+ IPC_MESSAGE_HANDLER(PluginMsg_SetContainerVisibility,
+ OnSetContainerVisibility)
#endif
IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse,
OnDidReceiveManualResponse)
@@ -338,7 +340,11 @@ void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url,
void WebPluginDelegateStub::OnSetWindowFocus(bool has_focus) {
delegate_->SetWindowHasFocus(has_focus);
}
-#endif
+
+void WebPluginDelegateStub::OnSetContainerVisibility(bool is_visible) {
+ delegate_->SetContainerVisibility(is_visible);
+}
+#endif // OS_MACOSX
void WebPluginDelegateStub::OnDidReceiveManualResponse(
const GURL& url,
diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h
index 5728fdd..b783832 100644
--- a/chrome/plugin/webplugin_delegate_stub.h
+++ b/chrome/plugin/webplugin_delegate_stub.h
@@ -80,6 +80,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
#if defined(OS_MACOSX)
void OnSetWindowFocus(bool has_focus);
+ void OnSetContainerVisibility(bool is_visible);
#endif
void OnDidReceiveManualResponse(