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

Unified Diff: chrome/browser/ui/views/tab_contents/native_tab_contents_view_win.cc

Issue 7015051: Re-land: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
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;

Powered by Google App Engine
This is Rietveld 408576698