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