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

Unified Diff: ui/base/cocoa/text_context_menu.h

Issue 2164483006: [MacViews] Implemented text context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ditto Created 4 years, 5 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/base/cocoa/text_context_menu.h
diff --git a/ui/base/cocoa/text_context_menu.h b/ui/base/cocoa/text_context_menu.h
new file mode 100644
index 0000000000000000000000000000000000000000..19070ee19567c474f26fa182cd964fb0cd6947d3
--- /dev/null
+++ b/ui/base/cocoa/text_context_menu.h
@@ -0,0 +1,47 @@
+// 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_BASE_COCOA_TEXT_CONTEXT_MENU_H_
+#define UI_BASE_COCOA_TEXT_CONTEXT_MENU_H_
+
+#include "base/macros.h"
+#include "base/strings/sys_string_conversions.h"
+#include "ui/base/models/simple_menu_model.h"
+
+class TextContextMenu : public ui::SimpleMenuModel::Delegate {
tapted 2016/07/22 03:06:42 Maybe TextServicesContextMenu? (also namespace ui.
spqchan 2016/12/12 19:32:27 Done.
+ public:
+ class UI_BASE_EXPORT Delegate {
+ public:
+ virtual void StartSpeaking() = 0;
tapted 2016/07/22 03:06:42 I think we should rename this to something like O
spqchan 2016/12/12 19:32:27 Done.
+ };
+
+ TextContextMenu(Delegate* delegate);
tapted 2016/07/22 03:06:42 explicit
spqchan 2016/12/12 19:32:27 Done.
+
+ void AppendToContextMenu(ui::SimpleMenuModel* model);
+
+ static void SpeakText(const base::string16& text);
+ static void StopSpeaking();
+
+ static bool SupportsSpeech();
+ static bool IsSpeaking();
+
+ // SimpleMenuModel::Delegate implementation.
+ void ExecuteCommand(int command_id, int event_flags) override;
+ bool IsCommandIdChecked(int command_id) const override;
+ bool IsCommandIdEnabled(int command_id) const override;
+
+ protected:
+ bool GetAcceleratorForCommandId(int command_id,
+ ui::Accelerator* accelerator) override;
+
+ private:
+ // Model for the "Speech" submenu.
+ ui::SimpleMenuModel speech_submenu_model_;
+
+ Delegate* delegate_; // weak
+
+ DISALLOW_COPY_AND_ASSIGN(TextContextMenu);
+};
+
+#endif // UI_BASE_COCOA_TEXT_CONTEXT_MENU_H_

Powered by Google App Engine
This is Rietveld 408576698