| 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> |
| 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 "chrome/browser/spellchecker/spellcheck_host.h" | 17 #include "chrome/browser/spellchecker/spellcheck_host.h" |
| 17 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" | 18 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" |
| 18 #include "content/public/common/url_fetcher_delegate.h" | 19 #include "content/public/common/url_fetcher_delegate.h" |
| 19 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 21 | 22 |
| 22 // This class implements the SpellCheckHost interface to provide the | 23 // This class implements the SpellCheckHost interface to provide the |
| 23 // functionalities listed below: | 24 // functionalities listed below: |
| 24 // * Adding a word to the custom dictionary; | 25 // * Adding a word to the custom dictionary; |
| 25 // * Storing the custom dictionary to the file, and read it back | 26 // * Storing the custom dictionary to the file, and read it back |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 virtual void AddWord(const std::string& word) OVERRIDE; | 59 virtual void AddWord(const std::string& word) OVERRIDE; |
| 59 virtual const base::PlatformFile& GetDictionaryFile() const OVERRIDE; | 60 virtual const base::PlatformFile& GetDictionaryFile() const OVERRIDE; |
| 60 virtual const std::string& GetLanguage() const OVERRIDE; | 61 virtual const std::string& GetLanguage() const OVERRIDE; |
| 61 virtual bool IsUsingPlatformChecker() const OVERRIDE; | 62 virtual bool IsUsingPlatformChecker() const OVERRIDE; |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 typedef SpellCheckProfileProvider::CustomWordList CustomWordList; | 65 typedef SpellCheckProfileProvider::CustomWordList CustomWordList; |
| 65 | 66 |
| 66 // These two classes can destruct us. | 67 // These two classes can destruct us. |
| 67 friend class content::BrowserThread; | 68 friend class content::BrowserThread; |
| 68 friend class DeleteTask<SpellCheckHostImpl>; | 69 friend class base::DeleteHelper<SpellCheckHostImpl>; |
| 69 | 70 |
| 70 // Figure out the location for the dictionary. This is only non-trivial for | 71 // Figure out the location for the dictionary. This is only non-trivial for |
| 71 // Windows: | 72 // Windows: |
| 72 // The default place whether the spellcheck dictionary can reside is | 73 // The default place whether the spellcheck dictionary can reside is |
| 73 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations, | 74 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations, |
| 74 // this directory may not have permissions for download. In that case, the | 75 // this directory may not have permissions for download. In that case, the |
| 75 // alternate directory for download is chrome::DIR_USER_DATA. | 76 // alternate directory for download is chrome::DIR_USER_DATA. |
| 76 void InitializeDictionaryLocation(); | 77 void InitializeDictionaryLocation(); |
| 77 void InitializeDictionaryLocationComplete(); | 78 void InitializeDictionaryLocationComplete(); |
| 78 | 79 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 SpellCheckHostMetrics* metrics_; | 167 SpellCheckHostMetrics* metrics_; |
| 167 | 168 |
| 168 base::WeakPtrFactory<SpellCheckHostImpl> weak_ptr_factory_; | 169 base::WeakPtrFactory<SpellCheckHostImpl> weak_ptr_factory_; |
| 169 | 170 |
| 170 scoped_ptr<CustomWordList> custom_words_; | 171 scoped_ptr<CustomWordList> custom_words_; |
| 171 | 172 |
| 172 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); | 173 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); |
| 173 }; | 174 }; |
| 174 | 175 |
| 175 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ | 176 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ |
| OLD | NEW |