Chromium Code Reviews| 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 #ifndef UI_BASE_COCOA_TEXT_CONTEXT_MENU_H_ | |
| 6 #define UI_BASE_COCOA_TEXT_CONTEXT_MENU_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/strings/sys_string_conversions.h" | |
| 10 #include "ui/base/models/simple_menu_model.h" | |
| 11 | |
| 12 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.
| |
| 13 public: | |
| 14 class UI_BASE_EXPORT Delegate { | |
| 15 public: | |
| 16 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.
| |
| 17 }; | |
| 18 | |
| 19 TextContextMenu(Delegate* delegate); | |
|
tapted
2016/07/22 03:06:42
explicit
spqchan
2016/12/12 19:32:27
Done.
| |
| 20 | |
| 21 void AppendToContextMenu(ui::SimpleMenuModel* model); | |
| 22 | |
| 23 static void SpeakText(const base::string16& text); | |
| 24 static void StopSpeaking(); | |
| 25 | |
| 26 static bool SupportsSpeech(); | |
| 27 static bool IsSpeaking(); | |
| 28 | |
| 29 // SimpleMenuModel::Delegate implementation. | |
| 30 void ExecuteCommand(int command_id, int event_flags) override; | |
| 31 bool IsCommandIdChecked(int command_id) const override; | |
| 32 bool IsCommandIdEnabled(int command_id) const override; | |
| 33 | |
| 34 protected: | |
| 35 bool GetAcceleratorForCommandId(int command_id, | |
| 36 ui::Accelerator* accelerator) override; | |
| 37 | |
| 38 private: | |
| 39 // Model for the "Speech" submenu. | |
| 40 ui::SimpleMenuModel speech_submenu_model_; | |
| 41 | |
| 42 Delegate* delegate_; // weak | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(TextContextMenu); | |
| 45 }; | |
| 46 | |
| 47 #endif // UI_BASE_COCOA_TEXT_CONTEXT_MENU_H_ | |
| OLD | NEW |