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