summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 19:38:21 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 19:38:21 +0000
commit29df0bbe6c78373c3d8c1949ab0e900eee99f727 (patch)
tree8ad53f3e52ab322346dd15a6550c5acfc9e49e85 /chrome/browser/dom_ui
parent0f3db35be89698ea3f6affd469ec372dbf1fe23b (diff)
downloadchromium_src-29df0bbe6c78373c3d8c1949ab0e900eee99f727.zip
chromium_src-29df0bbe6c78373c3d8c1949ab0e900eee99f727.tar.gz
chromium_src-29df0bbe6c78373c3d8c1949ab0e900eee99f727.tar.bz2
Making window.focus()/blur() work only when there is a user gesture.
Also making window.focus() select tab if it is not visible. The RenderViewHost now calls ActivateContent and the new DeactivateContent (instead of using the recently added TabContentsDelegate::Activate/Deactivate methods which have been removed). BUG=29643,52346 TEST=Create a page with buttons that call window.focus()/blur() directly and with a timeout. When called directly, the calls should succeed (the browser should be activated/deactivated). When called with a timeout, nothing should happen. Also test that a popup calling window.opener.focus() cause the opening tab to become selected when it is not the current tab. Review URL: http://codereview.chromium.org/3156016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc5
-rw-r--r--chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
index 8bec35f..be32f7f 100644
--- a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
+++ b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
@@ -76,6 +76,11 @@ void HtmlDialogTabContentsDelegate::ActivateContents(TabContents* contents) {
// this frame and we don't have a TabStripModel.
}
+void HtmlDialogTabContentsDelegate::DeactivateContents(TabContents* contents) {
+ // We don't care about this notification (called when a user gesture triggers
+ // a call to window.blur()).
+}
+
void HtmlDialogTabContentsDelegate::LoadingStateChanged(TabContents* source) {
// We don't care about this notification.
}
diff --git a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h
index 1c5cca0..4b68a9f 100644
--- a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h
+++ b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h
@@ -48,6 +48,7 @@ class HtmlDialogTabContentsDelegate : public TabContentsDelegate {
const gfx::Rect& initial_pos,
bool user_gesture);
virtual void ActivateContents(TabContents* contents);
+ virtual void DeactivateContents(TabContents* contents);
virtual void LoadingStateChanged(TabContents* source);
virtual void CloseContents(TabContents* source);
virtual bool IsPopup(const TabContents* source) const;