| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/extensions/api/feedback_private/feedback_service.h" | 5 #include "chrome/browser/extensions/api/feedback_private/feedback_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const GetSystemInformationCallback& callback) { | 75 const GetSystemInformationCallback& callback) { |
| 76 system_logs::ScrubbedSystemLogsFetcher* fetcher = | 76 system_logs::ScrubbedSystemLogsFetcher* fetcher = |
| 77 new system_logs::ScrubbedSystemLogsFetcher(); | 77 new system_logs::ScrubbedSystemLogsFetcher(); |
| 78 fetcher->Fetch(base::Bind(&FeedbackService::OnSystemLogsFetchComplete, | 78 fetcher->Fetch(base::Bind(&FeedbackService::OnSystemLogsFetchComplete, |
| 79 AsWeakPtr(), callback)); | 79 AsWeakPtr(), callback)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void FeedbackService::AttachedFileCallback( | 82 void FeedbackService::AttachedFileCallback( |
| 83 scoped_refptr<feedback::FeedbackData> feedback_data, | 83 scoped_refptr<feedback::FeedbackData> feedback_data, |
| 84 const SendFeedbackCallback& callback, | 84 const SendFeedbackCallback& callback, |
| 85 scoped_ptr<std::string> data, | 85 std::unique_ptr<std::string> data, |
| 86 int64_t /* total_blob_length */) { | 86 int64_t /* total_blob_length */) { |
| 87 feedback_data->set_attached_file_uuid(std::string()); | 87 feedback_data->set_attached_file_uuid(std::string()); |
| 88 if (data) | 88 if (data) |
| 89 feedback_data->AttachAndCompressFileData(std::move(data)); | 89 feedback_data->AttachAndCompressFileData(std::move(data)); |
| 90 | 90 |
| 91 CompleteSendFeedback(feedback_data, callback); | 91 CompleteSendFeedback(feedback_data, callback); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void FeedbackService::ScreenshotCallback( | 94 void FeedbackService::ScreenshotCallback( |
| 95 scoped_refptr<feedback::FeedbackData> feedback_data, | 95 scoped_refptr<feedback::FeedbackData> feedback_data, |
| 96 const SendFeedbackCallback& callback, | 96 const SendFeedbackCallback& callback, |
| 97 scoped_ptr<std::string> data, | 97 std::unique_ptr<std::string> data, |
| 98 int64_t /* total_blob_length */) { | 98 int64_t /* total_blob_length */) { |
| 99 feedback_data->set_screenshot_uuid(std::string()); | 99 feedback_data->set_screenshot_uuid(std::string()); |
| 100 if (data) | 100 if (data) |
| 101 feedback_data->set_image(std::move(data)); | 101 feedback_data->set_image(std::move(data)); |
| 102 | 102 |
| 103 CompleteSendFeedback(feedback_data, callback); | 103 CompleteSendFeedback(feedback_data, callback); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void FeedbackService::OnSystemLogsFetchComplete( | 106 void FeedbackService::OnSystemLogsFetchComplete( |
| 107 const GetSystemInformationCallback& callback, | 107 const GetSystemInformationCallback& callback, |
| 108 scoped_ptr<system_logs::SystemLogsResponse> sys_info_map) { | 108 std::unique_ptr<system_logs::SystemLogsResponse> sys_info_map) { |
| 109 SystemInformationList sys_info_list; | 109 SystemInformationList sys_info_list; |
| 110 if (sys_info_map.get()) { | 110 if (sys_info_map.get()) { |
| 111 for (const auto& itr : *sys_info_map) | 111 for (const auto& itr : *sys_info_map) |
| 112 PopulateSystemInfo(&sys_info_list, itr.first, itr.second); | 112 PopulateSystemInfo(&sys_info_list, itr.first, itr.second); |
| 113 } | 113 } |
| 114 | 114 |
| 115 callback.Run(sys_info_list); | 115 callback.Run(sys_info_list); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void FeedbackService::CompleteSendFeedback( | 118 void FeedbackService::CompleteSendFeedback( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 134 // filled - the object will manage sending of the actual report. | 134 // filled - the object will manage sending of the actual report. |
| 135 feedback_data->OnFeedbackPageDataComplete(); | 135 feedback_data->OnFeedbackPageDataComplete(); |
| 136 | 136 |
| 137 // TODO(rkc): Change this once we have FeedbackData/Util refactored to | 137 // TODO(rkc): Change this once we have FeedbackData/Util refactored to |
| 138 // report the status of the report being sent. | 138 // report the status of the report being sent. |
| 139 callback.Run(true); | 139 callback.Run(true); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace extensions | 143 } // namespace extensions |
| OLD | NEW |