| 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.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_platform_engine.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; |
| 23 SpellCheckHost::EventType g_status_type = SpellCheckHost::BDICT_NOTINITIALIZED; | 23 SpellCheckHost::EventType g_status_type = SpellCheckHost::BDICT_NOTINITIALIZED; |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 scoped_refptr<SpellCheckHost> SpellCheckHost::Create( | 28 SpellCheckHost* SpellCheckHost::Create( |
| 29 SpellCheckProfileProvider* profile, | 29 SpellCheckProfileProvider* profile, |
| 30 const std::string& language, | 30 const std::string& language, |
| 31 net::URLRequestContextGetter* request_context_getter, | 31 net::URLRequestContextGetter* request_context_getter, |
| 32 SpellCheckHostMetrics* metrics) { | 32 SpellCheckHostMetrics* metrics) { |
| 33 scoped_refptr<SpellCheckHostImpl> host = | 33 SpellCheckHostImpl* host = |
| 34 new SpellCheckHostImpl(profile, | 34 new SpellCheckHostImpl(profile, language, request_context_getter, |
| 35 language, | |
| 36 request_context_getter, | |
| 37 metrics); | 35 metrics); |
| 38 if (!host) | 36 if (!host) |
| 39 return NULL; | 37 return NULL; |
| 40 | 38 |
| 41 host->Initialize(); | 39 host->Initialize(); |
| 42 return host; | 40 return host; |
| 43 } | 41 } |
| 44 | 42 |
| 45 // static | 43 // static |
| 46 int SpellCheckHost::GetSpellCheckLanguages( | 44 int SpellCheckHost::GetSpellCheckLanguages( |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 101 } |
| 104 | 102 |
| 105 // static | 103 // static |
| 106 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { | 104 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { |
| 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 108 | 106 |
| 109 if (g_status_event) | 107 if (g_status_event) |
| 110 g_status_event->Wait(); | 108 g_status_event->Wait(); |
| 111 return g_status_type; | 109 return g_status_type; |
| 112 } | 110 } |
| OLD | NEW |