Chromium Code Reviews| 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 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // An event used by browser tests to receive status events from this class and | 18 // An event used by browser tests to receive status events from this class and |
| 19 // its derived classes. | 19 // its derived classes. |
| 20 base::WaitableEvent* g_status_event = NULL; | 20 base::WaitableEvent* g_status_event = NULL; |
| 21 SpellCheckHost::EventType g_status_type = SpellCheckHost::BDICT_NOTINITIALIZED; | 21 SpellCheckHost::EventType g_status_type = SpellCheckHost::BDICT_NOTINITIALIZED; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 scoped_refptr<SpellCheckHost> SpellCheckHost::Create( | 26 scoped_ptr<SpellCheckHost> SpellCheckHost::Create( |
|
Hironori Bono
2011/10/14 10:57:04
When we change the return value to SpellChekHost*,
| |
| 27 SpellCheckProfileProvider* profile, | 27 SpellCheckProfileProvider* profile, |
| 28 const std::string& language, | 28 const std::string& language, |
| 29 net::URLRequestContextGetter* request_context_getter, | 29 net::URLRequestContextGetter* request_context_getter, |
| 30 SpellCheckHostMetrics* metrics) { | 30 SpellCheckHostMetrics* metrics) { |
| 31 scoped_refptr<SpellCheckHostImpl> host = | 31 scoped_ptr<SpellCheckHostImpl> host; |
| 32 host.reset( | |
|
Hironori Bono
2011/10/14 10:57:04
When we change the return value to SpellCheckHost*
| |
| 32 new SpellCheckHostImpl(profile, | 33 new SpellCheckHostImpl(profile, |
| 33 language, | 34 language, |
| 34 request_context_getter, | 35 request_context_getter, |
| 35 metrics); | 36 metrics)); |
| 36 if (!host) | |
| 37 return NULL; | |
| 38 | 37 |
| 39 host->Initialize(); | 38 host->Initialize(); |
| 40 return host; | 39 return host; |
| 41 } | 40 } |
| 42 | 41 |
| 43 // static | 42 // static |
| 44 int SpellCheckHost::GetSpellCheckLanguages( | 43 int SpellCheckHost::GetSpellCheckLanguages( |
| 45 Profile* profile, | 44 Profile* profile, |
| 46 std::vector<std::string>* languages) { | 45 std::vector<std::string>* languages) { |
| 47 StringPrefMember accept_languages_pref; | 46 StringPrefMember accept_languages_pref; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 } | 100 } |
| 102 | 101 |
| 103 // static | 102 // static |
| 104 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { | 103 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { |
| 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 106 | 105 |
| 107 if (g_status_event) | 106 if (g_status_event) |
| 108 g_status_event->Wait(); | 107 g_status_event->Wait(); |
| 109 return g_status_type; | 108 return g_status_type; |
| 110 } | 109 } |
| OLD | NEW |