Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Unified Diff: ui/views/controls/views_text_services_context_menu.h

Issue 2164483006: [MacViews] Implemented text context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tapted's comments and added a test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/views_text_services_context_menu.h
diff --git a/ui/views/controls/views_text_services_context_menu.h b/ui/views/controls/views_text_services_context_menu.h
new file mode 100644
index 0000000000000000000000000000000000000000..855b0fde026dfccf05372c2ee6b35cefef001eee
--- /dev/null
+++ b/ui/views/controls/views_text_services_context_menu.h
@@ -0,0 +1,48 @@
+// Copyright 2016 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_CONTROLS_TEXTFIELD_VIEWS_TEXT_SERVICES_CONTEXT_MENU_H_
+#define UI_VIEWS_CONTROLS_TEXTFIELD_VIEWS_TEXT_SERVICES_CONTEXT_MENU_H_
+
+#include <memory>
msw 2017/01/26 20:59:16 nit: remove
spqchan 2017/02/01 00:32:38 I need it for std::unique_ptr. Should I use someth
msw 2017/02/01 01:52:28 Ah, I missed that; thanks for pointing it out.
+
+#include "base/i18n/rtl.h"
+#include "ui/views/views_export.h"
msw 2017/01/26 20:59:16 nit: remove if export isn't needed
spqchan 2017/02/01 00:32:38 Done.
+
+namespace ui {
+class SimpleMenuModel;
+}
+
+namespace views {
+
+class Textfield;
+
+// This class is used to add and handle text service items in the text context
+// menu.
+class ViewsTextServicesContextMenu {
+ public:
+ virtual ~ViewsTextServicesContextMenu() {}
+
+ // Creates a ViewsTextContextMenu object.
msw 2017/01/26 20:59:16 nit: ViewsTextServicesContextMenu
spqchan 2017/02/01 00:32:38 Done.
+ static std::unique_ptr<ViewsTextServicesContextMenu> Create(
+ ui::SimpleMenuModel* menu,
+ Textfield* textfield);
+
+ // Returns true if the given |command_id| is handled by the menu.
+ virtual bool HandlesCommandId(int command_id) const = 0;
+
+ // Methods associated with SimpleMenuModel::Delegate.
+ virtual bool IsCommandIdChecked(int command_id) const = 0;
+ virtual bool IsCommandIdEnabled(int command_id) const = 0;
+ virtual void ExecuteCommand(int command_id, int event_flags) = 0;
+
+ // Exposed for testing. Returns true if the text direction BiDi submenu
+ // item should be checked.
+ virtual bool IsTextDirectionItemChecked(
msw 2017/01/26 20:59:16 nit: IsTextDirectionItemCheckedForTest[ing]
spqchan 2017/02/01 00:32:38 Done.
+ base::i18n::TextDirection direction) const = 0;
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_CONTROLS_TEXTFIELD_VIEWS_TEXT_SERVICES_CONTEXT_MENU_H_

Powered by Google App Engine
This is Rietveld 408576698