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_SPELLING_SERVICE_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLING_SERVICE_CLIENT_H_ |
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLING_SERVICE_CLIENT_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLING_SERVICE_CLIENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 // Sends a text-check request to the Spelling service. When we send a request | 82 // Sends a text-check request to the Spelling service. When we send a request |
83 // to the Spelling service successfully, this function returns true. (This | 83 // to the Spelling service successfully, this function returns true. (This |
84 // does not mean the service finishes checking text successfully.) We will | 84 // does not mean the service finishes checking text successfully.) We will |
85 // call |callback| when we receive a text-check response from the service. | 85 // call |callback| when we receive a text-check response from the service. |
86 bool RequestTextCheck(Profile* profile, | 86 bool RequestTextCheck(Profile* profile, |
87 int tag, | 87 int tag, |
88 ServiceType type, | 88 ServiceType type, |
89 const string16& text, | 89 const string16& text, |
90 const TextCheckCompleteCallback& callback); | 90 const TextCheckCompleteCallback& callback); |
91 | 91 |
92 // Returns whether the specified service is avilable for the given profile. | |
Avi (use Gerrit)
2012/06/13 14:46:46
s/avilable/available/
Hironori Bono
2012/06/14 03:28:38
Done.
| |
93 static bool IsAvailable(Profile* profile, ServiceType type); | |
94 | |
92 private: | 95 private: |
93 // Creates a URLFetcher object used for sending a JSON-RPC request. This | 96 // Creates a URLFetcher object used for sending a JSON-RPC request. This |
94 // function is overriden by unit tests to prevent them from actually sending | 97 // function is overriden by unit tests to prevent them from actually sending |
95 // requests to the Spelling service. | 98 // requests to the Spelling service. |
96 virtual net::URLFetcher* CreateURLFetcher(const GURL& url); | 99 virtual net::URLFetcher* CreateURLFetcher(const GURL& url); |
97 | 100 |
98 // Parses a JSON-RPC response from the Spelling service. | 101 // Parses a JSON-RPC response from the Spelling service. |
99 bool ParseResponse(const std::string& data, | 102 bool ParseResponse(const std::string& data, |
100 std::vector<SpellCheckResult>* results); | 103 std::vector<SpellCheckResult>* results); |
101 | 104 |
102 // The URLFetcher object used for sending a JSON-RPC request. | 105 // The URLFetcher object used for sending a JSON-RPC request. |
103 scoped_ptr<net::URLFetcher> fetcher_; | 106 scoped_ptr<net::URLFetcher> fetcher_; |
104 | 107 |
105 // The callback function to be called when we receive a response from the | 108 // The callback function to be called when we receive a response from the |
106 // Spelling service and parse it. | 109 // Spelling service and parse it. |
107 TextCheckCompleteCallback callback_; | 110 TextCheckCompleteCallback callback_; |
108 | 111 |
109 // The text checked by the Spelling service. | 112 // The text checked by the Spelling service. |
110 string16 text_; | 113 string16 text_; |
111 | 114 |
112 // The identifier provided by users so they can identify a text-check request. | 115 // The identifier provided by users so they can identify a text-check request. |
113 // When a JSON-RPC call finishes successfully, this value is used as the | 116 // When a JSON-RPC call finishes successfully, this value is used as the |
114 // first parameter to |callback_|. | 117 // first parameter to |callback_|. |
115 int tag_; | 118 int tag_; |
116 }; | 119 }; |
117 | 120 |
118 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLING_SERVICE_CLIENT_H_ | 121 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLING_SERVICE_CLIENT_H_ |
OLD | NEW |