1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_TOUCH_SELECTION_TOUCH_SELECTION_MENU_RUNNER_H_
6 #define UI_TOUCH_SELECTION_TOUCH_SELECTION_MENU_RUNNER_H_
8 #include "base/macros.h"
9 #include "ui/touch_selection/ui_touch_selection_export.h"
22 // Client interface for TouchSelectionMenuRunner.
23 class UI_TOUCH_SELECTION_EXPORT TouchSelectionMenuClient
{
25 virtual ~TouchSelectionMenuClient() {}
27 virtual bool IsCommandIdEnabled(int command_id
) const = 0;
28 virtual void ExecuteCommand(int command_id
, int event_flags
) = 0;
30 // Called when the quick menu needs to run a context menu. Depending on the
31 // implementation, this may run the context menu synchronously, or request the
32 // menu to show up in which case the menu will run asynchronously at a later
34 virtual void RunContextMenu() = 0;
37 // An interface for the singleton object responsible for running touch selection
39 class UI_TOUCH_SELECTION_EXPORT TouchSelectionMenuRunner
{
41 virtual ~TouchSelectionMenuRunner();
43 static TouchSelectionMenuRunner
* GetInstance();
45 // Creates and displays the quick menu, if there is any command available.
46 // |anchor_rect| is in screen coordinates.
47 virtual void OpenMenu(TouchSelectionMenuClient
* client
,
48 const gfx::Rect
& anchor_rect
,
49 const gfx::Size
& handle_image_size
,
50 aura::Window
* context
) = 0;
52 virtual void CloseMenu() = 0;
54 virtual bool IsRunning() const = 0;
57 TouchSelectionMenuRunner();
60 DISALLOW_COPY_AND_ASSIGN(TouchSelectionMenuRunner
);
65 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_MENU_RUNNER_H_