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

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

Issue 55363003: Send compressed histograms with system logs when sending feedback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase with grt's changes Created 7 years, 1 month 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_service.h" 5 #include "chrome/browser/extensions/api/feedback_private/feedback_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/metrics/statistics_recorder.h"
9 #include "base/values.h" 10 #include "base/values.h"
10 #include "chrome/browser/chromeos/login/user_manager.h" 11 #include "chrome/browser/chromeos/login/user_manager.h"
11 #include "chrome/browser/chromeos/system_logs/scrubbed_system_logs_fetcher.h" 12 #include "chrome/browser/chromeos/system_logs/scrubbed_system_logs_fetcher.h"
12 13
13 using extensions::api::feedback_private::SystemInformation; 14 using extensions::api::feedback_private::SystemInformation;
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 class FeedbackServiceImpl 18 class FeedbackServiceImpl
18 : public FeedbackService, 19 : public FeedbackService,
19 public base::SupportsWeakPtr<FeedbackServiceImpl> { 20 public base::SupportsWeakPtr<FeedbackServiceImpl> {
20 public: 21 public:
21 FeedbackServiceImpl(); 22 FeedbackServiceImpl();
22 virtual ~FeedbackServiceImpl(); 23 virtual ~FeedbackServiceImpl();
23 24
24 virtual std::string GetUserEmail() OVERRIDE; 25 virtual std::string GetUserEmail() OVERRIDE;
25 virtual void GetSystemInformation( 26 virtual void GetSystemInformation(
26 const GetSystemInformationCallback& callback) OVERRIDE; 27 const GetSystemInformationCallback& callback) OVERRIDE;
28 virtual void GetHistograms(std::string* histograms) OVERRIDE;
27 29
28 private: 30 private:
29 void ProcessSystemLogs(scoped_ptr<chromeos::SystemLogsResponse> sys_info); 31 void ProcessSystemLogs(scoped_ptr<chromeos::SystemLogsResponse> sys_info);
30 32
31 // Overridden from FeedbackService: 33 // Overridden from FeedbackService:
32 virtual base::WeakPtr<FeedbackService> GetWeakPtr() OVERRIDE; 34 virtual base::WeakPtr<FeedbackService> GetWeakPtr() OVERRIDE;
33 35
34 DISALLOW_COPY_AND_ASSIGN(FeedbackServiceImpl); 36 DISALLOW_COPY_AND_ASSIGN(FeedbackServiceImpl);
35 }; 37 };
36 38
(...skipping 18 matching lines...) Expand all
55 void FeedbackServiceImpl::GetSystemInformation( 57 void FeedbackServiceImpl::GetSystemInformation(
56 const GetSystemInformationCallback& callback) { 58 const GetSystemInformationCallback& callback) {
57 system_information_callback_ = callback; 59 system_information_callback_ = callback;
58 60
59 chromeos::ScrubbedSystemLogsFetcher* fetcher = 61 chromeos::ScrubbedSystemLogsFetcher* fetcher =
60 new chromeos::ScrubbedSystemLogsFetcher(); 62 new chromeos::ScrubbedSystemLogsFetcher();
61 fetcher->Fetch(base::Bind(&FeedbackServiceImpl::ProcessSystemLogs, 63 fetcher->Fetch(base::Bind(&FeedbackServiceImpl::ProcessSystemLogs,
62 AsWeakPtr())); 64 AsWeakPtr()));
63 } 65 }
64 66
67 void FeedbackServiceImpl::GetHistograms(std::string* histograms) {
68 *histograms = base::StatisticsRecorder::ToJSON(std::string());
69 }
70
65 void FeedbackServiceImpl::ProcessSystemLogs( 71 void FeedbackServiceImpl::ProcessSystemLogs(
66 scoped_ptr<chromeos::SystemLogsResponse> sys_info_map) { 72 scoped_ptr<chromeos::SystemLogsResponse> sys_info_map) {
67 SystemInformationList sys_info_list; 73 SystemInformationList sys_info_list;
68 if (!sys_info_map.get()) { 74 if (!sys_info_map.get()) {
69 system_information_callback_.Run(sys_info_list); 75 system_information_callback_.Run(sys_info_list);
70 return; 76 return;
71 } 77 }
72 78
73 for (chromeos::SystemLogsResponse::iterator it = sys_info_map->begin(); 79 for (chromeos::SystemLogsResponse::iterator it = sys_info_map->begin();
74 it != sys_info_map->end(); ++it) 80 it != sys_info_map->end(); ++it)
75 FeedbackService::PopulateSystemInfo(&sys_info_list, it->first, it->second); 81 FeedbackService::PopulateSystemInfo(&sys_info_list, it->first, it->second);
76 82
77 system_information_callback_.Run(sys_info_list); 83 system_information_callback_.Run(sys_info_list);
78 } 84 }
79 85
80 base::WeakPtr<FeedbackService> FeedbackServiceImpl::GetWeakPtr() { 86 base::WeakPtr<FeedbackService> FeedbackServiceImpl::GetWeakPtr() {
81 return AsWeakPtr(); 87 return AsWeakPtr();
82 } 88 }
83 89
84 } // namespace extensions 90 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698