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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/views/controls/textfield/views_text_context_menu_mac.h"
6
7 #include "ui/views/controls/textfield/textfield.h"
8
9 namespace views {
10
11 ViewsTextContextMenu* ViewsTextContextMenu::Create(Textfield* textfield) {
tapted 2016/07/22 03:06:42 // static
spqchan 2016/12/12 19:32:28 Done.
12 return new ViewsTextContextMenuMac(textfield);
13 }
14
15 ViewsTextContextMenuMac::ViewsTextContextMenuMac(Textfield* textfield)
16 : textfield_(textfield) {
17 menu_.reset(new TextContextMenu(this));
18 }
19
20 ViewsTextContextMenuMac::~ViewsTextContextMenuMac() {}
21
22 void ViewsTextContextMenuMac::UpdateContextMenu(ui::SimpleMenuModel* menu) {
23 menu_->AppendToContextMenu(menu);
24 }
25
26 void ViewsTextContextMenuMac::StartSpeaking() {
27 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
28 if (text.empty())
29 text = textfield_->text();
30
31 menu_->SpeakText(text);
32 }
33
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698