Commit 317894b3 authored by battre@chromium.org's avatar battre@chromium.org

Add show_home_button value to reset feedback reports

BUG=235037

Review URL: https://codereview.chromium.org/465393002

Cr-Commit-Position: refs/heads/master@{#289494}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289494 0039d316-1c4b-4281-b951-d872f2087c98
parent 9859d3c3
......@@ -10282,6 +10282,15 @@ Chrome ran out of memory.
<message name="IDS_RESET_PROFILE_SETTINGS_HOMEPAGE_IS_NTP_FALSE" desc="Value of HOMEPAGE_IS_NTP in the feedback details of the Reset Profile Settings dialog">
No
</message>
<message name="IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON" desc="Tag in the feedback details of the Reset Profile Settings dialog">
Show Home button
</message>
<message name="IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON_TRUE" desc="Value of SHOW_HOME_BUTTON in the feedback details of the Reset Profile Settings dialog">
Yes
</message>
<message name="IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON_FALSE" desc="Value of SHOW_HOME_BUTTON in the feedback details of the Reset Profile Settings dialog">
No
</message>
<message name="IDS_RESET_PROFILE_SETTINGS_DSE" desc="Default search engine in the feedback details of the Reset Profile Settings dialog">
Default search engine
</message>
......
......@@ -902,6 +902,7 @@ TEST_F(ProfileResetterTest, CheckSnapshots) {
empty_snap.startup_type());
EXPECT_TRUE(empty_snap.homepage().empty());
EXPECT_TRUE(empty_snap.homepage_is_ntp());
EXPECT_FALSE(empty_snap.show_home_button());
EXPECT_NE(std::string::npos, empty_snap.dse_url().find("{google:baseURL}"));
EXPECT_EQ(ResettableSettingsSnapshot::ExtensionList(),
empty_snap.enabled_extensions());
......@@ -926,6 +927,7 @@ TEST_F(ProfileResetterTest, CheckSnapshots) {
EXPECT_EQ(SessionStartupPref::URLS, nonorganic_snap.startup_type());
EXPECT_EQ("http://www.foo.com", nonorganic_snap.homepage());
EXPECT_FALSE(nonorganic_snap.homepage_is_ntp());
EXPECT_TRUE(nonorganic_snap.show_home_button());
EXPECT_EQ("http://www.foo.com/s?q={searchTerms}", nonorganic_snap.dse_url());
EXPECT_EQ(ResettableSettingsSnapshot::ExtensionList(
1, std::make_pair(ext_id, "example")),
......@@ -982,6 +984,7 @@ TEST_F(ProfileResetterTest, FeedbackSerializationTest) {
int startup_type = 0;
std::string homepage;
bool homepage_is_ntp = true;
bool show_home_button = true;
std::string default_search_engine;
base::ListValue* extensions = NULL;
base::ListValue* shortcuts = NULL;
......@@ -994,6 +997,8 @@ TEST_F(ProfileResetterTest, FeedbackSerializationTest) {
dict->GetString("homepage", &homepage));
EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
dict->GetBoolean("homepage_is_ntp", &homepage_is_ntp));
EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE),
dict->GetBoolean("show_home_button", &show_home_button));
EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::DSE_URL),
dict->GetString("default_search_engine", &default_search_engine));
EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS),
......
......@@ -38,6 +38,7 @@ const char kEnabledExtensions[] = "enabled_extensions";
const char kHomepageIsNewTabPage[] = "homepage_is_ntp";
const char kHomepagePath[] = "homepage";
const char kShortcuts[] = "shortcuts";
const char kShowHomeButton[] = "show_home_button";
const char kStartupTypePath[] = "startup_type";
const char kStartupURLPath[] = "startup_urls";
......@@ -66,6 +67,7 @@ ResettableSettingsSnapshot::ResettableSettingsSnapshot(
DCHECK(prefs);
homepage_ = prefs->GetString(prefs::kHomePage);
homepage_is_ntp_ = prefs->GetBoolean(prefs::kHomePageIsNewTabPage);
show_home_button_ = prefs->GetBoolean(prefs::kShowHomeButton);
TemplateURLService* service =
TemplateURLServiceFactory::GetForProfile(profile);
......@@ -110,7 +112,8 @@ int ResettableSettingsSnapshot::FindDifferentFields(
bit_mask |= STARTUP_MODE;
if (homepage_is_ntp_ != snapshot.homepage_is_ntp_ ||
homepage_ != snapshot.homepage_)
homepage_ != snapshot.homepage_ ||
show_home_button_ != snapshot.show_home_button_)
bit_mask |= HOMEPAGE;
if (dse_url_ != snapshot.dse_url_)
......@@ -173,6 +176,7 @@ std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot,
if (field_mask & ResettableSettingsSnapshot::HOMEPAGE) {
dict.SetString(kHomepagePath, snapshot.homepage());
dict.SetBoolean(kHomepageIsNewTabPage, snapshot.homepage_is_ntp());
dict.SetBoolean(kShowHomeButton, snapshot.show_home_button());
}
if (field_mask & ResettableSettingsSnapshot::DSE_URL)
......@@ -295,6 +299,14 @@ scoped_ptr<base::ListValue> GetReadableFeedbackForSnapshot(
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_HOMEPAGE_IS_NTP),
l10n_util::GetStringUTF16(is_ntp_message_id));
int show_home_button_id = snapshot.show_home_button() ?
IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON_TRUE :
IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON_FALSE;
AddPair(
list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON),
l10n_util::GetStringUTF16(show_home_button_id));
TemplateURLService* service =
TemplateURLServiceFactory::GetForProfile(profile);
DCHECK(service);
......
......@@ -49,6 +49,8 @@ class ResettableSettingsSnapshot {
bool homepage_is_ntp() const { return homepage_is_ntp_; }
bool show_home_button() const { return show_home_button_; }
const std::string& dse_url() const { return dse_url_; }
const ExtensionList& enabled_extensions() const {
......@@ -89,6 +91,7 @@ class ResettableSettingsSnapshot {
std::string homepage_;
bool homepage_is_ntp_;
bool show_home_button_;
// Default search engine.
std::string dse_url_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment