OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_OPTIONS_SUBMENU_OBSERVER_H
_ |
| 6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_OPTIONS_SUBMENU_OBSERVER_H
_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/compiler_specific.h" |
| 12 #include "components/renderer_context_menu/render_view_context_menu_observer.h" |
| 13 #include "ui/base/models/simple_menu_model.h" |
| 14 |
| 15 class RenderViewContextMenuProxy; |
| 16 |
| 17 // A class that implements the 'spell-checker options' submenu. This class |
| 18 // creates the submenu, adds it to the parent menu, and handles events. |
| 19 class SpellingOptionsSubMenuObserver : public RenderViewContextMenuObserver { |
| 20 public: |
| 21 SpellingOptionsSubMenuObserver(RenderViewContextMenuProxy* proxy, |
| 22 ui::SimpleMenuModel::Delegate* delegate, |
| 23 int group_id); |
| 24 ~SpellingOptionsSubMenuObserver() override; |
| 25 |
| 26 // RenderViewContextMenuObserver implementation. |
| 27 void InitMenu(const content::ContextMenuParams& params) override; |
| 28 bool IsCommandIdSupported(int command_id) override; |
| 29 bool IsCommandIdChecked(int command_id) override; |
| 30 bool IsCommandIdEnabled(int command_id) override; |
| 31 void ExecuteCommand(int command_id) override; |
| 32 |
| 33 private: |
| 34 // The interface for adding a submenu to the parent. |
| 35 RenderViewContextMenuProxy* proxy_; |
| 36 |
| 37 // The submenu of the 'spell-checker options'. This class adds items to this |
| 38 // submenu and adds it to the parent menu. |
| 39 ui::SimpleMenuModel submenu_model_; |
| 40 |
| 41 // The ID of radio items representing languages available for spellchecking. |
| 42 int language_group_id_; |
| 43 |
| 44 // The number of languages currently selected for spellchecking, which are |
| 45 // also the first elements in |languages_|. |
| 46 size_t num_selected_languages_; |
| 47 |
| 48 // A vector of all languages available for spellchecking. |
| 49 std::vector<std::string> languages_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(SpellingOptionsSubMenuObserver); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_OPTIONS_SUBMENU_OBSERVE
R_H_ |
OLD | NEW |