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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_win.cc

Issue 122002: Moving the WM_SETFOCUS message processing out of FocusManager (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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/tab_contents/tab_contents_view_win.h ('k') | chrome/browser/views/frame/browser_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents_view_win.cc
===================================================================
--- chrome/browser/tab_contents/tab_contents_view_win.cc (revision 18286)
+++ chrome/browser/tab_contents/tab_contents_view_win.cc (working copy)
@@ -232,25 +232,34 @@
}
void TabContentsViewWin::Focus() {
- HWND container_hwnd = GetNativeView();
- if (!container_hwnd)
+ views::FocusManager* focus_manager =
+ views::FocusManager::GetFocusManager(GetNativeView());
+
+ if (tab_contents()->interstitial_page()) {
+ tab_contents()->interstitial_page()->Focus();
return;
+ }
- views::FocusManager* focus_manager =
- views::FocusManager::GetFocusManager(container_hwnd);
- if (!focus_manager)
- return; // During testing we have no focus manager.
- views::View* v = focus_manager->GetViewForWindow(container_hwnd, true);
- DCHECK(v);
- if (v)
- v->RequestFocus();
+ if (sad_tab_.get()) {
+ sad_tab_->RequestFocus();
+ return;
+ }
+
+ RenderWidgetHostView* rwhv = tab_contents()->render_widget_host_view();
+ if (rwhv) {
+ ::SetFocus(rwhv->GetNativeView());
+ return;
+ }
+
+ // Default to focusing our HWND.
+ ::SetFocus(GetNativeView());
}
void TabContentsViewWin::SetInitialFocus() {
if (tab_contents()->FocusLocationBarByDefault())
tab_contents()->delegate()->SetFocusToLocationBar();
else
- ::SetFocus(GetNativeView());
+ Focus();
}
void TabContentsViewWin::StoreFocus() {
@@ -316,6 +325,10 @@
drop_target_->set_is_drop_target(is_drop_target);
}
+void TabContentsViewWin::GotFocus() {
+ tab_contents()->delegate()->TabContentsFocused(tab_contents());
+}
+
void TabContentsViewWin::TakeFocus(bool reverse) {
if (!tab_contents()->delegate()->TakeFocus(reverse)) {
views::FocusManager* focus_manager =
@@ -485,19 +498,6 @@
return 0;
}
-void TabContentsViewWin::OnSetFocus(HWND window) {
- // TODO(jcampan): figure out why removing this prevents tabs opened in the
- // background from properly taking focus.
- // We NULL-check the render_view_host_ here because Windows can send us
- // messages during the destruction process after it has been destroyed.
- if (tab_contents()->render_widget_host_view()) {
- HWND inner_hwnd =
- tab_contents()->render_widget_host_view()->GetNativeView();
- if (::IsWindow(inner_hwnd))
- ::SetFocus(inner_hwnd);
- }
-}
-
void TabContentsViewWin::OnVScroll(int scroll_type, short position,
HWND scrollbar) {
ScrollCommon(WM_VSCROLL, scroll_type, position, scrollbar);
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view_win.h ('k') | chrome/browser/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698