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 22 matching lines...) Expand all Loading... |
33 language_group_(group), | 33 language_group_(group), |
34 language_selected_(0) { | 34 language_selected_(0) { |
35 DCHECK(proxy_); | 35 DCHECK(proxy_); |
36 } | 36 } |
37 | 37 |
38 SpellCheckerSubMenuObserver::~SpellCheckerSubMenuObserver() { | 38 SpellCheckerSubMenuObserver::~SpellCheckerSubMenuObserver() { |
39 } | 39 } |
40 | 40 |
41 void SpellCheckerSubMenuObserver::InitMenu( | 41 void SpellCheckerSubMenuObserver::InitMenu( |
42 const content::ContextMenuParams& params) { | 42 const content::ContextMenuParams& params) { |
43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 43 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
44 | 44 |
45 // Add available spell-checker languages to the sub menu. | 45 // Add available spell-checker languages to the sub menu. |
46 content::BrowserContext* browser_context = proxy_->GetBrowserContext(); | 46 content::BrowserContext* browser_context = proxy_->GetBrowserContext(); |
47 DCHECK(browser_context); | 47 DCHECK(browser_context); |
48 language_selected_ = | 48 language_selected_ = |
49 SpellcheckService::GetSpellCheckLanguages(browser_context, &languages_); | 49 SpellcheckService::GetSpellCheckLanguages(browser_context, &languages_); |
50 DCHECK(languages_.size() < | 50 DCHECK(languages_.size() < |
51 IDC_SPELLCHECK_LANGUAGES_LAST - IDC_SPELLCHECK_LANGUAGES_FIRST); | 51 IDC_SPELLCHECK_LANGUAGES_LAST - IDC_SPELLCHECK_LANGUAGES_FIRST); |
52 const std::string app_locale = g_browser_process->GetApplicationLocale(); | 52 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
53 for (size_t i = 0; i < languages_.size(); ++i) { | 53 for (size_t i = 0; i < languages_.size(); ++i) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 switch (command_id) { | 172 switch (command_id) { |
173 case IDC_CHECK_SPELLING_WHILE_TYPING: | 173 case IDC_CHECK_SPELLING_WHILE_TYPING: |
174 profile->GetPrefs()->SetBoolean( | 174 profile->GetPrefs()->SetBoolean( |
175 prefs::kEnableContinuousSpellcheck, | 175 prefs::kEnableContinuousSpellcheck, |
176 !profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 176 !profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
177 break; | 177 break; |
178 } | 178 } |
179 } | 179 } |
OLD | NEW |