summaryrefslogtreecommitdiffstats
path: root/ui/views/context_menu_controller.h
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-30 13:24:35 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-30 13:24:35 +0000
commite73fd5d32e9206d40c4c9c016834c0ed5f09ecdf (patch)
treedf2f0d93c68ad9e732ce9811a87cff81115bd116 /ui/views/context_menu_controller.h
parentc63925ad27af4a2072c5b08a64b3bbfbc178744a (diff)
downloadchromium_src-e73fd5d32e9206d40c4c9c016834c0ed5f09ecdf.zip
chromium_src-e73fd5d32e9206d40c4c9c016834c0ed5f09ecdf.tar.gz
chromium_src-e73fd5d32e9206d40c4c9c016834c0ed5f09ecdf.tar.bz2
views: Move some random files from views/ to ui/views/.
BUG=104039 R=ben@chromium.org Review URL: http://codereview.chromium.org/8735009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/context_menu_controller.h')
-rw-r--r--ui/views/context_menu_controller.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/ui/views/context_menu_controller.h b/ui/views/context_menu_controller.h
new file mode 100644
index 0000000..577ec62
--- /dev/null
+++ b/ui/views/context_menu_controller.h
@@ -0,0 +1,47 @@
+// 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.
+
+#ifndef UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_
+#define UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_
+#pragma once
+
+#include "views/views_export.h"
+
+namespace gfx {
+class Point;
+}
+
+namespace views {
+class View;
+
+// ContextMenuController is responsible for showing the context menu for a
+// View. To use a ContextMenuController invoke set_context_menu_controller on a
+// View. When the appropriate user gesture occurs ShowContextMenu is invoked
+// on the ContextMenuController.
+//
+// Setting a ContextMenuController on a view makes the view process mouse
+// events.
+//
+// It is up to subclasses that do their own mouse processing to invoke
+// the appropriate ContextMenuController method, typically by invoking super's
+// implementation for mouse processing.
+class VIEWS_EXPORT ContextMenuController {
+ public:
+ // Invoked to show the context menu for the source view. If |is_mouse_gesture|
+ // is true, |p| is the location of the mouse. If |is_mouse_gesture| is false,
+ // this method was not invoked by a mouse gesture and |p| is the recommended
+ // location to show the menu at.
+ //
+ // |p| is in screen coordinates.
+ virtual void ShowContextMenuForView(View* source,
+ const gfx::Point& p,
+ bool is_mouse_gesture) = 0;
+
+ protected:
+ virtual ~ContextMenuController() {}
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_CONTEXT_MENU_CONTROLLER_H_