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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_host.cc

Issue 8890022: Remove Hunspell on OS X - step 2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename unit tests Created 9 years 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 (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.h" 5 #include "chrome/browser/spellchecker/spellcheck_host.h"
6 6
7 #include "base/string_split.h" 7 #include "base/string_split.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "chrome/browser/prefs/pref_member.h" 9 #include "chrome/browser/prefs/pref_member.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/spellchecker/spellcheck_host_impl.h" 11 #include "chrome/browser/spellchecker/spellcheck_host_impl.h"
12 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" 12 #include "chrome/browser/spellchecker/spellchecker_mac.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "chrome/common/spellcheck_common.h" 14 #include "chrome/common/spellcheck_common.h"
15 15
16 using content::BrowserThread; 16 using content::BrowserThread;
17 17
18 namespace { 18 namespace {
19 19
20 // An event used by browser tests to receive status events from this class and 20 // An event used by browser tests to receive status events from this class and
21 // its derived classes. 21 // its derived classes.
22 base::WaitableEvent* g_status_event = NULL; 22 base::WaitableEvent* g_status_event = NULL;
(...skipping 29 matching lines...) Expand all
52 profile->GetPrefs(), NULL); 52 profile->GetPrefs(), NULL);
53 std::string dictionary_language = dictionary_language_pref.GetValue(); 53 std::string dictionary_language = dictionary_language_pref.GetValue();
54 54
55 // The current dictionary language should be there. 55 // The current dictionary language should be there.
56 languages->push_back(dictionary_language); 56 languages->push_back(dictionary_language);
57 57
58 // Now scan through the list of accept languages, and find possible mappings 58 // Now scan through the list of accept languages, and find possible mappings
59 // from this list to the existing list of spell check languages. 59 // from this list to the existing list of spell check languages.
60 std::vector<std::string> accept_languages; 60 std::vector<std::string> accept_languages;
61 61
62 if (SpellCheckerPlatform::SpellCheckerAvailable()) 62 #if defined(OS_MACOSX)
63 SpellCheckerPlatform::GetAvailableLanguages(&accept_languages); 63 if (SpellCheckerMac::SpellCheckerAvailable())
64 SpellCheckerMac::GetAvailableLanguages(&accept_languages);
64 else 65 else
65 base::SplitString(accept_languages_pref.GetValue(), ',', &accept_languages); 66 base::SplitString(accept_languages_pref.GetValue(), ',', &accept_languages);
67 #else
68 base::SplitString(accept_languages_pref.GetValue(), ',', &accept_languages);
69 #endif // !OS_MACOSX
66 70
67 for (std::vector<std::string>::const_iterator i = accept_languages.begin(); 71 for (std::vector<std::string>::const_iterator i = accept_languages.begin();
68 i != accept_languages.end(); ++i) { 72 i != accept_languages.end(); ++i) {
69 std::string language = 73 std::string language =
70 SpellCheckCommon::GetCorrespondingSpellCheckLanguage(*i); 74 SpellCheckCommon::GetCorrespondingSpellCheckLanguage(*i);
71 if (!language.empty() && 75 if (!language.empty() &&
72 std::find(languages->begin(), languages->end(), language) == 76 std::find(languages->begin(), languages->end(), language) ==
73 languages->end()) { 77 languages->end()) {
74 languages->push_back(language); 78 languages->push_back(language);
75 } 79 }
(...skipping 25 matching lines...) Expand all
101 } 105 }
102 106
103 // static 107 // static
104 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { 108 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() {
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
106 110
107 if (g_status_event) 111 if (g_status_event)
108 g_status_event->Wait(); 112 g_status_event->Wait();
109 return g_status_type; 113 return g_status_type;
110 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698