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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_member.h" | 9 #include "base/prefs/pref_member.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Add a 'Check spelling while typing' item in the sub menu. | 67 // Add a 'Check spelling while typing' item in the sub menu. |
68 submenu_model_.AddCheckItem( | 68 submenu_model_.AddCheckItem( |
69 IDC_CHECK_SPELLING_WHILE_TYPING, | 69 IDC_CHECK_SPELLING_WHILE_TYPING, |
70 l10n_util::GetStringUTF16( | 70 l10n_util::GetStringUTF16( |
71 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); | 71 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); |
72 | 72 |
73 // Add a check item "Ask Google for spelling suggestions" item. (This class | 73 // Add a check item "Ask Google for spelling suggestions" item. (This class |
74 // does not handle this item because the SpellingMenuObserver class handles it | 74 // does not handle this item because the SpellingMenuObserver class handles it |
75 // on behalf of this class.) | 75 // on behalf of this class.) |
76 #if defined(TOOLKIT_GTK) | 76 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, |
77 extensions::ViewType view_type = | 77 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE)); |
78 extensions::GetViewType(proxy_->GetWebContents()); | |
79 if (view_type != extensions::VIEW_TYPE_PANEL) { | |
80 #endif | |
81 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, | |
82 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE)); | |
83 #if defined(TOOLKIT_GTK) | |
84 } | |
85 #endif | |
86 | 78 |
87 // Add a check item "Automatically correct spelling". | 79 // Add a check item "Automatically correct spelling". |
88 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 80 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
89 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) { | 81 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) { |
90 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE, | 82 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE, |
91 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT)); | 83 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT)); |
92 } | 84 } |
93 | 85 |
94 proxy_->AddSubMenu( | 86 proxy_->AddSubMenu( |
95 IDC_SPELLCHECK_MENU, | 87 IDC_SPELLCHECK_MENU, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 169 } |
178 | 170 |
179 switch (command_id) { | 171 switch (command_id) { |
180 case IDC_CHECK_SPELLING_WHILE_TYPING: | 172 case IDC_CHECK_SPELLING_WHILE_TYPING: |
181 profile->GetPrefs()->SetBoolean( | 173 profile->GetPrefs()->SetBoolean( |
182 prefs::kEnableContinuousSpellcheck, | 174 prefs::kEnableContinuousSpellcheck, |
183 !profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 175 !profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
184 break; | 176 break; |
185 } | 177 } |
186 } | 178 } |
OLD | NEW |