diff options
author | vasilii@chromium.org <vasilii@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 14:36:23 +0000 |
---|---|---|
committer | vasilii@chromium.org <vasilii@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 14:36:23 +0000 |
commit | 3920642b7127d5d492383ee82b1ad3bd13a62142 (patch) | |
tree | 1a88a6d46596b70720ffe5686fafc6defd307e98 /chrome/browser/profile_resetter | |
parent | cfcfdff83ca72da605cefdcd7ab08961f62b9828 (diff) | |
download | chromium_src-3920642b7127d5d492383ee82b1ad3bd13a62142.zip chromium_src-3920642b7127d5d492383ee82b1ad3bd13a62142.tar.gz chromium_src-3920642b7127d5d492383ee82b1ad3bd13a62142.tar.bz2 |
Profile Reset: create a new feedback category tag. It will be used by the Profile Reset prompt.
BUG=
TBR=dbeam@chromium.org
Review URL: https://codereview.chromium.org/54773003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile_resetter')
3 files changed, 24 insertions, 18 deletions
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc index 44bdb2c..5c238f3 100644 --- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc +++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc @@ -773,8 +773,7 @@ TEST_F(ProfileResetterTest, FeedbackSerializtionTest) { expand_this_test); for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS; ++field_mask) { - std::string report = SerializeSettingsReport(nonorganic_snap, field_mask, - PROFILE_RESET_WEBUI); + std::string report = SerializeSettingsReport(nonorganic_snap, field_mask); JSONStringValueSerializer json(report); std::string error; scoped_ptr<base::Value> root(json.Deserialize(NULL, &error)); @@ -790,7 +789,6 @@ TEST_F(ProfileResetterTest, FeedbackSerializtionTest) { bool homepage_is_ntp = true; std::string default_search_engine; ListValue* extensions; - int initiator = 0; EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::STARTUP_MODE), dict->GetList("startup_urls", &startup_urls)); @@ -804,7 +802,6 @@ TEST_F(ProfileResetterTest, FeedbackSerializtionTest) { dict->GetString("default_search_engine", &default_search_engine)); EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS), dict->GetList("enabled_extensions", &extensions)); - EXPECT_TRUE(dict->GetInteger("initiator", &initiator)); } } diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc index a5b8101..895d5ae 100644 --- a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc +++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc @@ -23,13 +23,13 @@ namespace { -// Feedback bucket label. -const char kProfileResetFeedbackBucket[] = "ProfileResetReport"; +// Feedback bucket labels. +const char kProfileResetPromptBucket[] = "SamplingOfSettingsResetPrompt"; +const char kProfileResetWebUIBucket[] = "ProfileResetReport"; // Dictionary keys for feedback report. const char kDefaultSearchEnginePath[] = "default_search_engine"; const char kEnabledExtensions[] = "enabled_extensions"; -const char kFeedbackCaller[] = "initiator"; const char kHomepageIsNewTabPage[] = "homepage_is_ntp"; const char kHomepagePath[] = "homepage"; const char kStartupTypePath[] = "startup_type"; @@ -109,8 +109,7 @@ int ResettableSettingsSnapshot::FindDifferentFields( } std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot, - int field_mask, - SnapshotCaller source) { + int field_mask) { DictionaryValue dict; if (field_mask & ResettableSettingsSnapshot::STARTUP_MODE) { @@ -148,16 +147,25 @@ std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot, COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 15, serialize_new_field_here); - dict.SetInteger(kFeedbackCaller, source); - std::string json; base::JSONWriter::Write(&dict, &json); return json; } -void SendSettingsFeedback(const std::string& report, Profile* profile) { +void SendSettingsFeedback(const std::string& report, + Profile* profile, + SnapshotCaller caller) { scoped_refptr<FeedbackData> feedback_data = new FeedbackData(); - feedback_data->set_category_tag(kProfileResetFeedbackBucket); + std::string bucket; + switch (caller) { + case PROFILE_RESET_WEBUI: + bucket = kProfileResetWebUIBucket; + break; + case PROFILE_RESET_PROMPT: + bucket = kProfileResetPromptBucket; + break; + } + feedback_data->set_category_tag(bucket); feedback_data->set_description(report); feedback_data->set_image(scoped_ptr<std::string>(new std::string)); diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.h b/chrome/browser/profile_resetter/resettable_settings_snapshot.h index d3062a3..df58f08 100644 --- a/chrome/browser/profile_resetter/resettable_settings_snapshot.h +++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.h @@ -74,21 +74,22 @@ class ResettableSettingsSnapshot { DISALLOW_COPY_AND_ASSIGN(ResettableSettingsSnapshot); }; -// The user of ResettableSettingsSnapshot. Don't modify the numeric values below -// because they are serialized. +// The caller of ResettableSettingsSnapshot. enum SnapshotCaller { PROFILE_RESET_WEBUI = 0, + PROFILE_RESET_PROMPT, }; // Serializes specified |snapshot| members to JSON format. |field_mask| is a bit // mask of ResettableSettingsSnapshot::Field values. std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot, - int field_mask, - SnapshotCaller source); + int field_mask); // Sends |report| as a feedback. |report| is supposed to be result of // SerializeSettingsReport(). -void SendSettingsFeedback(const std::string& report, Profile* profile); +void SendSettingsFeedback(const std::string& report, + Profile* profile, + SnapshotCaller caller); // Returns list of key/value pairs for all reported information from the // |profile| and some additional fields. |