Chromium Code Reviews| 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); |
| +} |
| + |
| +} |