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

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

Issue 206453006: [Spellcheck, OSX] Fix crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 scoped_ptr<const net::URLFetcher> fetcher(source); 247 scoped_ptr<const net::URLFetcher> fetcher(source);
248 scoped_ptr<TextCheckCallbackData> 248 scoped_ptr<TextCheckCallbackData>
249 callback_data(spellcheck_fetchers_[fetcher.get()]); 249 callback_data(spellcheck_fetchers_[fetcher.get()]);
250 bool success = false; 250 bool success = false;
251 std::vector<SpellCheckResult> results; 251 std::vector<SpellCheckResult> results;
252 if (fetcher->GetResponseCode() / 100 == 2) { 252 if (fetcher->GetResponseCode() / 100 == 2) {
253 std::string data; 253 std::string data;
254 fetcher->GetResponseAsString(&data); 254 fetcher->GetResponseAsString(&data);
255 success = ParseResponse(data, &results); 255 success = ParseResponse(data, &results);
256 } 256 }
257 spellcheck_fetchers_.erase(fetcher.get());
258
259 // The callback may release the last (transitive) dependency on |this|. It
260 // MUST be the last function called.
257 callback_data->callback.Run(success, callback_data->text, results); 261 callback_data->callback.Run(success, callback_data->text, results);
258 spellcheck_fetchers_.erase(fetcher.get());
259 } 262 }
260 263
261 net::URLFetcher* SpellingServiceClient::CreateURLFetcher(const GURL& url) { 264 net::URLFetcher* SpellingServiceClient::CreateURLFetcher(const GURL& url) {
262 return net::URLFetcher::Create(url, net::URLFetcher::POST, this); 265 return net::URLFetcher::Create(url, net::URLFetcher::POST, this);
263 } 266 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698