Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Side by Side Diff: chrome/browser/spellchecker/spelling_service_client.cc

Issue 10386063: Move URLFetcherDelegate to net/ and split URLFetcher between net/ and content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head, fix win component build Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/string_escape.h" 8 #include "base/json/string_escape.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 fetcher_->SetUploadData("application/json", request); 102 fetcher_->SetUploadData("application/json", request);
103 fetcher_->SetLoadFlags( 103 fetcher_->SetLoadFlags(
104 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); 104 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
105 fetcher_->Start(); 105 fetcher_->Start();
106 tag_ = tag; 106 tag_ = tag;
107 callback_ = callback; 107 callback_ = callback;
108 return true; 108 return true;
109 } 109 }
110 110
111 void SpellingServiceClient::OnURLFetchComplete( 111 void SpellingServiceClient::OnURLFetchComplete(
112 const content::URLFetcher* source) { 112 const net::URLFetcher* source) {
113 scoped_ptr<content::URLFetcher> clean_up_fetcher(fetcher_.release()); 113 scoped_ptr<content::URLFetcher> clean_up_fetcher(fetcher_.release());
114 bool success = false; 114 bool success = false;
115 std::vector<SpellCheckResult> results; 115 std::vector<SpellCheckResult> results;
116 if (source->GetResponseCode() / 100 == 2) { 116 if (source->GetResponseCode() / 100 == 2) {
117 std::string data; 117 std::string data;
118 source->GetResponseAsString(&data); 118 source->GetResponseAsString(&data);
119 success = ParseResponse(data, &results); 119 success = ParseResponse(data, &results);
120 } 120 }
121 callback_.Run(tag_, success, results); 121 callback_.Run(tag_, success, results);
122 } 122 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (!suggestions->GetDictionary(0, &suggestion) || 195 if (!suggestions->GetDictionary(0, &suggestion) ||
196 !suggestion->GetString("suggestion", &replacement)) { 196 !suggestion->GetString("suggestion", &replacement)) {
197 return false; 197 return false;
198 } 198 }
199 SpellCheckResult result( 199 SpellCheckResult result(
200 SpellCheckResult::SPELLING, start, length, replacement); 200 SpellCheckResult::SPELLING, start, length, replacement);
201 results->push_back(result); 201 results->push_back(result);
202 } 202 }
203 return true; 203 return true;
204 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spelling_service_client.h ('k') | chrome/browser/sync/glue/http_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698