OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/profile_resetter/resettable_settings_snapshot.h" | 5 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "components/feedback/feedback_util.h" | 22 #include "components/feedback/feedback_util.h" |
23 #include "components/search_engines/template_url_service.h" | 23 #include "components/search_engines/template_url_service.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 #include "extensions/browser/extension_registry.h" | 25 #include "extensions/browser/extension_registry.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 | 27 |
28 using feedback::FeedbackData; | 28 using feedback::FeedbackData; |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Feedback bucket label. | 32 // Feedback bucket labels. |
| 33 const char kProfileResetPromptBucket[] = "SamplingOfSettingsResetPrompt"; |
33 const char kProfileResetWebUIBucket[] = "ProfileResetReport"; | 34 const char kProfileResetWebUIBucket[] = "ProfileResetReport"; |
34 | 35 |
35 // Dictionary keys for feedback report. | 36 // Dictionary keys for feedback report. |
36 const char kDefaultSearchEnginePath[] = "default_search_engine"; | 37 const char kDefaultSearchEnginePath[] = "default_search_engine"; |
37 const char kEnabledExtensions[] = "enabled_extensions"; | 38 const char kEnabledExtensions[] = "enabled_extensions"; |
38 const char kHomepageIsNewTabPage[] = "homepage_is_ntp"; | 39 const char kHomepageIsNewTabPage[] = "homepage_is_ntp"; |
39 const char kHomepagePath[] = "homepage"; | 40 const char kHomepagePath[] = "homepage"; |
40 const char kShortcuts[] = "shortcuts"; | 41 const char kShortcuts[] = "shortcuts"; |
41 const char kShowHomeButton[] = "show_home_button"; | 42 const char kShowHomeButton[] = "show_home_button"; |
42 const char kStartupTypePath[] = "startup_type"; | 43 const char kStartupTypePath[] = "startup_type"; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 213 |
213 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, | 214 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, |
214 serialize_new_field_here); | 215 serialize_new_field_here); |
215 | 216 |
216 std::string json; | 217 std::string json; |
217 base::JSONWriter::Write(&dict, &json); | 218 base::JSONWriter::Write(&dict, &json); |
218 return json; | 219 return json; |
219 } | 220 } |
220 | 221 |
221 void SendSettingsFeedback(const std::string& report, | 222 void SendSettingsFeedback(const std::string& report, |
222 Profile* profile) { | 223 Profile* profile, |
| 224 SnapshotCaller caller) { |
223 scoped_refptr<FeedbackData> feedback_data = new FeedbackData(); | 225 scoped_refptr<FeedbackData> feedback_data = new FeedbackData(); |
224 feedback_data->set_category_tag(kProfileResetWebUIBucket); | 226 std::string bucket; |
| 227 switch (caller) { |
| 228 case PROFILE_RESET_WEBUI: |
| 229 bucket = kProfileResetWebUIBucket; |
| 230 break; |
| 231 case PROFILE_RESET_PROMPT: |
| 232 bucket = kProfileResetPromptBucket; |
| 233 break; |
| 234 } |
| 235 feedback_data->set_category_tag(bucket); |
225 feedback_data->set_description(report); | 236 feedback_data->set_description(report); |
226 | 237 |
227 feedback_data->set_image(make_scoped_ptr(new std::string)); | 238 feedback_data->set_image(make_scoped_ptr(new std::string)); |
228 feedback_data->set_context(profile); | 239 feedback_data->set_context(profile); |
229 | 240 |
230 feedback_data->set_page_url(""); | 241 feedback_data->set_page_url(""); |
231 feedback_data->set_user_email(""); | 242 feedback_data->set_user_email(""); |
232 | 243 |
233 feedback_util::SendReport(feedback_data); | 244 feedback_util::SendReport(feedback_data); |
234 } | 245 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 extension_names += '\n'; | 359 extension_names += '\n'; |
349 extension_names += i->second; | 360 extension_names += i->second; |
350 } | 361 } |
351 if (!extension_names.empty()) { | 362 if (!extension_names.empty()) { |
352 AddPair(list.get(), | 363 AddPair(list.get(), |
353 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), | 364 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), |
354 extension_names); | 365 extension_names); |
355 } | 366 } |
356 return list.Pass(); | 367 return list.Pass(); |
357 } | 368 } |
OLD | NEW |