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

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.cc

Issue 225183018: Move feedback files into src/components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest Created 6 years, 7 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 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 "chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.h" 5 #include "chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" 12 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" 14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
15 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 15 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "extensions/browser/extension_system_provider.h" 17 #include "extensions/browser/extension_system_provider.h"
18 #include "extensions/browser/extensions_browser_client.h" 18 #include "extensions/browser/extensions_browser_client.h"
19 19
20 using feedback::FeedbackData;
21
20 namespace chromeos { 22 namespace chromeos {
21 23
22 class KioskDiagnosisRunner::Factory : public BrowserContextKeyedServiceFactory { 24 class KioskDiagnosisRunner::Factory : public BrowserContextKeyedServiceFactory {
23 public: 25 public:
24 static KioskDiagnosisRunner* GetForProfile(Profile* profile) { 26 static KioskDiagnosisRunner* GetForProfile(Profile* profile) {
25 return static_cast<KioskDiagnosisRunner*>( 27 return static_cast<KioskDiagnosisRunner*>(
26 GetInstance()->GetServiceForBrowserContext(profile, true)); 28 GetInstance()->GetServiceForBrowserContext(profile, true));
27 } 29 }
28 30
29 static Factory* GetInstance() { 31 static Factory* GetInstance() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 90
89 service->GetSystemInformation( 91 service->GetSystemInformation(
90 base::Bind(&KioskDiagnosisRunner::SendSysLogFeedback, 92 base::Bind(&KioskDiagnosisRunner::SendSysLogFeedback,
91 weak_factory_.GetWeakPtr())); 93 weak_factory_.GetWeakPtr()));
92 } 94 }
93 95
94 void KioskDiagnosisRunner::SendSysLogFeedback( 96 void KioskDiagnosisRunner::SendSysLogFeedback(
95 const extensions::SystemInformationList& sys_info) { 97 const extensions::SystemInformationList& sys_info) {
96 scoped_refptr<FeedbackData> feedback_data(new FeedbackData()); 98 scoped_refptr<FeedbackData> feedback_data(new FeedbackData());
97 99
98 feedback_data->set_profile(profile_); 100 feedback_data->set_context(profile_);
99 feedback_data->set_description(base::StringPrintf( 101 feedback_data->set_description(base::StringPrintf(
100 "Autogenerated feedback:\nAppId: %s\n(uniquifier:%s)", 102 "Autogenerated feedback:\nAppId: %s\n(uniquifier:%s)",
101 app_id_.c_str(), 103 app_id_.c_str(),
102 base::Int64ToString(base::Time::Now().ToInternalValue()).c_str())); 104 base::Int64ToString(base::Time::Now().ToInternalValue()).c_str()));
103 105
104 scoped_ptr<FeedbackData::SystemLogsMap> sys_logs( 106 scoped_ptr<FeedbackData::SystemLogsMap> sys_logs(
105 new FeedbackData::SystemLogsMap); 107 new FeedbackData::SystemLogsMap);
106 for (extensions::SystemInformationList::const_iterator it = sys_info.begin(); 108 for (extensions::SystemInformationList::const_iterator it = sys_info.begin();
107 it != sys_info.end(); ++it) { 109 it != sys_info.end(); ++it) {
108 (*sys_logs.get())[it->get()->key] = it->get()->value; 110 (*sys_logs.get())[it->get()->key] = it->get()->value;
109 } 111 }
110 feedback_data->SetAndCompressSystemInfo(sys_logs.Pass()); 112 feedback_data->SetAndCompressSystemInfo(sys_logs.Pass());
111 113
112 extensions::FeedbackService* service = 114 extensions::FeedbackService* service =
113 extensions::FeedbackPrivateAPI::GetFactoryInstance() 115 extensions::FeedbackPrivateAPI::GetFactoryInstance()
114 ->Get(profile_) 116 ->Get(profile_)
115 ->GetService(); 117 ->GetService();
116 DCHECK(service); 118 DCHECK(service);
117 service->SendFeedback(profile_, 119 service->SendFeedback(profile_,
118 feedback_data, 120 feedback_data,
119 base::Bind(&KioskDiagnosisRunner::OnFeedbackSent, 121 base::Bind(&KioskDiagnosisRunner::OnFeedbackSent,
120 weak_factory_.GetWeakPtr())); 122 weak_factory_.GetWeakPtr()));
121 } 123 }
122 124
123 void KioskDiagnosisRunner::OnFeedbackSent(bool) { 125 void KioskDiagnosisRunner::OnFeedbackSent(bool) {
124 // Do nothing. 126 // Do nothing.
125 } 127 }
126 128
127 } // namespace chromeos 129 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698