| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" | 5 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" | 10 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 IDS_CONTENT_CONTEXT_HIDE_SPELLING_PANEL : | 47 IDS_CONTENT_CONTEXT_HIDE_SPELLING_PANEL : |
| 48 IDS_CONTENT_CONTEXT_SHOW_SPELLING_PANEL)); | 48 IDS_CONTENT_CONTEXT_SHOW_SPELLING_PANEL)); |
| 49 submenu_model_.AddSeparator(); | 49 submenu_model_.AddSeparator(); |
| 50 | 50 |
| 51 // Add a 'Check Spelling While Typing' item in the sub menu. | 51 // Add a 'Check Spelling While Typing' item in the sub menu. |
| 52 submenu_model_.AddCheckItem( | 52 submenu_model_.AddCheckItem( |
| 53 IDC_CHECK_SPELLING_OF_THIS_FIELD, | 53 IDC_CHECK_SPELLING_OF_THIS_FIELD, |
| 54 l10n_util::GetStringUTF16( | 54 l10n_util::GetStringUTF16( |
| 55 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); | 55 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); |
| 56 | 56 |
| 57 // Add an item that opens the 'fonts and languages options' page. | |
| 58 submenu_model_.AddSeparator(); | |
| 59 submenu_model_.AddItemWithStringId( | |
| 60 IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS, | |
| 61 IDS_CONTENT_CONTEXT_LANGUAGE_SETTINGS); | |
| 62 | |
| 63 proxy_->AddSubMenu( | 57 proxy_->AddSubMenu( |
| 64 IDC_SPELLCHECK_MENU, | 58 IDC_SPELLCHECK_MENU, |
| 65 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), | 59 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), |
| 66 &submenu_model_); | 60 &submenu_model_); |
| 67 } | 61 } |
| 68 | 62 |
| 69 bool SpellCheckerSubMenuObserver::IsCommandIdSupported(int command_id) { | 63 bool SpellCheckerSubMenuObserver::IsCommandIdSupported(int command_id) { |
| 70 switch (command_id) { | 64 switch (command_id) { |
| 71 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: | 65 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: |
| 72 // Return false so RenderViewContextMenu can handle this item because it | 66 // Return false so RenderViewContextMenu can handle this item because it |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 case IDC_CHECK_SPELLING_OF_THIS_FIELD: | 121 case IDC_CHECK_SPELLING_OF_THIS_FIELD: |
| 128 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); | 122 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); |
| 129 break; | 123 break; |
| 130 | 124 |
| 131 case IDC_SPELLPANEL_TOGGLE: | 125 case IDC_SPELLPANEL_TOGGLE: |
| 132 rvh->Send(new SpellCheckMsg_ToggleSpellPanel( | 126 rvh->Send(new SpellCheckMsg_ToggleSpellPanel( |
| 133 rvh->routing_id(), SpellCheckerPlatform::SpellingPanelVisible())); | 127 rvh->routing_id(), SpellCheckerPlatform::SpellingPanelVisible())); |
| 134 break; | 128 break; |
| 135 } | 129 } |
| 136 } | 130 } |
| OLD | NEW |