| 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/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/prefs/pref_member.h" | 10 #include "chrome/browser/prefs/pref_member.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 submenu_model_(delegate), | 30 submenu_model_(delegate), |
| 31 spellcheck_enabled_(false), | 31 spellcheck_enabled_(false), |
| 32 language_group_(group), | 32 language_group_(group), |
| 33 language_selected_(0) { | 33 language_selected_(0) { |
| 34 DCHECK(proxy_); | 34 DCHECK(proxy_); |
| 35 } | 35 } |
| 36 | 36 |
| 37 SpellCheckerSubMenuObserver::~SpellCheckerSubMenuObserver() { | 37 SpellCheckerSubMenuObserver::~SpellCheckerSubMenuObserver() { |
| 38 } | 38 } |
| 39 | 39 |
| 40 void SpellCheckerSubMenuObserver::InitMenu(const ContextMenuParams& params) { | 40 void SpellCheckerSubMenuObserver::InitMenu( |
| 41 const content::ContextMenuParams& params) { |
| 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 42 | 43 |
| 43 spellcheck_enabled_ = params.spellcheck_enabled; | 44 spellcheck_enabled_ = params.spellcheck_enabled; |
| 44 | 45 |
| 45 // Add available spell-checker languages to the sub menu. | 46 // Add available spell-checker languages to the sub menu. |
| 46 Profile* profile = proxy_->GetProfile(); | 47 Profile* profile = proxy_->GetProfile(); |
| 47 language_selected_ = | 48 language_selected_ = |
| 48 SpellCheckHost::GetSpellCheckLanguages(profile, &languages_); | 49 SpellCheckHost::GetSpellCheckLanguages(profile, &languages_); |
| 49 DCHECK(languages_.size() < | 50 DCHECK(languages_.size() < |
| 50 IDC_SPELLCHECK_LANGUAGES_LAST - IDC_SPELLCHECK_LANGUAGES_FIRST); | 51 IDC_SPELLCHECK_LANGUAGES_LAST - IDC_SPELLCHECK_LANGUAGES_FIRST); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return; | 172 return; |
| 172 } | 173 } |
| 173 | 174 |
| 174 RenderViewHost* rvh = proxy_->GetRenderViewHost(); | 175 RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
| 175 switch (command_id) { | 176 switch (command_id) { |
| 176 case IDC_CHECK_SPELLING_OF_THIS_FIELD: | 177 case IDC_CHECK_SPELLING_OF_THIS_FIELD: |
| 177 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); | 178 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); |
| 178 break; | 179 break; |
| 179 } | 180 } |
| 180 } | 181 } |
| OLD | NEW |