| 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 SpellCheckHost* SpellCheckHost::Create( | 
|   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   SpellCheckHostImpl* host = | 
|   32       new SpellCheckHostImpl(profile, |   32       new SpellCheckHostImpl(profile, language, request_context_getter, | 
|   33                              language, |  | 
|   34                              request_context_getter, |  | 
|   35                              metrics); |   33                              metrics); | 
|   36   if (!host) |   34   if (!host) | 
|   37     return NULL; |   35     return NULL; | 
|   38  |   36  | 
|   39   host->Initialize(); |   37   host->Initialize(); | 
|   40   return host; |   38   return host; | 
|   41 } |   39 } | 
|   42  |   40  | 
|   43 // static |   41 // static | 
|   44 int SpellCheckHost::GetSpellCheckLanguages( |   42 int SpellCheckHost::GetSpellCheckLanguages( | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  101 } |   99 } | 
|  102  |  100  | 
|  103 // static |  101 // static | 
|  104 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { |  102 SpellCheckHost::EventType SpellCheckHost::WaitStatusEvent() { | 
|  105   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |  103   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
|  106  |  104  | 
|  107   if (g_status_event) |  105   if (g_status_event) | 
|  108     g_status_event->Wait(); |  106     g_status_event->Wait(); | 
|  109   return g_status_type; |  107   return g_status_type; | 
|  110 } |  108 } | 
| OLD | NEW |