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_private_api.h" | 5 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 StripFakepath((*feedback_info.attached_file).name)); | 288 StripFakepath((*feedback_info.attached_file).name)); |
289 feedback_data->set_attached_file_uuid( | 289 feedback_data->set_attached_file_uuid( |
290 *feedback_info.attached_file_blob_uuid); | 290 *feedback_info.attached_file_blob_uuid); |
291 } | 291 } |
292 | 292 |
293 if (feedback_info.screenshot_blob_uuid && | 293 if (feedback_info.screenshot_blob_uuid && |
294 !feedback_info.screenshot_blob_uuid->empty()) { | 294 !feedback_info.screenshot_blob_uuid->empty()) { |
295 feedback_data->set_screenshot_uuid(*feedback_info.screenshot_blob_uuid); | 295 feedback_data->set_screenshot_uuid(*feedback_info.screenshot_blob_uuid); |
296 } | 296 } |
297 | 297 |
298 std::unique_ptr<FeedbackData::SystemLogsMap> sys_logs( | 298 auto sys_logs = base::MakeUnique<FeedbackData::SystemLogsMap>(); |
299 new FeedbackData::SystemLogsMap); | 299 const SystemInformationList* sys_info = |
300 SystemInformationList* sys_info = feedback_info.system_information.get(); | 300 feedback_info.system_information.get(); |
301 if (sys_info) { | 301 if (sys_info) { |
302 for (const SystemInformation& info : *sys_info) | 302 for (const SystemInformation& info : *sys_info) |
303 (*sys_logs)[info.key] = info.value; | 303 sys_logs->emplace(info.key, info.value); |
304 } | 304 } |
| 305 |
305 feedback_data->SetAndCompressSystemInfo(std::move(sys_logs)); | 306 feedback_data->SetAndCompressSystemInfo(std::move(sys_logs)); |
306 | 307 |
307 FeedbackService* service = | 308 FeedbackService* service = |
308 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); | 309 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); |
309 DCHECK(service); | 310 DCHECK(service); |
310 | 311 |
311 if (feedback_info.send_histograms) { | 312 if (feedback_info.send_histograms) { |
312 std::unique_ptr<std::string> histograms(new std::string); | 313 auto histograms = base::MakeUnique<std::string>(); |
313 *histograms = base::StatisticsRecorder::ToJSON(std::string()); | 314 *histograms = base::StatisticsRecorder::ToJSON(std::string()); |
314 if (!histograms->empty()) | 315 if (!histograms->empty()) |
315 feedback_data->SetAndCompressHistograms(std::move(histograms)); | 316 feedback_data->SetAndCompressHistograms(std::move(histograms)); |
316 } | 317 } |
317 | 318 |
318 service->SendFeedback( | 319 service->SendFeedback( |
319 GetProfile(), | 320 GetProfile(), |
320 feedback_data, | 321 feedback_data, |
321 base::Bind(&FeedbackPrivateSendFeedbackFunction::OnCompleted, this)); | 322 base::Bind(&FeedbackPrivateSendFeedbackFunction::OnCompleted, this)); |
322 | 323 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 case feedback_private::SRT_PROMPT_RESULT_CLOSED: | 358 case feedback_private::SRT_PROMPT_RESULT_CLOSED: |
358 base::RecordAction(base::UserMetricsAction("Feedback.SrtPromptClosed")); | 359 base::RecordAction(base::UserMetricsAction("Feedback.SrtPromptClosed")); |
359 break; | 360 break; |
360 default: | 361 default: |
361 return RespondNow(Error("Invalid arugment.")); | 362 return RespondNow(Error("Invalid arugment.")); |
362 } | 363 } |
363 return RespondNow(NoArguments()); | 364 return RespondNow(NoArguments()); |
364 } | 365 } |
365 | 366 |
366 } // namespace extensions | 367 } // namespace extensions |
OLD | NEW |