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