| 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.h" |    5 #include "components/feedback/feedback_uploader.h" | 
|    6  |    6  | 
|    7 #include "base/callback.h" |    7 #include "base/callback.h" | 
|    8 #include "base/command_line.h" |    8 #include "base/command_line.h" | 
|    9 #include "base/files/file_path.h" |    9 #include "base/files/file_path.h" | 
|   10 #include "base/sequenced_task_runner.h" |   10 #include "base/sequenced_task_runner.h" | 
|   11 #include "base/task_runner_util.h" |   11 #include "base/task_runner_util.h" | 
|   12 #include "base/threading/sequenced_worker_pool.h" |   12 #include "base/threading/sequenced_worker_pool.h" | 
|   13 #include "components/feedback/feedback_report.h" |   13 #include "components/feedback/feedback_report.h" | 
|   14  |   14  | 
|   15 namespace feedback { |   15 namespace feedback { | 
|   16 namespace { |   16 namespace { | 
|   17  |   17  | 
|   18 const char kFeedbackPostUrl[] = |   18 const char kFeedbackPostUrl[] = | 
|   19     "https://www.google.com/tools/feedback/chrome/__submit"; |   19     "https://www.google.com/tools/feedback/chrome/__submit"; | 
|   20  |   20  | 
|   21 const int64 kRetryDelayMinutes = 60; |   21 const int64 kRetryDelayMinutes = 60; | 
|   22  |   22  | 
|   23 const base::FilePath::CharType kFeedbackReportPath[] = |   23 const base::FilePath::CharType kFeedbackReportPath[] = | 
|   24     FILE_PATH_LITERAL("Feedback Reports"); |   24     FILE_PATH_LITERAL("Feedback Reports"); | 
|   25  |   25  | 
|   26 }  // namespace |   26 }  // namespace | 
|   27  |   27  | 
|   28 bool FeedbackUploader::ReportsUploadTimeComparator::operator()( |   28 bool FeedbackUploader::ReportsUploadTimeComparator::operator()( | 
|   29     FeedbackReport* a, FeedbackReport* b) const { |   29     const scoped_refptr<FeedbackReport>& a, | 
 |   30     const scoped_refptr<FeedbackReport>& b) const { | 
|   30   return a->upload_at() > b->upload_at(); |   31   return a->upload_at() > b->upload_at(); | 
|   31 } |   32 } | 
|   32  |   33  | 
|   33 FeedbackUploader::FeedbackUploader(const base::FilePath& path, |   34 FeedbackUploader::FeedbackUploader(const base::FilePath& path, | 
|   34                                    base::SequencedWorkerPool* pool) |   35                                    base::SequencedWorkerPool* pool) | 
|   35     : report_path_(path.Append(kFeedbackReportPath)), |   36     : report_path_(path.Append(kFeedbackReportPath)), | 
|   36       retry_delay_(base::TimeDelta::FromMinutes(kRetryDelayMinutes)), |   37       retry_delay_(base::TimeDelta::FromMinutes(kRetryDelayMinutes)), | 
|   37       url_(kFeedbackPostUrl), |   38       url_(kFeedbackPostUrl), | 
|   38       pool_(pool) { |   39       pool_(pool) { | 
|   39   Init(); |   40   Init(); | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  101 } |  102 } | 
|  102  |  103  | 
|  103 void FeedbackUploader::setup_for_test( |  104 void FeedbackUploader::setup_for_test( | 
|  104     const ReportDataCallback& dispatch_callback, |  105     const ReportDataCallback& dispatch_callback, | 
|  105     const base::TimeDelta& retry_delay) { |  106     const base::TimeDelta& retry_delay) { | 
|  106   dispatch_callback_ = dispatch_callback; |  107   dispatch_callback_ = dispatch_callback; | 
|  107   retry_delay_ = retry_delay; |  108   retry_delay_ = retry_delay; | 
|  108 } |  109 } | 
|  109  |  110  | 
|  110 }  // namespace feedback |  111 }  // namespace feedback | 
| OLD | NEW |