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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 const base::CommandLine& command_line = | 39 const base::CommandLine& command_line = |
40 *base::CommandLine::ForCurrentProcess(); | 40 *base::CommandLine::ForCurrentProcess(); |
41 if (command_line.HasSwitch(switches::kFeedbackServer)) | 41 if (command_line.HasSwitch(switches::kFeedbackServer)) |
42 url_ = command_line.GetSwitchValueASCII(switches::kFeedbackServer); | 42 url_ = command_line.GetSwitchValueASCII(switches::kFeedbackServer); |
43 } | 43 } |
44 | 44 |
45 void FeedbackUploaderChrome::DispatchReport(const std::string& data) { | 45 void FeedbackUploaderChrome::DispatchReport(const std::string& data) { |
46 GURL post_url(url_); | 46 GURL post_url(url_); |
47 | 47 |
48 // Note: FeedbackUploaderDelegate deletes itself and the fetcher. | 48 // Note: FeedbackUploaderDelegate deletes itself and the fetcher. |
49 net::URLFetcher* fetcher = net::URLFetcher::Create( | 49 net::URLFetcher* fetcher = |
50 post_url, net::URLFetcher::POST, | 50 net::URLFetcher::Create( |
51 new FeedbackUploaderDelegate( | 51 post_url, net::URLFetcher::POST, |
52 data, | 52 new FeedbackUploaderDelegate( |
53 base::Bind(&FeedbackUploaderChrome::UpdateUploadTimer, AsWeakPtr()), | 53 data, base::Bind(&FeedbackUploaderChrome::UpdateUploadTimer, |
54 base::Bind(&FeedbackUploaderChrome::RetryReport, AsWeakPtr()))); | 54 AsWeakPtr()), |
| 55 base::Bind(&FeedbackUploaderChrome::RetryReport, AsWeakPtr()))) |
| 56 .release(); |
55 | 57 |
56 // Tell feedback server about the variation state of this install. | 58 // Tell feedback server about the variation state of this install. |
57 net::HttpRequestHeaders headers; | 59 net::HttpRequestHeaders headers; |
58 variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders( | 60 variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders( |
59 fetcher->GetOriginalURL(), context_->IsOffTheRecord(), false, &headers); | 61 fetcher->GetOriginalURL(), context_->IsOffTheRecord(), false, &headers); |
60 fetcher->SetExtraRequestHeaders(headers.ToString()); | 62 fetcher->SetExtraRequestHeaders(headers.ToString()); |
61 | 63 |
62 fetcher->SetUploadData(kProtoBufMimeType, data); | 64 fetcher->SetUploadData(kProtoBufMimeType, data); |
63 fetcher->SetRequestContext(context_->GetRequestContext()); | 65 fetcher->SetRequestContext(context_->GetRequestContext()); |
64 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 66 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
65 net::LOAD_DO_NOT_SEND_COOKIES); | 67 net::LOAD_DO_NOT_SEND_COOKIES); |
66 fetcher->Start(); | 68 fetcher->Start(); |
67 } | 69 } |
68 | 70 |
69 } // namespace feedback | 71 } // namespace feedback |
OLD | NEW |