| 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_SPELLCHECK_HOST_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECK_HOST_H_ |
| 6 #define CHROME_BROWSER_SPELLCHECK_HOST_H_ | 6 #define CHROME_BROWSER_SPELLCHECK_HOST_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/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "content/browser/browser_thread.h" | 14 #include "content/browser/browser_thread.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 class RenderProcessHost; |
| 17 class SpellCheckHostObserver; | 18 class SpellCheckHostObserver; |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // An abstract interface that provides operations that controls the spellchecker | 24 // An abstract interface that provides operations that controls the spellchecker |
| 24 // attached to the browser. This class provides the operations listed below: | 25 // attached to the browser. This class provides the operations listed below: |
| 25 // * Adding a word to the user dictionary; | 26 // * Adding a word to the user dictionary; |
| 26 // * Retrieving the dictionary file (if it has one); | 27 // * Retrieving the dictionary file (if it has one); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 50 // Creates the instance of SpellCheckHost implementation object. | 51 // Creates the instance of SpellCheckHost implementation object. |
| 51 static scoped_refptr<SpellCheckHost> Create( | 52 static scoped_refptr<SpellCheckHost> Create( |
| 52 SpellCheckHostObserver* observer, | 53 SpellCheckHostObserver* observer, |
| 53 const std::string& language, | 54 const std::string& language, |
| 54 net::URLRequestContextGetter* request_context_getter); | 55 net::URLRequestContextGetter* request_context_getter); |
| 55 | 56 |
| 56 // Clears an observer which is set on creation. | 57 // Clears an observer which is set on creation. |
| 57 // Used to prevent calling back to a deleted object. | 58 // Used to prevent calling back to a deleted object. |
| 58 virtual void UnsetObserver() = 0; | 59 virtual void UnsetObserver() = 0; |
| 59 | 60 |
| 61 // Pass the renderer some basic intialization information. Note that the |
| 62 // renderer will not load Hunspell until it needs to. |
| 63 virtual void InitForRenderer(RenderProcessHost* process) = 0; |
| 64 |
| 60 // Adds the given word to the custom words list and inform renderer of the | 65 // Adds the given word to the custom words list and inform renderer of the |
| 61 // update. | 66 // update. |
| 62 virtual void AddWord(const std::string& word) = 0; | 67 virtual void AddWord(const std::string& word) = 0; |
| 63 | 68 |
| 64 virtual const base::PlatformFile& GetDictionaryFile() const = 0; | 69 virtual const base::PlatformFile& GetDictionaryFile() const = 0; |
| 65 | 70 |
| 66 virtual const std::vector<std::string>& GetCustomWords() const = 0; | 71 virtual const std::vector<std::string>& GetCustomWords() const = 0; |
| 67 | 72 |
| 68 virtual const std::string& GetLastAddedFile() const = 0; | 73 virtual const std::string& GetLastAddedFile() const = 0; |
| 69 | 74 |
| 70 virtual const std::string& GetLanguage() const = 0; | 75 virtual const std::string& GetLanguage() const = 0; |
| 71 | 76 |
| 72 virtual bool IsUsingPlatformChecker() const = 0; | 77 virtual bool IsUsingPlatformChecker() const = 0; |
| 73 | 78 |
| 74 // This function computes a vector of strings which are to be displayed in | 79 // This function computes a vector of strings which are to be displayed in |
| 75 // the context menu over a text area for changing spell check languages. It | 80 // the context menu over a text area for changing spell check languages. It |
| 76 // returns the index of the current spell check language in the vector. | 81 // returns the index of the current spell check language in the vector. |
| 77 // TODO(port): this should take a vector of string16, but the implementation | 82 // TODO(port): this should take a vector of string16, but the implementation |
| 78 // has some dependencies in l10n util that need porting first. | 83 // has some dependencies in l10n util that need porting first. |
| 79 static int GetSpellCheckLanguages(Profile* profile, | 84 static int GetSpellCheckLanguages(Profile* profile, |
| 80 std::vector<std::string>* languages); | 85 std::vector<std::string>* languages); |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 #endif // CHROME_BROWSER_SPELLCHECK_HOST_H_ | 88 #endif // CHROME_BROWSER_SPELLCHECK_HOST_H_ |
| OLD | NEW |