OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 #include "base/stl_util.h" | 41 #include "base/stl_util.h" |
42 #include "base/strings/string_number_conversions.h" | 42 #include "base/strings/string_number_conversions.h" |
43 #include "base/strings/stringprintf.h" | 43 #include "base/strings/stringprintf.h" |
44 #include "base/thread_task_runner_handle.h" | 44 #include "base/thread_task_runner_handle.h" |
45 #include "base/values.h" | 45 #include "base/values.h" |
46 #include "chrome/browser/spellchecker/word_trimmer.h" | 46 #include "chrome/browser/spellchecker/word_trimmer.h" |
47 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
48 #include "chrome/common/spellcheck_common.h" | 48 #include "chrome/common/spellcheck_common.h" |
49 #include "chrome/common/spellcheck_marker.h" | 49 #include "chrome/common/spellcheck_marker.h" |
50 #include "chrome/common/spellcheck_messages.h" | 50 #include "chrome/common/spellcheck_messages.h" |
51 #include "components/data_use_measurement/core/data_use_user_data.h" | |
52 #include "content/public/browser/render_process_host.h" | 51 #include "content/public/browser/render_process_host.h" |
53 #include "google_apis/google_api_keys.h" | 52 #include "google_apis/google_api_keys.h" |
54 #include "net/base/load_flags.h" | 53 #include "net/base/load_flags.h" |
55 #include "net/url_request/url_fetcher.h" | 54 #include "net/url_request/url_fetcher.h" |
56 #include "net/url_request/url_request_context_getter.h" | 55 #include "net/url_request/url_request_context_getter.h" |
57 | 56 |
58 namespace spellcheck { | 57 namespace spellcheck { |
59 | 58 |
60 namespace { | 59 namespace { |
61 | 60 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 country_), | 403 country_), |
405 api_version_)); | 404 api_version_)); |
406 std::string feedback; | 405 std::string feedback; |
407 base::JSONWriter::Write(*feedback_value, &feedback); | 406 base::JSONWriter::Write(*feedback_value, &feedback); |
408 | 407 |
409 // The tests use this identifier to mock the URL fetcher. | 408 // The tests use this identifier to mock the URL fetcher. |
410 static const int kUrlFetcherId = 0; | 409 static const int kUrlFetcherId = 0; |
411 net::URLFetcher* sender = | 410 net::URLFetcher* sender = |
412 net::URLFetcher::Create(kUrlFetcherId, feedback_service_url_, | 411 net::URLFetcher::Create(kUrlFetcherId, feedback_service_url_, |
413 net::URLFetcher::POST, this).release(); | 412 net::URLFetcher::POST, this).release(); |
414 data_use_measurement::DataUseUserData::AttachToFetcher( | |
415 sender, data_use_measurement::DataUseUserData::SPELL_CHECKER); | |
416 sender->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 413 sender->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
417 net::LOAD_DO_NOT_SAVE_COOKIES); | 414 net::LOAD_DO_NOT_SAVE_COOKIES); |
418 sender->SetUploadData("application/json", feedback); | 415 sender->SetUploadData("application/json", feedback); |
419 senders_.push_back(sender); | 416 senders_.push_back(sender); |
420 | 417 |
421 // Request context is NULL in testing. | 418 // Request context is NULL in testing. |
422 if (request_context_.get()) { | 419 if (request_context_.get()) { |
423 sender->SetRequestContext(request_context_.get()); | 420 sender->SetRequestContext(request_context_.get()); |
424 sender->Start(); | 421 sender->Start(); |
425 } | 422 } |
426 } | 423 } |
427 | 424 |
428 } // namespace spellcheck | 425 } // namespace spellcheck |
OLD | NEW |