Index: chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc |
=================================================================== |
--- chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc (revision 85284) |
+++ chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc (working copy) |
@@ -30,7 +30,10 @@ |
static views::Widget* widget = NULL; |
if (!widget) { |
- widget = views::Widget::CreateWidget(); |
+ widget = new views::Widget; |
+ // We don't want this widget to be closed automatically, this causes |
+ // problems in tests that close the last non-secondary window. |
+ widget->set_is_secondary_widget(false); |
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
widget->Init(params); |
// If a background window requests focus, the hidden tab host will |
@@ -49,8 +52,8 @@ |
NativeTabContentsViewWin::NativeTabContentsViewWin( |
internal::NativeTabContentsViewDelegate* delegate) |
- : delegate_(delegate), |
- focus_manager_(NULL) { |
+ : views::WidgetWin(delegate->AsNativeWidgetDelegate()), |
+ delegate_(delegate) { |
} |
NativeTabContentsViewWin::~NativeTabContentsViewWin() { |
@@ -71,6 +74,7 @@ |
void NativeTabContentsViewWin::InitNativeTabContentsView() { |
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
+ params.native_widget = this; |
params.delete_on_destroy = false; |
params.parent = GetHiddenTabHostWindow(); |
GetWidget()->Init(params); |
@@ -82,9 +86,6 @@ |
} |
void NativeTabContentsViewWin::Unparent() { |
- // Remember who our FocusManager is, we won't be able to access it once |
- // unparented. |
- focus_manager_ = views::WidgetWin::GetFocusManager(); |
// Note that we do not DCHECK on focus_manager_ as it may be NULL when used |
// with an external tab container. |
NativeWidget::ReparentNativeView(GetNativeView(), GetHiddenTabHostWindow()); |
@@ -166,7 +167,7 @@ |
break; |
} |
case WM_MOUSEMOVE: |
- delegate_->OnNativeTabContentsViewMouseMove(); |
+ delegate_->OnNativeTabContentsViewMouseMove(true); |
break; |
default: |
break; |
@@ -186,7 +187,7 @@ |
// This message is reflected from the view() to this window. |
if (GET_KEYSTATE_WPARAM(message->wParam) & MK_CONTROL) { |
delegate_->OnNativeTabContentsViewWheelZoom( |
- GET_WHEEL_DELTA_WPARAM(message->wParam)); |
+ GET_WHEEL_DELTA_WPARAM(message->wParam) > 0); |
return 1; |
} |
break; |
@@ -263,22 +264,6 @@ |
// here since the view will draw everything correctly. |
} |
-views::FocusManager* NativeTabContentsViewWin::GetFocusManager() { |
- views::FocusManager* focus_manager = WidgetWin::GetFocusManager(); |
- if (focus_manager) { |
- // If focus_manager_ is non NULL, it means we have been reparented, in which |
- // case its value may not be valid anymore. |
- focus_manager_ = NULL; |
- return focus_manager; |
- } |
- // TODO(jcampan): we should DCHECK on focus_manager_, as it should not be |
- // NULL. We are not doing it as it breaks some unit-tests. We should |
- // probably have an empty TabContentView implementation for the unit-tests, |
- // that would prevent that code being executed in the unit-test case. |
- // DCHECK(focus_manager_); |
- return focus_manager_; |
-} |
- |
//////////////////////////////////////////////////////////////////////////////// |
// NativeTabContentsViewWin, private: |
@@ -320,7 +305,7 @@ |
break; |
} |
- delegate_->OnNativeTabContentsViewWheelZoom(distance); |
+ delegate_->OnNativeTabContentsViewWheelZoom(distance > 0); |
return true; |
} |
return false; |