| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/feedback/feedback_data.h" | 14 #include "chrome/browser/feedback/feedback_data.h" |
| 15 #include "chrome/browser/feedback/feedback_util.h" | 15 #include "chrome/browser/feedback/feedback_util.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/search_engines/template_url_service.h" | 17 #include "chrome/browser/search_engines/template_url_service.h" |
| 18 #include "chrome/browser/search_engines/template_url_service_factory.h" | 18 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 19 #include "chrome/common/chrome_content_client.h" | 19 #include "chrome/common/chrome_content_client.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.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 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // Feedback bucket labels. | 29 // Feedback bucket labels. |
| 30 const char kProfileResetPromptBucket[] = "SamplingOfSettingsResetPrompt"; | |
| 31 const char kProfileResetWebUIBucket[] = "ProfileResetReport"; | 30 const char kProfileResetWebUIBucket[] = "ProfileResetReport"; |
| 32 | 31 |
| 33 // Dictionary keys for feedback report. | 32 // Dictionary keys for feedback report. |
| 34 const char kDefaultSearchEnginePath[] = "default_search_engine"; | 33 const char kDefaultSearchEnginePath[] = "default_search_engine"; |
| 35 const char kEnabledExtensions[] = "enabled_extensions"; | 34 const char kEnabledExtensions[] = "enabled_extensions"; |
| 36 const char kHomepageIsNewTabPage[] = "homepage_is_ntp"; | 35 const char kHomepageIsNewTabPage[] = "homepage_is_ntp"; |
| 37 const char kHomepagePath[] = "homepage"; | 36 const char kHomepagePath[] = "homepage"; |
| 38 const char kShortcuts[] = "shortcuts"; | 37 const char kShortcuts[] = "shortcuts"; |
| 39 const char kStartupTypePath[] = "startup_type"; | 38 const char kStartupTypePath[] = "startup_type"; |
| 40 const char kStartupURLPath[] = "startup_urls"; | 39 const char kStartupURLPath[] = "startup_urls"; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 206 |
| 208 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, | 207 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, |
| 209 serialize_new_field_here); | 208 serialize_new_field_here); |
| 210 | 209 |
| 211 std::string json; | 210 std::string json; |
| 212 base::JSONWriter::Write(&dict, &json); | 211 base::JSONWriter::Write(&dict, &json); |
| 213 return json; | 212 return json; |
| 214 } | 213 } |
| 215 | 214 |
| 216 void SendSettingsFeedback(const std::string& report, | 215 void SendSettingsFeedback(const std::string& report, |
| 217 Profile* profile, | 216 Profile* profile) { |
| 218 SnapshotCaller caller) { | |
| 219 scoped_refptr<FeedbackData> feedback_data = new FeedbackData(); | 217 scoped_refptr<FeedbackData> feedback_data = new FeedbackData(); |
| 220 std::string bucket; | 218 feedback_data->set_category_tag(kProfileResetWebUIBucket); |
| 221 switch (caller) { | |
| 222 case PROFILE_RESET_WEBUI: | |
| 223 bucket = kProfileResetWebUIBucket; | |
| 224 break; | |
| 225 case PROFILE_RESET_PROMPT: | |
| 226 bucket = kProfileResetPromptBucket; | |
| 227 break; | |
| 228 } | |
| 229 feedback_data->set_category_tag(bucket); | |
| 230 feedback_data->set_description(report); | 219 feedback_data->set_description(report); |
| 231 | 220 |
| 232 feedback_data->set_image(make_scoped_ptr(new std::string)); | 221 feedback_data->set_image(make_scoped_ptr(new std::string)); |
| 233 feedback_data->set_profile(profile); | 222 feedback_data->set_profile(profile); |
| 234 | 223 |
| 235 feedback_data->set_page_url(""); | 224 feedback_data->set_page_url(""); |
| 236 feedback_data->set_user_email(""); | 225 feedback_data->set_user_email(""); |
| 237 | 226 |
| 238 feedback_util::SendReport(feedback_data); | 227 feedback_util::SendReport(feedback_data); |
| 239 } | 228 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 extension_names += '\n'; | 334 extension_names += '\n'; |
| 346 extension_names += i->second; | 335 extension_names += i->second; |
| 347 } | 336 } |
| 348 if (!extension_names.empty()) { | 337 if (!extension_names.empty()) { |
| 349 AddPair(list.get(), | 338 AddPair(list.get(), |
| 350 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), | 339 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), |
| 351 extension_names); | 340 extension_names); |
| 352 } | 341 } |
| 353 return list.Pass(); | 342 return list.Pass(); |
| 354 } | 343 } |
| OLD | NEW |