| 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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ |
| 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // can be listed using SpellCheckHost::GetAvailableLanguages() static method. | 39 // can be listed using SpellCheckHost::GetAvailableLanguages() static method. |
| 40 class SpellCheckHostImpl : public SpellCheckHost, | 40 class SpellCheckHostImpl : public SpellCheckHost, |
| 41 public URLFetcher::Delegate, | 41 public URLFetcher::Delegate, |
| 42 public NotificationObserver { | 42 public NotificationObserver { |
| 43 public: | 43 public: |
| 44 SpellCheckHostImpl(SpellCheckProfileProvider* profile, | 44 SpellCheckHostImpl(SpellCheckProfileProvider* profile, |
| 45 const std::string& language, | 45 const std::string& language, |
| 46 net::URLRequestContextGetter* request_context_getter, | 46 net::URLRequestContextGetter* request_context_getter, |
| 47 SpellCheckHostMetrics* metrics); | 47 SpellCheckHostMetrics* metrics); |
| 48 | 48 |
| 49 virtual ~SpellCheckHostImpl(); |
| 50 |
| 49 void Initialize(); | 51 void Initialize(); |
| 50 | 52 |
| 51 // SpellCheckHost implementation | 53 // SpellCheckHost implementation |
| 52 virtual void UnsetProfile(); | 54 virtual void UnsetProfile(); |
| 53 virtual void InitForRenderer(RenderProcessHost* process); | 55 virtual void InitForRenderer(RenderProcessHost* process); |
| 54 virtual void AddWord(const std::string& word); | 56 virtual void AddWord(const std::string& word); |
| 55 virtual const base::PlatformFile& GetDictionaryFile() const; | 57 virtual const base::PlatformFile& GetDictionaryFile() const; |
| 56 virtual const std::string& GetLanguage() const; | 58 virtual const std::string& GetLanguage() const; |
| 57 virtual bool IsUsingPlatformChecker() const; | 59 virtual bool IsUsingPlatformChecker() const; |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 typedef SpellCheckProfileProvider::CustomWordList CustomWordList; | 62 typedef SpellCheckProfileProvider::CustomWordList CustomWordList; |
| 61 | 63 |
| 62 // These two classes can destruct us. | 64 // These two classes can destruct us. |
| 63 friend class BrowserThread; | 65 friend class BrowserThread; |
| 64 friend class DeleteTask<SpellCheckHostImpl>; | 66 friend class DeleteTask<SpellCheckHostImpl>; |
| 65 | 67 |
| 66 virtual ~SpellCheckHostImpl(); | |
| 67 | |
| 68 // Figure out the location for the dictionary. This is only non-trivial for | 68 // Figure out the location for the dictionary. This is only non-trivial for |
| 69 // Windows: | 69 // Windows: |
| 70 // The default place whether the spellcheck dictionary can reside is | 70 // The default place whether the spellcheck dictionary can reside is |
| 71 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations, | 71 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations, |
| 72 // this directory may not have permissions for download. In that case, the | 72 // this directory may not have permissions for download. In that case, the |
| 73 // alternate directory for download is chrome::DIR_USER_DATA. | 73 // alternate directory for download is chrome::DIR_USER_DATA. |
| 74 void InitializeDictionaryLocation(); | 74 void InitializeDictionaryLocation(); |
| 75 | 75 |
| 76 // Load and parse the custom words dictionary and open the bdic file. | 76 // Load and parse the custom words dictionary and open the bdic file. |
| 77 // Executed on the file thread. | 77 // Executed on the file thread. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 net::URLRequestContextGetter* request_context_getter_; | 154 net::URLRequestContextGetter* request_context_getter_; |
| 155 | 155 |
| 156 // Used for downloading the dictionary file. | 156 // Used for downloading the dictionary file. |
| 157 scoped_ptr<URLFetcher> fetcher_; | 157 scoped_ptr<URLFetcher> fetcher_; |
| 158 | 158 |
| 159 NotificationRegistrar registrar_; | 159 NotificationRegistrar registrar_; |
| 160 | 160 |
| 161 // An optional metrics counter given by the constructor. | 161 // An optional metrics counter given by the constructor. |
| 162 SpellCheckHostMetrics* metrics_; | 162 SpellCheckHostMetrics* metrics_; |
| 163 | 163 |
| 164 ScopedRunnableMethodFactory<SpellCheckHostImpl> service_task_factory_; |
| 165 |
| 164 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); | 166 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ | 169 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ |
| OLD | NEW |