| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/renderer_context_menu/spellchecker_submenu_observer.h" | 5 #include "chrome/browser/renderer_context_menu/spellchecker_submenu_observer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 IDS_CONTENT_CONTEXT_HIDE_SPELLING_PANEL : | 54 IDS_CONTENT_CONTEXT_HIDE_SPELLING_PANEL : |
| 55 IDS_CONTENT_CONTEXT_SHOW_SPELLING_PANEL)); | 55 IDS_CONTENT_CONTEXT_SHOW_SPELLING_PANEL)); |
| 56 submenu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 56 submenu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 57 | 57 |
| 58 // Add a 'Check Spelling While Typing' item in the sub menu. | 58 // Add a 'Check Spelling While Typing' item in the sub menu. |
| 59 submenu_model_.AddCheckItem( | 59 submenu_model_.AddCheckItem( |
| 60 IDC_CHECK_SPELLING_WHILE_TYPING, | 60 IDC_CHECK_SPELLING_WHILE_TYPING, |
| 61 l10n_util::GetStringUTF16( | 61 l10n_util::GetStringUTF16( |
| 62 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); | 62 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); |
| 63 | 63 |
| 64 // Add a check item "Ask Google for spelling suggestions" item. (This class | |
| 65 // does not handle this item because the SpellingMenuObserver class handles it | |
| 66 // on behalf of this class.) | |
| 67 submenu_model_.AddCheckItem( | |
| 68 IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, | |
| 69 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE)); | |
| 70 | |
| 71 proxy_->AddSubMenu( | 64 proxy_->AddSubMenu( |
| 72 IDC_SPELLCHECK_MENU, | 65 IDC_SPELLCHECK_MENU, |
| 73 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), | 66 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), |
| 74 &submenu_model_); | 67 &submenu_model_); |
| 75 } | 68 } |
| 76 | 69 |
| 77 bool SpellCheckerSubMenuObserver::IsCommandIdSupported(int command_id) { | 70 bool SpellCheckerSubMenuObserver::IsCommandIdSupported(int command_id) { |
| 78 switch (command_id) { | 71 switch (command_id) { |
| 79 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: | 72 case IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS: |
| 80 // Return false so RenderViewContextMenu can handle this item because it | 73 // Return false so RenderViewContextMenu can handle this item because it |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 prefs::kEnableContinuousSpellcheck, | 123 prefs::kEnableContinuousSpellcheck, |
| 131 !GetPrefs(context)->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 124 !GetPrefs(context)->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
| 132 break; | 125 break; |
| 133 | 126 |
| 134 case IDC_SPELLPANEL_TOGGLE: | 127 case IDC_SPELLPANEL_TOGGLE: |
| 135 rvh->Send(new SpellCheckMsg_ToggleSpellPanel( | 128 rvh->Send(new SpellCheckMsg_ToggleSpellPanel( |
| 136 rvh->GetRoutingID(), spellcheck_mac::SpellingPanelVisible())); | 129 rvh->GetRoutingID(), spellcheck_mac::SpellingPanelVisible())); |
| 137 break; | 130 break; |
| 138 } | 131 } |
| 139 } | 132 } |
| OLD | NEW |