#ifndef UI_TOUCH_SELECTION_TOUCH_SELECTION_MENU_RUNNER_H_
#define UI_TOUCH_SELECTION_TOUCH_SELECTION_MENU_RUNNER_H_
#include "base/memory/weak_ptr.h"
#include "ui/touch_selection/ui_touch_selection_export.h"
namespace aura {
class Window;
}
namespace gfx {
class Rect;
class Size;
}
namespace ui {
class UI_TOUCH_SELECTION_EXPORT TouchSelectionMenuClient {
public:
TouchSelectionMenuClient();
virtual ~TouchSelectionMenuClient();
virtual bool IsCommandIdEnabled(int command_id) const = 0;
virtual void ExecuteCommand(int command_id, int event_flags) = 0;
virtual void RunContextMenu() = 0;
virtual bool ShouldShowQuickMenu() = 0;
virtual std::u16string GetSelectedText() = 0;
base::WeakPtr<TouchSelectionMenuClient> GetWeakPtr();
private:
base::WeakPtrFactory<TouchSelectionMenuClient> weak_factory_{this};
};
class UI_TOUCH_SELECTION_EXPORT TouchSelectionMenuRunner {
public:
TouchSelectionMenuRunner(const TouchSelectionMenuRunner&) = delete;
TouchSelectionMenuRunner& operator=(const TouchSelectionMenuRunner&) = delete;
virtual ~TouchSelectionMenuRunner();
static TouchSelectionMenuRunner* GetInstance();
virtual bool IsMenuAvailable(
const TouchSelectionMenuClient* client) const = 0;
virtual void OpenMenu(base::WeakPtr<TouchSelectionMenuClient> client,
const gfx::Rect& anchor_rect,
const gfx::Size& handle_image_size,
aura::Window* context) = 0;
virtual void CloseMenu() = 0;
virtual bool IsRunning() const = 0;
protected:
TouchSelectionMenuRunner();
};
}
#endif