| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/spellchecker/spellcheck_host_impl.h" | 5 #include "chrome/browser/spellchecker/spellcheck_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 FilePath dict_dir; | 45 FilePath dict_dir; |
| 46 PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); | 46 PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); |
| 47 return SpellCheckCommon::GetVersionedFileName(language, dict_dir); | 47 return SpellCheckCommon::GetVersionedFileName(language, dict_dir); |
| 48 } | 48 } |
| 49 | 49 |
| 50 #if defined(OS_MACOSX) | 50 #if defined(OS_MACOSX) |
| 51 // Collect metrics on how often Hunspell is used on OS X vs the native | 51 // Collect metrics on how often Hunspell is used on OS X vs the native |
| 52 // spellchecker. | 52 // spellchecker. |
| 53 void RecordSpellCheckStats(bool native_spellchecker_used, | 53 void RecordSpellCheckStats(bool native_spellchecker_used, |
| 54 const std::string& language) { | 54 const std::string& language) { |
| 55 static std::set<std::string> languages_seen; | 55 CR_DEFINE_STATIC_LOCAL(std::set<std::string>, languages_seen, ()); |
| 56 | 56 |
| 57 // Only count a language code once for each session.. | 57 // Only count a language code once for each session.. |
| 58 if (languages_seen.find(language) != languages_seen.end()) { | 58 if (languages_seen.find(language) != languages_seen.end()) { |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 languages_seen.insert(language); | 61 languages_seen.insert(language); |
| 62 | 62 |
| 63 enum { | 63 enum { |
| 64 SPELLCHECK_OSX_NATIVE_SPELLCHECKER_USED = 0, | 64 SPELLCHECK_OSX_NATIVE_SPELLCHECKER_USED = 0, |
| 65 SPELLCHECK_HUNSPELL_USED = 1 | 65 SPELLCHECK_HUNSPELL_USED = 1 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 476 } |
| 477 | 477 |
| 478 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { | 478 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { |
| 479 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 479 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 480 | 480 |
| 481 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 481 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| 482 !i.IsAtEnd(); i.Advance()) { | 482 !i.IsAtEnd(); i.Advance()) { |
| 483 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); | 483 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); |
| 484 } | 484 } |
| 485 } | 485 } |
| OLD | NEW |