Chromium Code Reviews| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 233 |
| 234 bool FeedbackPrivateSendFeedbackFunction::RunAsync() { | 234 bool FeedbackPrivateSendFeedbackFunction::RunAsync() { |
| 235 std::unique_ptr<feedback_private::SendFeedback::Params> params( | 235 std::unique_ptr<feedback_private::SendFeedback::Params> params( |
| 236 feedback_private::SendFeedback::Params::Create(*args_)); | 236 feedback_private::SendFeedback::Params::Create(*args_)); |
| 237 EXTENSION_FUNCTION_VALIDATE(params.get()); | 237 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 238 | 238 |
| 239 const FeedbackInfo &feedback_info = params->feedback; | 239 const FeedbackInfo &feedback_info = params->feedback; |
| 240 | 240 |
| 241 std::string attached_file_uuid; | 241 std::string attached_file_uuid; |
| 242 if (feedback_info.attached_file_blob_uuid.get() && | 242 if (feedback_info.attached_file_blob_uuid.get() && |
| 243 !feedback_info.attached_file_blob_uuid->empty()) | 243 !feedback_info.attached_file_blob_uuid->empty()) { |
| 244 attached_file_uuid = *feedback_info.attached_file_blob_uuid; | 244 attached_file_uuid = *feedback_info.attached_file_blob_uuid; |
| 245 } | |
| 245 | 246 |
| 246 std::string screenshot_uuid; | 247 std::string screenshot_uuid; |
| 247 if (feedback_info.screenshot_blob_uuid.get() && | 248 if (feedback_info.screenshot_blob_uuid.get() && |
| 248 !feedback_info.screenshot_blob_uuid->empty()) | 249 !feedback_info.screenshot_blob_uuid->empty()) { |
| 249 screenshot_uuid = *feedback_info.screenshot_blob_uuid; | 250 screenshot_uuid = *feedback_info.screenshot_blob_uuid; |
| 251 } | |
| 250 | 252 |
| 251 // Populate feedback data. | 253 // Populate feedback data. |
| 252 scoped_refptr<FeedbackData> feedback_data(new FeedbackData()); | 254 scoped_refptr<FeedbackData> feedback_data(new FeedbackData()); |
| 253 feedback_data->set_context(GetProfile()); | 255 feedback_data->set_context(GetProfile()); |
| 254 feedback_data->set_description(feedback_info.description); | 256 feedback_data->set_description(feedback_info.description); |
| 255 | 257 |
| 258 if (feedback_info.product_id.get()) | |
|
Devlin
2016/08/03 18:04:36
optional nit: technically, all these .get()s are s
afakhry
2016/08/03 20:16:10
That's a very good nit. I was actually thinking ab
| |
| 259 feedback_data->set_product_id(*feedback_info.product_id); | |
| 256 if (feedback_info.category_tag.get()) | 260 if (feedback_info.category_tag.get()) |
| 257 feedback_data->set_category_tag(*feedback_info.category_tag); | 261 feedback_data->set_category_tag(*feedback_info.category_tag); |
| 258 if (feedback_info.page_url.get()) | 262 if (feedback_info.page_url.get()) |
| 259 feedback_data->set_page_url(*feedback_info.page_url); | 263 feedback_data->set_page_url(*feedback_info.page_url); |
| 260 if (feedback_info.email.get()) | 264 if (feedback_info.email.get()) |
| 261 feedback_data->set_user_email(*feedback_info.email); | 265 feedback_data->set_user_email(*feedback_info.email); |
| 262 | 266 |
| 263 if (!attached_file_uuid.empty()) { | 267 if (!attached_file_uuid.empty()) { |
| 264 feedback_data->set_attached_filename( | 268 feedback_data->set_attached_filename( |
| 265 StripFakepath((*feedback_info.attached_file).name)); | 269 StripFakepath((*feedback_info.attached_file).name)); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 content::RecordAction( | 334 content::RecordAction( |
| 331 base::UserMetricsAction("Feedback.SrtPromptClosed")); | 335 base::UserMetricsAction("Feedback.SrtPromptClosed")); |
| 332 break; | 336 break; |
| 333 default: | 337 default: |
| 334 return RespondNow(Error("Invalid arugment.")); | 338 return RespondNow(Error("Invalid arugment.")); |
| 335 } | 339 } |
| 336 return RespondNow(NoArguments()); | 340 return RespondNow(NoArguments()); |
| 337 } | 341 } |
| 338 | 342 |
| 339 } // namespace extensions | 343 } // namespace extensions |
| OLD | NEW |