diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 17:01:55 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 17:01:55 +0000 |
commit | 1a2490c3e50dc17220981af077c005095af3606c (patch) | |
tree | 8e5a14c8cb6c2a13cbabb934e8b40c16c4a03c79 /views/context_menu_controller.h | |
parent | 9486d9305f26d3ecb3b7d44029c756254e75b1f2 (diff) | |
download | chromium_src-1a2490c3e50dc17220981af077c005095af3606c.zip chromium_src-1a2490c3e50dc17220981af077c005095af3606c.tar.gz chromium_src-1a2490c3e50dc17220981af077c005095af3606c.tar.bz2 |
views: Pull out ContextMenuController class into its own header file.
BUG=72040
TEST=None
R=ben@chromium.org,sky@chromium.org
Review URL: http://codereview.chromium.org/7238006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/context_menu_controller.h')
-rw-r--r-- | views/context_menu_controller.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/views/context_menu_controller.h b/views/context_menu_controller.h new file mode 100644 index 0000000..d65bb1a --- /dev/null +++ b/views/context_menu_controller.h @@ -0,0 +1,45 @@ +// 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 VIEWS_CONTEXT_MENU_CONTROLLER_H_ +#define VIEWS_CONTEXT_MENU_CONTROLLER_H_ +#pragma once + +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 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 // VIEWS_CONTEXT_MENU_CONTROLLER_H_ |