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/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/synchronization/cancellation_flag.h" | 10 #include "base/synchronization/cancellation_flag.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
24 #include "grit/google_chrome_strings.h" | 24 #include "grit/google_chrome_strings.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 | 26 |
27 using feedback::FeedbackData; | 27 using feedback::FeedbackData; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // Feedback bucket labels. | 31 // Feedback bucket label. |
32 const char kProfileResetPromptBucket[] = "SamplingOfSettingsResetPrompt"; | |
33 const char kProfileResetWebUIBucket[] = "ProfileResetReport"; | 32 const char kProfileResetWebUIBucket[] = "ProfileResetReport"; |
34 | 33 |
35 // Dictionary keys for feedback report. | 34 // Dictionary keys for feedback report. |
36 const char kDefaultSearchEnginePath[] = "default_search_engine"; | 35 const char kDefaultSearchEnginePath[] = "default_search_engine"; |
37 const char kEnabledExtensions[] = "enabled_extensions"; | 36 const char kEnabledExtensions[] = "enabled_extensions"; |
38 const char kHomepageIsNewTabPage[] = "homepage_is_ntp"; | 37 const char kHomepageIsNewTabPage[] = "homepage_is_ntp"; |
39 const char kHomepagePath[] = "homepage"; | 38 const char kHomepagePath[] = "homepage"; |
40 const char kShortcuts[] = "shortcuts"; | 39 const char kShortcuts[] = "shortcuts"; |
41 const char kStartupTypePath[] = "startup_type"; | 40 const char kStartupTypePath[] = "startup_type"; |
42 const char kStartupURLPath[] = "startup_urls"; | 41 const char kStartupURLPath[] = "startup_urls"; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 207 |
209 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, | 208 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, |
210 serialize_new_field_here); | 209 serialize_new_field_here); |
211 | 210 |
212 std::string json; | 211 std::string json; |
213 base::JSONWriter::Write(&dict, &json); | 212 base::JSONWriter::Write(&dict, &json); |
214 return json; | 213 return json; |
215 } | 214 } |
216 | 215 |
217 void SendSettingsFeedback(const std::string& report, | 216 void SendSettingsFeedback(const std::string& report, |
218 Profile* profile, | 217 Profile* profile) { |
219 SnapshotCaller caller) { | |
220 scoped_refptr<FeedbackData> feedback_data = new FeedbackData(); | 218 scoped_refptr<FeedbackData> feedback_data = new FeedbackData(); |
221 std::string bucket; | 219 feedback_data->set_category_tag(kProfileResetWebUIBucket); |
222 switch (caller) { | |
223 case PROFILE_RESET_WEBUI: | |
224 bucket = kProfileResetWebUIBucket; | |
225 break; | |
226 case PROFILE_RESET_PROMPT: | |
227 bucket = kProfileResetPromptBucket; | |
228 break; | |
229 } | |
230 feedback_data->set_category_tag(bucket); | |
231 feedback_data->set_description(report); | 220 feedback_data->set_description(report); |
232 | 221 |
233 feedback_data->set_image(make_scoped_ptr(new std::string)); | 222 feedback_data->set_image(make_scoped_ptr(new std::string)); |
234 feedback_data->set_context(profile); | 223 feedback_data->set_context(profile); |
235 | 224 |
236 feedback_data->set_page_url(""); | 225 feedback_data->set_page_url(""); |
237 feedback_data->set_user_email(""); | 226 feedback_data->set_user_email(""); |
238 | 227 |
239 feedback_util::SendReport(feedback_data); | 228 feedback_util::SendReport(feedback_data); |
240 } | 229 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 extension_names += '\n'; | 335 extension_names += '\n'; |
347 extension_names += i->second; | 336 extension_names += i->second; |
348 } | 337 } |
349 if (!extension_names.empty()) { | 338 if (!extension_names.empty()) { |
350 AddPair(list.get(), | 339 AddPair(list.get(), |
351 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), | 340 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), |
352 extension_names); | 341 extension_names); |
353 } | 342 } |
354 return list.Pass(); | 343 return list.Pass(); |
355 } | 344 } |
OLD | NEW |