| 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 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ |    5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ | 
|    6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ |    6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ | 
|    7 #pragma once |    7 #pragma once | 
|    8  |    8  | 
|    9 #include <string> |    9 #include <string> | 
|   10 #include <vector> |   10 #include <vector> | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|   41 // The following snippet describes how to use this class, |   41 // The following snippet describes how to use this class, | 
|   42 //   std::vector<std::string> languages; |   42 //   std::vector<std::string> languages; | 
|   43 //   SpellCheckHost::GetSpellCheckLanguages(profile_, &languages); |   43 //   SpellCheckHost::GetSpellCheckLanguages(profile_, &languages); | 
|   44 //   spellcheck_host_ = SpellCheckHost::Create( |   44 //   spellcheck_host_ = SpellCheckHost::Create( | 
|   45 //       observer, languages[0], req_getter); |   45 //       observer, languages[0], req_getter); | 
|   46 // |   46 // | 
|   47 // The class is intended to be owned by SpellCheckProfile so users should |   47 // The class is intended to be owned by SpellCheckProfile so users should | 
|   48 // retrieve the instance via Profile::GetSpellCheckHost(). |   48 // retrieve the instance via Profile::GetSpellCheckHost(). | 
|   49 // Users should not hold the reference over the function scope because |   49 // Users should not hold the reference over the function scope because | 
|   50 // the instance can be invalidated during the browser's lifecycle. |   50 // the instance can be invalidated during the browser's lifecycle. | 
|   51 class SpellCheckHost |   51 class SpellCheckHost { | 
|   52     : public base::RefCountedThreadSafe<SpellCheckHost, |  | 
|   53                                         BrowserThread::DeleteOnFileThread> { |  | 
|   54  public: |   52  public: | 
|   55   // Event types used for reporting the status of this class and its derived |   53   // Event types used for reporting the status of this class and its derived | 
|   56   // classes to browser tests. |   54   // classes to browser tests. | 
|   57   enum EventType { |   55   enum EventType { | 
|   58     BDICT_NOTINITIALIZED, |   56     BDICT_NOTINITIALIZED, | 
|   59     BDICT_CORRUPTED, |   57     BDICT_CORRUPTED, | 
|   60   }; |   58   }; | 
|   61  |   59  | 
|   62   virtual ~SpellCheckHost() {} |   60   virtual ~SpellCheckHost() {} | 
|   63  |   61  | 
|   64   // Creates the instance of SpellCheckHost implementation object. |   62   // Creates the instance of SpellCheckHost implementation object. | 
|   65   static scoped_refptr<SpellCheckHost> Create( |   63   static SpellCheckHost* Create( | 
|   66       SpellCheckProfileProvider* profile, |   64       SpellCheckProfileProvider* profile, | 
|   67       const std::string& language, |   65       const std::string& language, | 
|   68       net::URLRequestContextGetter* request_context_getter, |   66       net::URLRequestContextGetter* request_context_getter, | 
|   69       SpellCheckHostMetrics* metrics); |   67       SpellCheckHostMetrics* metrics); | 
|   70  |   68  | 
|   71   // Clears a profile which is set on creation. |   69   // Clears a profile which is set on creation. | 
|   72   // Used to prevent calling back to a deleted object. |   70   // Used to prevent calling back to a deleted object. | 
|   73   virtual void UnsetProfile() = 0; |   71   virtual void UnsetProfile() = 0; | 
|   74  |   72  | 
|   75   // Pass the renderer some basic intialization information. Note that the |   73   // Pass the renderer some basic intialization information. Note that the | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  113  |  111  | 
|  114   // Attaches an event so browser tests can listen the status events. |  112   // Attaches an event so browser tests can listen the status events. | 
|  115   static void AttachStatusEvent(base::WaitableEvent* status_event); |  113   static void AttachStatusEvent(base::WaitableEvent* status_event); | 
|  116  |  114  | 
|  117   // Waits until a spellchecker updates its status. This function returns |  115   // Waits until a spellchecker updates its status. This function returns | 
|  118   // immediately when we do not set an event to |status_event_|. |  116   // immediately when we do not set an event to |status_event_|. | 
|  119   static EventType WaitStatusEvent(); |  117   static EventType WaitStatusEvent(); | 
|  120 }; |  118 }; | 
|  121  |  119  | 
|  122 #endif  // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ |  120 #endif  // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ | 
| OLD | NEW |