Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/browser/renderer_context_menu/spelling_options_submenu_observer.cc

Issue 2254533003: Rename spellcheck::pref::kEnableContinuousSpellcheck to ...::kEnableSpellcheck (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/spelling_options_submenu_observer .h" 5 #include "chrome/browser/renderer_context_menu/spelling_options_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 "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 size_t dictionary_index = 130 size_t dictionary_index =
131 static_cast<size_t>(command_id - IDC_SPELLCHECK_LANGUAGES_FIRST); 131 static_cast<size_t>(command_id - IDC_SPELLCHECK_LANGUAGES_FIRST);
132 return dictionaries_[dictionary_index].used_for_spellcheck; 132 return dictionaries_[dictionary_index].used_for_spellcheck;
133 } 133 }
134 134
135 // Check box for 'Check Spelling while typing'. 135 // Check box for 'Check Spelling while typing'.
136 if (command_id == IDC_CHECK_SPELLING_WHILE_TYPING) { 136 if (command_id == IDC_CHECK_SPELLING_WHILE_TYPING) {
137 Profile* profile = Profile::FromBrowserContext(proxy_->GetBrowserContext()); 137 Profile* profile = Profile::FromBrowserContext(proxy_->GetBrowserContext());
138 return profile->GetPrefs()->GetBoolean( 138 return profile->GetPrefs()->GetBoolean(
139 spellcheck::prefs::kEnableContinuousSpellcheck); 139 spellcheck::prefs::kEnableSpellcheck);
140 } 140 }
141 141
142 return false; 142 return false;
143 } 143 }
144 144
145 bool SpellingOptionsSubMenuObserver::IsCommandIdEnabled(int command_id) { 145 bool SpellingOptionsSubMenuObserver::IsCommandIdEnabled(int command_id) {
146 DCHECK(IsCommandIdSupported(command_id)); 146 DCHECK(IsCommandIdSupported(command_id));
147 147
148 Profile* profile = Profile::FromBrowserContext(proxy_->GetBrowserContext()); 148 Profile* profile = Profile::FromBrowserContext(proxy_->GetBrowserContext());
149 DCHECK(profile); 149 DCHECK(profile);
150 const PrefService* pref = profile->GetPrefs(); 150 const PrefService* pref = profile->GetPrefs();
151 if ((command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST && 151 if ((command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
152 command_id < IDC_SPELLCHECK_LANGUAGES_LAST) || 152 command_id < IDC_SPELLCHECK_LANGUAGES_LAST) ||
153 command_id == IDC_SPELLCHECK_MULTI_LINGUAL) { 153 command_id == IDC_SPELLCHECK_MULTI_LINGUAL) {
154 return pref->GetBoolean(spellcheck::prefs::kEnableContinuousSpellcheck); 154 return pref->GetBoolean(spellcheck::prefs::kEnableSpellcheck);
155 } 155 }
156 156
157 switch (command_id) { 157 switch (command_id) {
158 case IDC_CHECK_SPELLING_WHILE_TYPING: 158 case IDC_CHECK_SPELLING_WHILE_TYPING:
159 case IDC_SPELLCHECK_MENU: 159 case IDC_SPELLCHECK_MENU:
160 return true; 160 return true;
161 } 161 }
162 162
163 return false; 163 return false;
164 } 164 }
(...skipping 13 matching lines...) Expand all
178 StringListPrefMember dictionaries_pref; 178 StringListPrefMember dictionaries_pref;
179 dictionaries_pref.Init(spellcheck::prefs::kSpellCheckDictionaries, 179 dictionaries_pref.Init(spellcheck::prefs::kSpellCheckDictionaries,
180 profile->GetPrefs()); 180 profile->GetPrefs());
181 dictionaries_pref.SetValue({dictionaries_[dictionary_index].language}); 181 dictionaries_pref.SetValue({dictionaries_[dictionary_index].language});
182 return; 182 return;
183 } 183 }
184 184
185 switch (command_id) { 185 switch (command_id) {
186 case IDC_CHECK_SPELLING_WHILE_TYPING: 186 case IDC_CHECK_SPELLING_WHILE_TYPING:
187 profile->GetPrefs()->SetBoolean( 187 profile->GetPrefs()->SetBoolean(
188 spellcheck::prefs::kEnableContinuousSpellcheck, 188 spellcheck::prefs::kEnableSpellcheck,
189 !profile->GetPrefs()->GetBoolean( 189 !profile->GetPrefs()->GetBoolean(
190 spellcheck::prefs::kEnableContinuousSpellcheck)); 190 spellcheck::prefs::kEnableSpellcheck));
191 break; 191 break;
192 192
193 case IDC_SPELLCHECK_MULTI_LINGUAL: 193 case IDC_SPELLCHECK_MULTI_LINGUAL:
194 StringListPrefMember dictionaries_pref; 194 StringListPrefMember dictionaries_pref;
195 dictionaries_pref.Init(spellcheck::prefs::kSpellCheckDictionaries, 195 dictionaries_pref.Init(spellcheck::prefs::kSpellCheckDictionaries,
196 profile->GetPrefs()); 196 profile->GetPrefs());
197 std::vector<std::string> all_languages; 197 std::vector<std::string> all_languages;
198 for (const auto& dictionary : dictionaries_) 198 for (const auto& dictionary : dictionaries_)
199 all_languages.push_back(dictionary.language); 199 all_languages.push_back(dictionary.language);
200 dictionaries_pref.SetValue(all_languages); 200 dictionaries_pref.SetValue(all_languages);
201 break; 201 break;
202 } 202 }
203 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698