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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool FeedbackPrivateGetUserEmailFunction::RunSync() { | 135 bool FeedbackPrivateGetUserEmailFunction::RunSync() { |
136 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | 136 // TODO(rkc): Remove logging once crbug.com/284662 is closed. |
137 LOG(WARNING) << "FEEDBACK_DEBUG: User e-mail requested."; | 137 LOG(WARNING) << "FEEDBACK_DEBUG: User e-mail requested."; |
138 FeedbackService* service = | 138 FeedbackService* service = |
139 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); | 139 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); |
140 DCHECK(service); | 140 DCHECK(service); |
141 SetResult(new base::StringValue(service->GetUserEmail())); | 141 SetResult(new base::StringValue(service->GetUserEmail())); |
142 return true; | 142 return true; |
143 } | 143 } |
144 | 144 |
145 bool FeedbackPrivateGetSystemInformationFunction::RunImpl() { | 145 bool FeedbackPrivateGetSystemInformationFunction::RunAsync() { |
146 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | 146 // TODO(rkc): Remove logging once crbug.com/284662 is closed. |
147 LOG(WARNING) << "FEEDBACK_DEBUG: System information requested."; | 147 LOG(WARNING) << "FEEDBACK_DEBUG: System information requested."; |
148 FeedbackService* service = | 148 FeedbackService* service = |
149 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); | 149 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); |
150 DCHECK(service); | 150 DCHECK(service); |
151 service->GetSystemInformation( | 151 service->GetSystemInformation( |
152 base::Bind( | 152 base::Bind( |
153 &FeedbackPrivateGetSystemInformationFunction::OnCompleted, this)); | 153 &FeedbackPrivateGetSystemInformationFunction::OnCompleted, this)); |
154 return true; | 154 return true; |
155 } | 155 } |
156 | 156 |
157 void FeedbackPrivateGetSystemInformationFunction::OnCompleted( | 157 void FeedbackPrivateGetSystemInformationFunction::OnCompleted( |
158 const SystemInformationList& sys_info) { | 158 const SystemInformationList& sys_info) { |
159 results_ = feedback_private::GetSystemInformation::Results::Create( | 159 results_ = feedback_private::GetSystemInformation::Results::Create( |
160 sys_info); | 160 sys_info); |
161 SendResponse(true); | 161 SendResponse(true); |
162 } | 162 } |
163 | 163 |
164 bool FeedbackPrivateSendFeedbackFunction::RunImpl() { | 164 bool FeedbackPrivateSendFeedbackFunction::RunAsync() { |
165 scoped_ptr<feedback_private::SendFeedback::Params> params( | 165 scoped_ptr<feedback_private::SendFeedback::Params> params( |
166 feedback_private::SendFeedback::Params::Create(*args_)); | 166 feedback_private::SendFeedback::Params::Create(*args_)); |
167 EXTENSION_FUNCTION_VALIDATE(params.get()); | 167 EXTENSION_FUNCTION_VALIDATE(params.get()); |
168 | 168 |
169 const FeedbackInfo &feedback_info = params->feedback; | 169 const FeedbackInfo &feedback_info = params->feedback; |
170 | 170 |
171 std::string attached_file_uuid; | 171 std::string attached_file_uuid; |
172 if (feedback_info.attached_file_blob_uuid.get() && | 172 if (feedback_info.attached_file_blob_uuid.get() && |
173 !feedback_info.attached_file_blob_uuid->empty()) | 173 !feedback_info.attached_file_blob_uuid->empty()) |
174 attached_file_uuid = *feedback_info.attached_file_blob_uuid; | 174 attached_file_uuid = *feedback_info.attached_file_blob_uuid; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 void FeedbackPrivateSendFeedbackFunction::OnCompleted( | 235 void FeedbackPrivateSendFeedbackFunction::OnCompleted( |
236 bool success) { | 236 bool success) { |
237 results_ = feedback_private::SendFeedback::Results::Create( | 237 results_ = feedback_private::SendFeedback::Results::Create( |
238 success ? feedback_private::STATUS_SUCCESS : | 238 success ? feedback_private::STATUS_SUCCESS : |
239 feedback_private::STATUS_DELAYED); | 239 feedback_private::STATUS_DELAYED); |
240 SendResponse(true); | 240 SendResponse(true); |
241 } | 241 } |
242 | 242 |
243 } // namespace extensions | 243 } // namespace extensions |
OLD | NEW |