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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/common/spellcheck_result.h" | 19 #include "chrome/common/spellcheck_result.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "google_apis/google_api_keys.h" | 21 #include "google_apis/google_api_keys.h" |
22 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
23 #include "net/url_request/url_fetcher.h" | 23 #include "net/url_request/url_fetcher.h" |
24 #include "unicode/uloc.h" | 24 #include "third_party/icu/public/common/unicode/uloc.h" |
25 | 25 |
26 // Use the public URL to the Spelling service on Chromium. | 26 // Use the public URL to the Spelling service on Chromium. |
27 #ifndef SPELLING_SERVICE_URL | 27 #ifndef SPELLING_SERVICE_URL |
28 #define SPELLING_SERVICE_URL "https://www.googleapis.com/rpc" | 28 #define SPELLING_SERVICE_URL "https://www.googleapis.com/rpc" |
29 #endif | 29 #endif |
30 | 30 |
31 SpellingServiceClient::SpellingServiceClient() : tag_(0) { | 31 SpellingServiceClient::SpellingServiceClient() : tag_(0) { |
32 } | 32 } |
33 | 33 |
34 SpellingServiceClient::~SpellingServiceClient() { | 34 SpellingServiceClient::~SpellingServiceClient() { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 if (!suggestions->GetDictionary(0, &suggestion) || | 223 if (!suggestions->GetDictionary(0, &suggestion) || |
224 !suggestion->GetString("suggestion", &replacement)) { | 224 !suggestion->GetString("suggestion", &replacement)) { |
225 return false; | 225 return false; |
226 } | 226 } |
227 SpellCheckResult result( | 227 SpellCheckResult result( |
228 SpellCheckResult::SPELLING, start, length, replacement); | 228 SpellCheckResult::SPELLING, start, length, replacement); |
229 results->push_back(result); | 229 results->push_back(result); |
230 } | 230 } |
231 return true; | 231 return true; |
232 } | 232 } |
OLD | NEW |