OLD | NEW |
---|---|
(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 } | |
OLD | NEW |