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_VIEWS_CONTROLS_VIEWS_TEXT_SERVICES_CONTEXT_MENU_MAC_H_ | |
tapted
2016/12/13 05:11:24
Is this header required?
(can all of ViewsTextSer
spqchan
2016/12/15 23:29:02
Done.
| |
6 #define UI_VIEWS_CONTROLS_VIEWS_TEXT_SERVICES_CONTEXT_MENU_MAC_H_ | |
7 | |
8 #include "ui/base/cocoa/text_services_context_menu.h" | |
9 #include "ui/views/controls/views_text_services_context_menu.h" | |
10 | |
11 namespace ui { | |
12 class SimpleMenuModel; | |
13 class TextInputClient; | |
14 } | |
15 | |
16 namespace views { | |
17 | |
18 class View; | |
19 class WordLookupClient; | |
20 | |
21 // This class serves as a bridge to TextServicesContextMenu to add and handle | |
22 // text service items in the context menu. The items include Speech, Look Up | |
23 // and BiDi. | |
24 class ViewsTextServicesContextMenuMac | |
25 : public ViewsTextServicesContextMenu, | |
26 public ui::TextServicesContextMenu::Delegate { | |
27 public: | |
28 explicit ViewsTextServicesContextMenuMac(ui::TextInputClient* text_client, | |
tapted
2016/12/13 05:11:24
nit: explicit not required
spqchan
2016/12/15 23:29:01
Done.
| |
29 WordLookupClient* lookup_client, | |
30 ui::SimpleMenuModel* menu, | |
31 View* view); | |
32 ~ViewsTextServicesContextMenuMac() override; | |
33 | |
34 // ViewsTextContextMenu: | |
tapted
2016/12/13 05:11:24
ViewsTextServicesContextMenu:
spqchan
2016/12/15 23:29:02
Done.
| |
35 bool ShouldUpdateMenu() const override; | |
36 bool IsTextServicesCommandId(int command_id) const override; | |
37 void ExecuteCommand(int command_id, int event_flags) override; | |
38 bool IsCommandIdChecked(int command_id) const override; | |
39 bool IsCommandIdEnabled(int command_id) const override; | |
40 | |
41 // TextServicesContextMenu::Delegate | |
tapted
2016/12/13 05:11:24
nit: colon at end
spqchan
2016/12/15 23:29:01
Done.
| |
42 base::string16 GetSelectedText() const override; | |
43 void OnSpeakRequested() override; | |
44 bool IsLookUpAvailable() const override; | |
45 void LookUpInDictionary() override; | |
46 bool IsWritingDirectionEnabled(ui::WritingDirection direction) const override; | |
47 bool IsWritingDirectionChecked(ui::WritingDirection direction) const override; | |
48 void UpdateTextDirection(ui::WritingDirection direction) override; | |
49 | |
50 private: | |
51 // Used to retrieve the selected text. Weak. | |
52 ui::TextInputClient* text_client_; | |
53 | |
54 // Used to retrieve the decorated text for Look Up. Weak. | |
55 WordLookupClient* lookup_client_; | |
tapted
2016/12/13 05:11:24
I think text_client_ and lookup_client_ will both
spqchan
2016/12/15 23:29:01
Done.
| |
56 | |
57 // Appends and handles the text service menu. | |
58 ui::TextServicesContextMenu menu_; | |
59 | |
60 // The view associated with the menu. Weak. | |
61 View* view_; | |
tapted
2016/12/13 05:11:24
ah, this is probably the TextField too?
spqchan
2016/12/15 23:29:01
Done.
| |
62 | |
63 // The selected text that appears in the context menu. This is used to | |
64 // determine if the context menu needs to updated. | |
tapted
2016/12/13 05:11:24
insert "be" -> "needs to be updated"
spqchan
2016/12/15 23:29:02
Done.
| |
65 base::string16 selection_text_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(ViewsTextServicesContextMenuMac); | |
68 }; | |
69 | |
70 } // namespace views | |
71 | |
72 #endif // UI_VIEWS_CONTROLS_VIEWS_TEXT_SERVICES_CONTEXT_MENU_MAC_H_ | |
OLD | NEW |