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

Unified Diff: chrome/browser/ui/views/external_tab_container_win.cc

Issue 15944007: Fix cross-window focus in Chrome Frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: only open popups once Created 7 years, 7 months 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/ui/views/external_tab_container_win.h ('k') | chrome_frame/test/data/window_open.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/external_tab_container_win.cc
diff --git a/chrome/browser/ui/views/external_tab_container_win.cc b/chrome/browser/ui/views/external_tab_container_win.cc
index 37ea78648ebba97a969d68b059774199442eccd4..ca569095def892d6003b9a2d6995226708941aa8 100644
--- a/chrome/browser/ui/views/external_tab_container_win.cc
+++ b/chrome/browser/ui/views/external_tab_container_win.cc
@@ -81,6 +81,7 @@
#if defined(USE_AURA)
#include "ui/aura/root_window.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
+#include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h"
#endif
using content::BrowserThread;
@@ -230,6 +231,36 @@ class ContainerWindow : public ATL::CWindowImpl<ContainerWindow,
DISALLOW_COPY_AND_ASSIGN(ContainerWindow);
};
+
+// A specialization of DesktopRootWindowHost for an external tab container that
+// saves and restores focus as the ETC is blurred and focused. DRWHW ordinarily
+// does this during window activation and deactivation. Since the ETC is a child
+// window, it does not receive activation messages.
+class ExternalTabRootWindowHost : public views::DesktopRootWindowHostWin {
+ public:
+ ExternalTabRootWindowHost(
+ views::internal::NativeWidgetDelegate* native_widget_delegate,
+ views::DesktopNativeWidgetAura* desktop_native_widget_aura,
+ const gfx::Rect& initial_bounds)
+ : views::DesktopRootWindowHostWin(native_widget_delegate,
+ desktop_native_widget_aura,
+ initial_bounds) {}
+
+ protected:
+ // HWNDMessageHandlerDelegate methods:
+ virtual void HandleNativeFocus(HWND last_focused_window) OVERRIDE {
+ views::DesktopRootWindowHostWin::HandleNativeFocus(last_focused_window);
+ RestoreFocusOnActivate();
+ }
+
+ virtual void HandleNativeBlur(HWND focused_window) OVERRIDE {
+ SaveFocusOnDeactivate();
+ views::DesktopRootWindowHostWin::HandleNativeBlur(focused_window);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ExternalTabRootWindowHost);
+};
#endif
base::LazyInstance<ExternalTabContainerWin::PendingTabs>
@@ -304,7 +335,11 @@ bool ExternalTabContainerWin::Init(Profile* profile,
tab_container_window_ =
(new ContainerWindow(HWND_DESKTOP, params.bounds))->AsWeakPtr();
- params.native_widget = new views::DesktopNativeWidgetAura(widget_);
+ views::DesktopNativeWidgetAura* native_widget =
+ new views::DesktopNativeWidgetAura(widget_);
+ params.native_widget = native_widget;
+ params.desktop_root_window_host =
+ new ExternalTabRootWindowHost(widget_, native_widget, params.bounds);
params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
#endif
@@ -760,6 +795,12 @@ bool ExternalTabContainerWin::TakeFocus(content::WebContents* source,
return true;
}
+void ExternalTabContainerWin::WebContentsFocused(
+ content::WebContents* contents) {
+ DCHECK_EQ(tab_contents_container_->GetWebContents(), contents);
+ tab_contents_container_->OnWebContentsFocused(contents);
+}
+
void ExternalTabContainerWin::CanDownload(
RenderViewHost* render_view_host,
int request_id,
« no previous file with comments | « chrome/browser/ui/views/external_tab_container_win.h ('k') | chrome_frame/test/data/window_open.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698