| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, | 76 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, |
| 77 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE)); | 77 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE)); |
| 78 | 78 |
| 79 // Add a check item "Automatically correct spelling". | 79 // Add a check item "Automatically correct spelling". |
| 80 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 80 const base::CommandLine* command_line = |
| 81 base::CommandLine::ForCurrentProcess(); |
| 81 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) { | 82 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) { |
| 82 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE, | 83 submenu_model_.AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE, |
| 83 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT)); | 84 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT)); |
| 84 } | 85 } |
| 85 | 86 |
| 86 proxy_->AddSubMenu( | 87 proxy_->AddSubMenu( |
| 87 IDC_SPELLCHECK_MENU, | 88 IDC_SPELLCHECK_MENU, |
| 88 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), | 89 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), |
| 89 &submenu_model_); | 90 &submenu_model_); |
| 90 } | 91 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 170 } |
| 170 | 171 |
| 171 switch (command_id) { | 172 switch (command_id) { |
| 172 case IDC_CHECK_SPELLING_WHILE_TYPING: | 173 case IDC_CHECK_SPELLING_WHILE_TYPING: |
| 173 profile->GetPrefs()->SetBoolean( | 174 profile->GetPrefs()->SetBoolean( |
| 174 prefs::kEnableContinuousSpellcheck, | 175 prefs::kEnableContinuousSpellcheck, |
| 175 !profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 176 !profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
| 176 break; | 177 break; |
| 177 } | 178 } |
| 178 } | 179 } |
| OLD | NEW |