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 #include "chrome/browser/spellchecker/spelling_service_client.h" | 5 #include "chrome/browser/spellchecker/spelling_service_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Languages currently supported by SPELLCHECK. | 44 // Languages currently supported by SPELLCHECK. |
45 const char* const kValidLanguages[] = {"en", "es", "fi", "da"}; | 45 const char* const kValidLanguages[] = {"en", "es", "fi", "da"}; |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 SpellingServiceClient::SpellingServiceClient() { | 49 SpellingServiceClient::SpellingServiceClient() { |
50 } | 50 } |
51 | 51 |
52 SpellingServiceClient::~SpellingServiceClient() { | 52 SpellingServiceClient::~SpellingServiceClient() { |
53 STLDeleteContainerPairPointers(spellcheck_fetchers_.begin(), | 53 base::STLDeleteContainerPairPointers(spellcheck_fetchers_.begin(), |
54 spellcheck_fetchers_.end()); | 54 spellcheck_fetchers_.end()); |
55 } | 55 } |
56 | 56 |
57 bool SpellingServiceClient::RequestTextCheck( | 57 bool SpellingServiceClient::RequestTextCheck( |
58 content::BrowserContext* context, | 58 content::BrowserContext* context, |
59 ServiceType type, | 59 ServiceType type, |
60 const base::string16& text, | 60 const base::string16& text, |
61 const TextCheckCompleteCallback& callback) { | 61 const TextCheckCompleteCallback& callback) { |
62 DCHECK(type == SUGGEST || type == SPELLCHECK); | 62 DCHECK(type == SUGGEST || type == SPELLCHECK); |
63 if (!context || !IsAvailable(context, type)) { | 63 if (!context || !IsAvailable(context, type)) { |
64 callback.Run(false, text, std::vector<SpellCheckResult>()); | 64 callback.Run(false, text, std::vector<SpellCheckResult>()); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 // The callback may release the last (transitive) dependency on |this|. It | 274 // The callback may release the last (transitive) dependency on |this|. It |
275 // MUST be the last function called. | 275 // MUST be the last function called. |
276 callback_data->callback.Run(success, callback_data->text, results); | 276 callback_data->callback.Run(success, callback_data->text, results); |
277 } | 277 } |
278 | 278 |
279 std::unique_ptr<net::URLFetcher> SpellingServiceClient::CreateURLFetcher( | 279 std::unique_ptr<net::URLFetcher> SpellingServiceClient::CreateURLFetcher( |
280 const GURL& url) { | 280 const GURL& url) { |
281 return net::URLFetcher::Create(url, net::URLFetcher::POST, this); | 281 return net::URLFetcher::Create(url, net::URLFetcher::POST, this); |
282 } | 282 } |
OLD | NEW |