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

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

Issue 1330443002: Report data usage UMA for Chrome services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewArchServices
Patch Set: Fix calling Init function in sync_client.cc Created 5 years, 3 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 30 matching lines...) Expand all
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"
51 #include "content/public/browser/render_process_host.h" 52 #include "content/public/browser/render_process_host.h"
52 #include "google_apis/google_api_keys.h" 53 #include "google_apis/google_api_keys.h"
53 #include "net/base/load_flags.h" 54 #include "net/base/load_flags.h"
54 #include "net/url_request/url_fetcher.h" 55 #include "net/url_request/url_fetcher.h"
55 #include "net/url_request/url_request_context_getter.h" 56 #include "net/url_request/url_request_context_getter.h"
56 57
57 namespace spellcheck { 58 namespace spellcheck {
58 59
59 namespace { 60 namespace {
60 61
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 country_), 404 country_),
404 api_version_)); 405 api_version_));
405 std::string feedback; 406 std::string feedback;
406 base::JSONWriter::Write(*feedback_value, &feedback); 407 base::JSONWriter::Write(*feedback_value, &feedback);
407 408
408 // The tests use this identifier to mock the URL fetcher. 409 // The tests use this identifier to mock the URL fetcher.
409 static const int kUrlFetcherId = 0; 410 static const int kUrlFetcherId = 0;
410 net::URLFetcher* sender = 411 net::URLFetcher* sender =
411 net::URLFetcher::Create(kUrlFetcherId, feedback_service_url_, 412 net::URLFetcher::Create(kUrlFetcherId, feedback_service_url_,
412 net::URLFetcher::POST, this).release(); 413 net::URLFetcher::POST, this).release();
414 data_use_measurement::DataUseUserData::AttachToFetcher(
415 sender, data_use_measurement::DataUseUserData::SPELL_CHECKER);
413 sender->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 416 sender->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
414 net::LOAD_DO_NOT_SAVE_COOKIES); 417 net::LOAD_DO_NOT_SAVE_COOKIES);
415 sender->SetUploadData("application/json", feedback); 418 sender->SetUploadData("application/json", feedback);
416 senders_.push_back(sender); 419 senders_.push_back(sender);
417 420
418 // Request context is NULL in testing. 421 // Request context is NULL in testing.
419 if (request_context_.get()) { 422 if (request_context_.get()) {
420 sender->SetRequestContext(request_context_.get()); 423 sender->SetRequestContext(request_context_.get());
421 sender->Start(); 424 sender->Start();
422 } 425 }
423 } 426 }
424 427
425 } // namespace spellcheck 428 } // namespace spellcheck
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_downloader.cc ('k') | chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698