summaryrefslogtreecommitdiffstats
path: root/views/controls/menu/menu_host_win.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 22:56:52 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-12 22:56:52 +0000
commitc999ae2b2daeb6a0e7f7446ddff39b6691590062 (patch)
treedce5402314e7f2a630caa4974233c334621c04bc /views/controls/menu/menu_host_win.cc
parent9a0a36cfbabd036540d86f1f2acc6eeef7823d16 (diff)
downloadchromium_src-c999ae2b2daeb6a0e7f7446ddff39b6691590062.zip
chromium_src-c999ae2b2daeb6a0e7f7446ddff39b6691590062.tar.gz
chromium_src-c999ae2b2daeb6a0e7f7446ddff39b6691590062.tar.bz2
Revert 92252 - Gets mouse capture to work for menus with pure views. As part of this
I moved what was in menu_host_gtk into native_widget_gtk. Gtk supports two grab types, both mouse and key. We only want key grab when showing menus. BUG=none TEST=none Review URL: http://codereview.chromium.org/7346003 TBR=sky@chromium.org Review URL: http://codereview.chromium.org/7350008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92254 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/menu_host_win.cc')
-rw-r--r--views/controls/menu/menu_host_win.cc61
1 files changed, 61 insertions, 0 deletions
diff --git a/views/controls/menu/menu_host_win.cc b/views/controls/menu/menu_host_win.cc
new file mode 100644
index 0000000..2190b29
--- /dev/null
+++ b/views/controls/menu/menu_host_win.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "views/controls/menu/menu_host_win.h"
+
+#include "views/controls/menu/menu_host_views.h"
+#include "views/controls/menu/native_menu_host_delegate.h"
+#include "views/views_delegate.h"
+
+namespace views {
+
+////////////////////////////////////////////////////////////////////////////////
+// MenuHostWin, public:
+
+MenuHostWin::MenuHostWin(internal::NativeMenuHostDelegate* delegate)
+ : NativeWidgetWin(delegate->AsNativeWidgetDelegate()),
+ delegate_(delegate) {
+}
+
+MenuHostWin::~MenuHostWin() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// MenuHostWin, NativeMenuHost implementation:
+
+void MenuHostWin::StartCapturing() {
+ SetMouseCapture();
+}
+
+NativeWidget* MenuHostWin::AsNativeWidget() {
+ return this;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// MenuHostWin, NativeWidgetWin overrides:
+
+void MenuHostWin::OnDestroy() {
+ delegate_->OnNativeMenuHostDestroy();
+ NativeWidgetWin::OnDestroy();
+}
+
+void MenuHostWin::OnCancelMode() {
+ delegate_->OnNativeMenuHostCancelCapture();
+ NativeWidgetWin::OnCancelMode();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// NativeMenuHost, public:
+
+// static
+NativeMenuHost* NativeMenuHost::CreateNativeMenuHost(
+ internal::NativeMenuHostDelegate* delegate) {
+ if (Widget::IsPureViews() &&
+ ViewsDelegate::views_delegate->GetDefaultParentView()) {
+ return new MenuHostViews(delegate);
+ }
+ return new MenuHostWin(delegate);
+}
+
+} // namespace views