Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: chrome/browser/extensions/api/feedback_private/feedback_private_api.cc

Issue 1822303002: [Extensions] Convert APIs to use movable types [4] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Istiaque's Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/common/extensions/extension_constants.h" 22 #include "chrome/common/extensions/extension_constants.h"
23 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
24 #include "components/feedback/tracing_manager.h" 24 #include "components/feedback/tracing_manager.h"
25 #include "components/signin/core/browser/signin_manager.h" 25 #include "components/signin/core/browser/signin_manager.h"
26 #include "extensions/browser/event_router.h" 26 #include "extensions/browser/event_router.h"
27 #include "grit/components_strings.h" 27 #include "grit/components_strings.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/webui/web_ui_util.h" 29 #include "ui/base/webui/web_ui_util.h"
30 #include "url/url_util.h" 30 #include "url/url_util.h"
31 31
32 using extensions::api::feedback_private::SystemInformation;
32 using feedback::FeedbackData; 33 using feedback::FeedbackData;
33 34
34 namespace { 35 namespace {
35 36
36 // Getting the filename of a blob prepends a "C:\fakepath" to the filename. 37 // Getting the filename of a blob prepends a "C:\fakepath" to the filename.
37 // This is undesirable, strip it if it exists. 38 // This is undesirable, strip it if it exists.
38 std::string StripFakepath(const std::string& path) { 39 std::string StripFakepath(const std::string& path) {
39 const char kFakePathStr[] = "C:\\fakepath\\"; 40 const char kFakePathStr[] = "C:\\fakepath\\";
40 if (base::StartsWith(path, kFakePathStr, 41 if (base::StartsWith(path, kFakePathStr,
41 base::CompareCase::INSENSITIVE_ASCII)) 42 base::CompareCase::INSENSITIVE_ASCII))
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 feedback_data->set_screenshot_uuid(screenshot_uuid); 229 feedback_data->set_screenshot_uuid(screenshot_uuid);
229 230
230 if (feedback_info.trace_id.get()) { 231 if (feedback_info.trace_id.get()) {
231 feedback_data->set_trace_id(*feedback_info.trace_id.get()); 232 feedback_data->set_trace_id(*feedback_info.trace_id.get());
232 } 233 }
233 234
234 scoped_ptr<FeedbackData::SystemLogsMap> sys_logs( 235 scoped_ptr<FeedbackData::SystemLogsMap> sys_logs(
235 new FeedbackData::SystemLogsMap); 236 new FeedbackData::SystemLogsMap);
236 SystemInformationList* sys_info = feedback_info.system_information.get(); 237 SystemInformationList* sys_info = feedback_info.system_information.get();
237 if (sys_info) { 238 if (sys_info) {
238 for (SystemInformationList::iterator it = sys_info->begin(); 239 for (const SystemInformation& info : *sys_info)
239 it != sys_info->end(); ++it) 240 (*sys_logs)[info.key] = info.value;
240 (*sys_logs.get())[it->get()->key] = it->get()->value;
241 } 241 }
242 feedback_data->SetAndCompressSystemInfo(std::move(sys_logs)); 242 feedback_data->SetAndCompressSystemInfo(std::move(sys_logs));
243 243
244 FeedbackService* service = 244 FeedbackService* service =
245 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); 245 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService();
246 DCHECK(service); 246 DCHECK(service);
247 247
248 if (feedback_info.send_histograms) { 248 if (feedback_info.send_histograms) {
249 scoped_ptr<std::string> histograms(new std::string); 249 scoped_ptr<std::string> histograms(new std::string);
250 *histograms = base::StatisticsRecorder::ToJSON(std::string()); 250 *histograms = base::StatisticsRecorder::ToJSON(std::string());
(...skipping 11 matching lines...) Expand all
262 262
263 void FeedbackPrivateSendFeedbackFunction::OnCompleted( 263 void FeedbackPrivateSendFeedbackFunction::OnCompleted(
264 bool success) { 264 bool success) {
265 results_ = feedback_private::SendFeedback::Results::Create( 265 results_ = feedback_private::SendFeedback::Results::Create(
266 success ? feedback_private::STATUS_SUCCESS : 266 success ? feedback_private::STATUS_SUCCESS :
267 feedback_private::STATUS_DELAYED); 267 feedback_private::STATUS_DELAYED);
268 SendResponse(true); 268 SendResponse(true);
269 } 269 }
270 270
271 } // namespace extensions 271 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698