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

Unified Diff: ui/views/controls/textfield/views_text_context_menu_mac.cc

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/views/controls/textfield/views_text_context_menu_mac.cc
diff --git a/ui/views/controls/textfield/views_text_context_menu_mac.cc b/ui/views/controls/textfield/views_text_context_menu_mac.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f28d7a84951a00947ca450c1abfc03bddf22df45
--- /dev/null
+++ b/ui/views/controls/textfield/views_text_context_menu_mac.cc
@@ -0,0 +1,34 @@
+// 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.
+
+#include "ui/views/controls/textfield/views_text_context_menu_mac.h"
+
+#include "ui/views/controls/textfield/textfield.h"
+
+namespace views {
+
+ViewsTextContextMenu* ViewsTextContextMenu::Create(Textfield* textfield) {
tapted 2016/07/22 03:06:42 // static
spqchan 2016/12/12 19:32:28 Done.
+ return new ViewsTextContextMenuMac(textfield);
+}
+
+ViewsTextContextMenuMac::ViewsTextContextMenuMac(Textfield* textfield)
+ : textfield_(textfield) {
+ menu_.reset(new TextContextMenu(this));
+}
+
+ViewsTextContextMenuMac::~ViewsTextContextMenuMac() {}
+
+void ViewsTextContextMenuMac::UpdateContextMenu(ui::SimpleMenuModel* menu) {
+ menu_->AppendToContextMenu(menu);
+}
+
+void ViewsTextContextMenuMac::StartSpeaking() {
+ base::string16 text = textfield_->GetSelectedText();
tapted 2016/07/22 03:06:42 instead of GetSelectedText, this could use the Tex
spqchan 2016/12/12 19:32:28 Sounds good, I switched to TextInputClient and mov
+ if (text.empty())
+ text = textfield_->text();
+
+ menu_->SpeakText(text);
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698