diff options
author | mohsen <mohsen@chromium.org> | 2015-05-28 21:12:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-29 04:13:09 +0000 |
commit | 1d0063dd4fcc1d4ec66af570c8e41d4416649159 (patch) | |
tree | 86d0dcff66f0a7ffefda3b23456992936b9330f8 /ui/views/touchui/touch_selection_menu_runner_views.h | |
parent | 7a6acf6c7d45e24f07781c69249d90967013bbe4 (diff) | |
download | chromium_src-1d0063dd4fcc1d4ec66af570c8e41d4416649159.zip chromium_src-1d0063dd4fcc1d4ec66af570c8e41d4416649159.tar.gz chromium_src-1d0063dd4fcc1d4ec66af570c8e41d4416649159.tar.bz2 |
Refactor touch selection quick menu
To use the touch selection quick menu in the upcoming unified touch
selection, a new interface is added to ui/touch_selection with an
implementation for Views. The implementation mostly copied code from the
old implementation.
COLLABORATOR=mfomitchev
BUG=399721
Review URL: https://codereview.chromium.org/1019353003
Cr-Commit-Position: refs/heads/master@{#331924}
Diffstat (limited to 'ui/views/touchui/touch_selection_menu_runner_views.h')
-rw-r--r-- | ui/views/touchui/touch_selection_menu_runner_views.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ui/views/touchui/touch_selection_menu_runner_views.h b/ui/views/touchui/touch_selection_menu_runner_views.h new file mode 100644 index 0000000..46032ee --- /dev/null +++ b/ui/views/touchui/touch_selection_menu_runner_views.h @@ -0,0 +1,45 @@ +// Copyright 2015 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_TOUCHUI_TOUCH_SELECTION_MENU_RUNNER_VIEWS_H_ +#define UI_VIEWS_TOUCHUI_TOUCH_SELECTION_MENU_RUNNER_VIEWS_H_ + +#include "base/memory/scoped_ptr.h" +#include "ui/touch_selection/touch_selection_menu_runner.h" +#include "ui/views/views_export.h" + +namespace views { + +// Views implementation for TouchSelectionMenuRunner. +class VIEWS_EXPORT TouchSelectionMenuRunnerViews + : public ui::TouchSelectionMenuRunner { + public: + TouchSelectionMenuRunnerViews(); + ~TouchSelectionMenuRunnerViews() override; + + private: + friend class TouchSelectionMenuRunnerViewsTest; + class Menu; + + // Helper for tests. + gfx::Rect GetAnchorRectForTest() const; + + // ui::TouchSelectionMenuRunner: + void OpenMenu(ui::TouchSelectionMenuClient* client, + const gfx::Rect& anchor_rect, + const gfx::Size& handle_image_size, + aura::Window* context) override; + void CloseMenu() override; + bool IsRunning() const override; + + // A pointer to the currently running menu, or |nullptr| if no menu is + // running. The menu manages its own lifetime and deletes itself when closed. + Menu* menu_; + + DISALLOW_COPY_AND_ASSIGN(TouchSelectionMenuRunnerViews); +}; + +} // namespace views + +#endif // UI_VIEWS_TOUCHUI_TOUCH_SELECTION_MENU_RUNNER_VIEWS_H_ |