| 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_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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/chrome_content_client.h" |
| 11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 12 | 14 |
| 13 using content::BrowserThread; | 15 using content::BrowserThread; |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| 17 void PopulateSystemInfo( | 19 void PopulateSystemInfo( |
| 18 extensions::SystemInformationList* sys_info_list, | 20 extensions::SystemInformationList* sys_info_list, |
| 19 const std::string& key, | 21 const std::string& key, |
| 20 const std::string& value) { | 22 const std::string& value) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 | 39 |
| 38 FeedbackService::~FeedbackService() { | 40 FeedbackService::~FeedbackService() { |
| 39 } | 41 } |
| 40 | 42 |
| 41 void FeedbackService::SendFeedback( | 43 void FeedbackService::SendFeedback( |
| 42 Profile* profile, | 44 Profile* profile, |
| 43 scoped_refptr<FeedbackData> feedback_data, | 45 scoped_refptr<FeedbackData> feedback_data, |
| 44 const SendFeedbackCallback& callback) { | 46 const SendFeedbackCallback& callback) { |
| 45 send_feedback_callback_ = callback; | 47 send_feedback_callback_ = callback; |
| 46 feedback_data_ = feedback_data; | 48 feedback_data_ = feedback_data; |
| 49 feedback_data_->set_locale(g_browser_process->GetApplicationLocale()); |
| 50 feedback_data_->set_user_agent(GetUserAgent()); |
| 47 | 51 |
| 48 if (!feedback_data_->attached_file_uuid().empty()) { | 52 if (!feedback_data_->attached_file_uuid().empty()) { |
| 49 // Self-deleting object. | 53 // Self-deleting object. |
| 50 BlobReader* attached_file_reader = new BlobReader( | 54 BlobReader* attached_file_reader = new BlobReader( |
| 51 profile, feedback_data_->attached_file_uuid(), | 55 profile, feedback_data_->attached_file_uuid(), |
| 52 base::Bind(&FeedbackService::AttachedFileCallback, | 56 base::Bind(&FeedbackService::AttachedFileCallback, |
| 53 GetWeakPtr())); | 57 GetWeakPtr())); |
| 54 attached_file_reader->Start(); | 58 attached_file_reader->Start(); |
| 55 } | 59 } |
| 56 | 60 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Signal the feedback object that the data from the feedback page has been | 135 // Signal the feedback object that the data from the feedback page has been |
| 132 // filled - the object will manage sending of the actual report. | 136 // filled - the object will manage sending of the actual report. |
| 133 feedback_data_->OnFeedbackPageDataComplete(); | 137 feedback_data_->OnFeedbackPageDataComplete(); |
| 134 // TODO(rkc): Change this once we have FeedbackData/Util refactored to | 138 // TODO(rkc): Change this once we have FeedbackData/Util refactored to |
| 135 // report the status of the report being sent. | 139 // report the status of the report being sent. |
| 136 send_feedback_callback_.Run(true); | 140 send_feedback_callback_.Run(true); |
| 137 } | 141 } |
| 138 } | 142 } |
| 139 | 143 |
| 140 } // namespace extensions | 144 } // namespace extensions |
| OLD | NEW |