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