OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/prefs/pref_member.h" | 9 #include "chrome/browser/api/prefs/pref_member.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // Check to see if one of the spell check language ids have been clicked. | 147 // Check to see if one of the spell check language ids have been clicked. |
148 Profile* profile = proxy_->GetProfile(); | 148 Profile* profile = proxy_->GetProfile(); |
149 DCHECK(profile); | 149 DCHECK(profile); |
150 if (command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST && | 150 if (command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST && |
151 command_id < IDC_SPELLCHECK_LANGUAGES_LAST) { | 151 command_id < IDC_SPELLCHECK_LANGUAGES_LAST) { |
152 const size_t language = command_id - IDC_SPELLCHECK_LANGUAGES_FIRST; | 152 const size_t language = command_id - IDC_SPELLCHECK_LANGUAGES_FIRST; |
153 if (profile && language < languages_.size()) { | 153 if (profile && language < languages_.size()) { |
154 StringPrefMember dictionary_language; | 154 StringPrefMember dictionary_language; |
155 dictionary_language.Init(prefs::kSpellCheckDictionary, | 155 dictionary_language.Init(prefs::kSpellCheckDictionary, |
156 profile->GetPrefs(), | 156 profile->GetPrefs()); |
157 NULL); | |
158 dictionary_language.SetValue(languages_[language]); | 157 dictionary_language.SetValue(languages_[language]); |
159 } | 158 } |
160 return; | 159 return; |
161 } | 160 } |
162 | 161 |
163 content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); | 162 content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
164 switch (command_id) { | 163 switch (command_id) { |
165 case IDC_CHECK_SPELLING_WHILE_TYPING: | 164 case IDC_CHECK_SPELLING_WHILE_TYPING: |
166 profile->GetPrefs()->SetBoolean( | 165 profile->GetPrefs()->SetBoolean( |
167 prefs::kEnableSpellCheck, | 166 prefs::kEnableSpellCheck, |
168 !profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); | 167 !profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
169 if (rvh) | 168 if (rvh) |
170 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->GetRoutingID())); | 169 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->GetRoutingID())); |
171 break; | 170 break; |
172 } | 171 } |
173 } | 172 } |
OLD | NEW |