OLD | NEW |
1 // Copyright (c) 2012 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_HUNSPELL_DICTIONARY_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HUNSPELL_DICTIONARY_H_ |
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HUNSPELL_DICTIONARY_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HUNSPELL_DICTIONARY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/move.h" |
15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
16 #include "chrome/browser/spellchecker/spellcheck_dictionary.h" | 17 #include "chrome/browser/spellchecker/spellcheck_dictionary.h" |
17 #include "net/url_request/url_fetcher_delegate.h" | 18 #include "net/url_request/url_fetcher_delegate.h" |
18 | 19 |
19 class GURL; | 20 class GURL; |
20 class SpellcheckService; | 21 class SpellcheckService; |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 class URLFetcher; | 24 class URLFetcher; |
24 class URLRequestContextGetter; | 25 class URLRequestContextGetter; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 private: | 86 private: |
86 // Dictionary download status. | 87 // Dictionary download status. |
87 enum DownloadStatus { | 88 enum DownloadStatus { |
88 DOWNLOAD_NONE, | 89 DOWNLOAD_NONE, |
89 DOWNLOAD_IN_PROGRESS, | 90 DOWNLOAD_IN_PROGRESS, |
90 DOWNLOAD_FAILED, | 91 DOWNLOAD_FAILED, |
91 }; | 92 }; |
92 | 93 |
93 // Dictionary file information to be passed between the FILE and UI threads. | 94 // Dictionary file information to be passed between the FILE and UI threads. |
94 struct DictionaryFile { | 95 struct DictionaryFile { |
| 96 MOVE_ONLY_TYPE_FOR_CPP_03(DictionaryFile) |
95 public: | 97 public: |
96 DictionaryFile(); | 98 DictionaryFile(); |
97 ~DictionaryFile(); | 99 ~DictionaryFile(); |
98 | 100 |
99 DictionaryFile(DictionaryFile&& other); | 101 DictionaryFile(DictionaryFile&& other); |
100 DictionaryFile& operator=(DictionaryFile&& other); | 102 DictionaryFile& operator=(DictionaryFile&& other); |
101 | 103 |
102 // The desired location of the dictionary file, whether or not it exists. | 104 // The desired location of the dictionary file, whether or not it exists. |
103 base::FilePath path; | 105 base::FilePath path; |
104 | 106 |
105 // The dictionary file. | 107 // The dictionary file. |
106 base::File file; | 108 base::File file; |
107 | |
108 private: | |
109 DISALLOW_COPY_AND_ASSIGN(DictionaryFile); | |
110 }; | 109 }; |
111 | 110 |
112 // net::URLFetcherDelegate implementation. Called when dictionary download | 111 // net::URLFetcherDelegate implementation. Called when dictionary download |
113 // finishes. | 112 // finishes. |
114 void OnURLFetchComplete(const net::URLFetcher* source) override; | 113 void OnURLFetchComplete(const net::URLFetcher* source) override; |
115 | 114 |
116 // Determine the correct url to download the dictionary. | 115 // Determine the correct url to download the dictionary. |
117 GURL GetDictionaryURL(); | 116 GURL GetDictionaryURL(); |
118 | 117 |
119 // Attempt to download the dictionary. | 118 // Attempt to download the dictionary. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 163 |
165 // Dictionary file path and descriptor. | 164 // Dictionary file path and descriptor. |
166 DictionaryFile dictionary_file_; | 165 DictionaryFile dictionary_file_; |
167 | 166 |
168 base::WeakPtrFactory<SpellcheckHunspellDictionary> weak_ptr_factory_; | 167 base::WeakPtrFactory<SpellcheckHunspellDictionary> weak_ptr_factory_; |
169 | 168 |
170 DISALLOW_COPY_AND_ASSIGN(SpellcheckHunspellDictionary); | 169 DISALLOW_COPY_AND_ASSIGN(SpellcheckHunspellDictionary); |
171 }; | 170 }; |
172 | 171 |
173 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HUNSPELL_DICTIONARY_H_ | 172 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HUNSPELL_DICTIONARY_H_ |
OLD | NEW |