OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/message_loop_helpers.h" | 16 #include "base/message_loop_helpers.h" |
17 #include "chrome/browser/spellchecker/spellcheck_host.h" | 17 #include "chrome/browser/spellchecker/spellcheck_host.h" |
18 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" | 18 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" |
19 #include "content/public/common/url_fetcher_delegate.h" | |
20 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "content/public/common/url_fetcher_delegate.h" |
22 | 22 |
23 // This class implements the SpellCheckHost interface to provide the | 23 // This class implements the SpellCheckHost interface to provide the |
24 // functionalities listed below: | 24 // functionalities listed below: |
25 // * Adding a word to the custom dictionary; | 25 // * Adding a word to the custom dictionary; |
26 // * Storing the custom dictionary to the file, and read it back | 26 // * Storing the custom dictionary to the file, and read it back |
27 // from the file during the initialization. | 27 // from the file during the initialization. |
28 // * Downloading a dictionary and map it for the renderer, and; | 28 // * Downloading a dictionary and map it for the renderer, and; |
29 // * Calling the platform spellchecker attached to the browser; | 29 // * Calling the platform spellchecker attached to the browser; |
30 // | 30 // |
31 // To download a dictionary and initialize it without blocking the UI thread, | 31 // To download a dictionary and initialize it without blocking the UI thread, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Returns a metrics counter associated with this object, | 103 // Returns a metrics counter associated with this object, |
104 // or null when metrics recording is disabled. | 104 // or null when metrics recording is disabled. |
105 virtual SpellCheckHostMetrics* GetMetrics() const OVERRIDE; | 105 virtual SpellCheckHostMetrics* GetMetrics() const OVERRIDE; |
106 | 106 |
107 // Returns true if the dictionary is ready to use. | 107 // Returns true if the dictionary is ready to use. |
108 virtual bool IsReady() const OVERRIDE; | 108 virtual bool IsReady() const OVERRIDE; |
109 | 109 |
110 // content::URLFetcherDelegate implementation. Called when we finish | 110 // content::URLFetcherDelegate implementation. Called when we finish |
111 // downloading the spellcheck dictionary; saves the dictionary to |data_|. | 111 // downloading the spellcheck dictionary; saves the dictionary to |data_|. |
112 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; | 112 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
113 | 113 |
114 // NotificationProfile implementation. | 114 // NotificationProfile implementation. |
115 virtual void Observe(int type, | 115 virtual void Observe(int type, |
116 const content::NotificationSource& source, | 116 const content::NotificationSource& source, |
117 const content::NotificationDetails& details) OVERRIDE; | 117 const content::NotificationDetails& details) OVERRIDE; |
118 | 118 |
119 // Saves |data_| to disk. Run on the file thread. | 119 // Saves |data_| to disk. Run on the file thread. |
120 void SaveDictionaryData(); | 120 void SaveDictionaryData(); |
121 void SaveDictionaryDataComplete(); | 121 void SaveDictionaryDataComplete(); |
122 | 122 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 SpellCheckHostMetrics* metrics_; | 167 SpellCheckHostMetrics* metrics_; |
168 | 168 |
169 base::WeakPtrFactory<SpellCheckHostImpl> weak_ptr_factory_; | 169 base::WeakPtrFactory<SpellCheckHostImpl> weak_ptr_factory_; |
170 | 170 |
171 scoped_ptr<CustomWordList> custom_words_; | 171 scoped_ptr<CustomWordList> custom_words_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); | 173 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); |
174 }; | 174 }; |
175 | 175 |
176 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ | 176 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ |
OLD | NEW |