[Ozone-DRM] Add unittest to validate the mode used in mirror mode
[chromium-blink-merge.git] / ui / touch_selection / touch_selection_menu_runner.h
blob8db3213658eaf2dbebcf2b2a6f9daf5cb7202f8d
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"
11 namespace aura {
12 class Window;
15 namespace gfx {
16 class Rect;
17 class Size;
20 namespace ui {
22 // Client interface for TouchSelectionMenuRunner.
23 class UI_TOUCH_SELECTION_EXPORT TouchSelectionMenuClient {
24 public:
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
33 // time.
34 virtual void RunContextMenu() = 0;
37 // An interface for the singleton object responsible for running touch selection
38 // quick menu.
39 class UI_TOUCH_SELECTION_EXPORT TouchSelectionMenuRunner {
40 public:
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;
56 protected:
57 TouchSelectionMenuRunner();
59 private:
60 DISALLOW_COPY_AND_ASSIGN(TouchSelectionMenuRunner);
63 } // namespace ui
65 #endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_MENU_RUNNER_H_