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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 // The |FeedbackSender| object stores the user feedback to spellcheck 5 // The |FeedbackSender| object stores the user feedback to spellcheck
6 // suggestions in a |Feedback| object. 6 // suggestions in a |Feedback| object.
7 // 7 //
8 // When spelling service returns spellcheck results, these results first arrive 8 // When spelling service returns spellcheck results, these results first arrive
9 // in |FeedbackSender| to assign hash identifiers for each 9 // in |FeedbackSender| to assign hash identifiers for each
10 // misspelling-suggestion pair. If the spelling service identifies the same 10 // misspelling-suggestion pair. If the spelling service identifies the same
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 396 }
397 397
398 void FeedbackSender::SendFeedback(const std::vector<Misspelling>& feedback_data, 398 void FeedbackSender::SendFeedback(const std::vector<Misspelling>& feedback_data,
399 bool is_first_feedback_batch) { 399 bool is_first_feedback_batch) {
400 scoped_ptr<base::Value> feedback_value(BuildFeedbackValue( 400 scoped_ptr<base::Value> feedback_value(BuildFeedbackValue(
401 BuildParams(BuildSuggestionInfo(feedback_data, is_first_feedback_batch), 401 BuildParams(BuildSuggestionInfo(feedback_data, is_first_feedback_batch),
402 language_, 402 language_,
403 country_), 403 country_),
404 api_version_)); 404 api_version_));
405 std::string feedback; 405 std::string feedback;
406 base::JSONWriter::Write(feedback_value.get(), &feedback); 406 base::JSONWriter::Write(*feedback_value, &feedback);
407 407
408 // The tests use this identifier to mock the URL fetcher. 408 // The tests use this identifier to mock the URL fetcher.
409 static const int kUrlFetcherId = 0; 409 static const int kUrlFetcherId = 0;
410 net::URLFetcher* sender = 410 net::URLFetcher* sender =
411 net::URLFetcher::Create(kUrlFetcherId, feedback_service_url_, 411 net::URLFetcher::Create(kUrlFetcherId, feedback_service_url_,
412 net::URLFetcher::POST, this).release(); 412 net::URLFetcher::POST, this).release();
413 sender->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 413 sender->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
414 net::LOAD_DO_NOT_SAVE_COOKIES); 414 net::LOAD_DO_NOT_SAVE_COOKIES);
415 sender->SetUploadData("application/json", feedback); 415 sender->SetUploadData("application/json", feedback);
416 senders_.push_back(sender); 416 senders_.push_back(sender);
417 417
418 // Request context is NULL in testing. 418 // Request context is NULL in testing.
419 if (request_context_.get()) { 419 if (request_context_.get()) {
420 sender->SetRequestContext(request_context_.get()); 420 sender->SetRequestContext(request_context_.get());
421 sender->Start(); 421 sender->Start();
422 } 422 }
423 } 423 }
424 424
425 } // namespace spellcheck 425 } // namespace spellcheck
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698