Index: chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h |
diff --git a/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e199e0e353379cca687bae5e138008d8c11d1c46 |
--- /dev/null |
+++ b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_OPTIONS_SUBMENU_OBSERVER_H_ |
+#define CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_OPTIONS_SUBMENU_OBSERVER_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/compiler_specific.h" |
+#include "components/renderer_context_menu/render_view_context_menu_observer.h" |
+#include "ui/base/models/simple_menu_model.h" |
+ |
+class RenderViewContextMenuProxy; |
+ |
+// A class that implements the 'spell-checker options' submenu. This class |
+// creates the submenu, adds it to the parent menu, and handles events. |
+class SpellingOptionsSubMenuObserver : public RenderViewContextMenuObserver { |
+ public: |
+ SpellingOptionsSubMenuObserver(RenderViewContextMenuProxy* proxy, |
+ ui::SimpleMenuModel::Delegate* delegate, |
+ int group_id); |
+ ~SpellingOptionsSubMenuObserver() override; |
+ |
+ // RenderViewContextMenuObserver implementation. |
+ void InitMenu(const content::ContextMenuParams& params) override; |
+ bool IsCommandIdSupported(int command_id) override; |
+ bool IsCommandIdChecked(int command_id) override; |
+ bool IsCommandIdEnabled(int command_id) override; |
+ void ExecuteCommand(int command_id) override; |
+ |
+ private: |
+ // The interface for adding a submenu to the parent. |
+ RenderViewContextMenuProxy* proxy_; |
+ |
+ // The submenu of the 'spell-checker options'. This class adds items to this |
+ // submenu and adds it to the parent menu. |
+ ui::SimpleMenuModel submenu_model_; |
+ |
+ // The ID of radio items representing languages available for spellchecking. |
+ int language_group_id_; |
+ |
+ // The number of languages currently selected for spellchecking, which are |
+ // also the first elements in |languages_|. |
+ size_t num_selected_languages_; |
+ |
+ // A vector of all languages available for spellchecking. |
+ std::vector<std::string> languages_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SpellingOptionsSubMenuObserver); |
+}; |
+ |
+#endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_OPTIONS_SUBMENU_OBSERVER_H_ |