| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/feedback/feedback_uploader_chrome.h" | 5 #include "components/feedback/feedback_uploader_chrome.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/task_runner_util.h" | 12 #include "base/task_runner_util.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "components/data_use_measurement/core/data_use_user_data.h" |
| 14 #include "components/feedback/feedback_report.h" | 15 #include "components/feedback/feedback_report.h" |
| 15 #include "components/feedback/feedback_switches.h" | 16 #include "components/feedback/feedback_switches.h" |
| 16 #include "components/feedback/feedback_uploader_delegate.h" | 17 #include "components/feedback/feedback_uploader_delegate.h" |
| 17 #include "components/variations/net/variations_http_headers.h" | 18 #include "components/variations/net/variations_http_headers.h" |
| 18 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/storage_partition.h" | 21 #include "content/public/browser/storage_partition.h" |
| 21 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
| 22 #include "net/url_request/url_fetcher.h" | 23 #include "net/url_request/url_fetcher.h" |
| 23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 // Note: FeedbackUploaderDelegate deletes itself and the fetcher. | 50 // Note: FeedbackUploaderDelegate deletes itself and the fetcher. |
| 50 net::URLFetcher* fetcher = | 51 net::URLFetcher* fetcher = |
| 51 net::URLFetcher::Create( | 52 net::URLFetcher::Create( |
| 52 post_url, net::URLFetcher::POST, | 53 post_url, net::URLFetcher::POST, |
| 53 new FeedbackUploaderDelegate( | 54 new FeedbackUploaderDelegate( |
| 54 data, base::Bind(&FeedbackUploaderChrome::UpdateUploadTimer, | 55 data, base::Bind(&FeedbackUploaderChrome::UpdateUploadTimer, |
| 55 AsWeakPtr()), | 56 AsWeakPtr()), |
| 56 base::Bind(&FeedbackUploaderChrome::RetryReport, AsWeakPtr()))) | 57 base::Bind(&FeedbackUploaderChrome::RetryReport, AsWeakPtr()))) |
| 57 .release(); | 58 .release(); |
| 58 | 59 data_use_measurement::DataUseUserData::AttachToFetcher( |
| 60 fetcher, data_use_measurement::DataUseUserData::FEEDBACK_UPLOADER); |
| 59 // Tell feedback server about the variation state of this install. | 61 // Tell feedback server about the variation state of this install. |
| 60 net::HttpRequestHeaders headers; | 62 net::HttpRequestHeaders headers; |
| 61 variations::AppendVariationHeaders( | 63 variations::AppendVariationHeaders( |
| 62 fetcher->GetOriginalURL(), context_->IsOffTheRecord(), false, &headers); | 64 fetcher->GetOriginalURL(), context_->IsOffTheRecord(), false, &headers); |
| 63 fetcher->SetExtraRequestHeaders(headers.ToString()); | 65 fetcher->SetExtraRequestHeaders(headers.ToString()); |
| 64 | 66 |
| 65 fetcher->SetUploadData(kProtoBufMimeType, data); | 67 fetcher->SetUploadData(kProtoBufMimeType, data); |
| 66 fetcher->SetRequestContext( | 68 fetcher->SetRequestContext( |
| 67 content::BrowserContext::GetDefaultStoragePartition(context_)-> | 69 content::BrowserContext::GetDefaultStoragePartition(context_)-> |
| 68 GetURLRequestContext()); | 70 GetURLRequestContext()); |
| 69 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 71 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| 70 net::LOAD_DO_NOT_SEND_COOKIES); | 72 net::LOAD_DO_NOT_SEND_COOKIES); |
| 71 fetcher->Start(); | 73 fetcher->Start(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 } // namespace feedback | 76 } // namespace feedback |
| OLD | NEW |