Skip to content

Commit

Permalink
Add new summary string for update menu item
Browse files Browse the repository at this point in the history
BUG=566085

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

Cr-Commit-Position: refs/heads/master@{#369077}
  • Loading branch information
twellington authored and Commit bot committed Jan 13, 2016
1 parent 1926904 commit c4daa67
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class UpdateMenuItemHelper {
private static final String ENABLE_UPDATE_MENU_ITEM = "enable_update_menu_item";
private static final String ENABLE_UPDATE_BADGE = "enable_update_badge";
private static final String SHOW_SUMMARY = "show_summary";
private static final String USE_NEW_FEATURES_SUMMARY = "use_new_features_summary";
private static final String CUSTOM_SUMMARY = "custom_summary";

// UMA constants for logging whether the menu item was clicked.
Expand Down Expand Up @@ -169,7 +170,8 @@ public boolean shouldShowMenuItem(ChromeActivity activity) {
* @return The string to use for summary text or the empty string if no summary should be shown.
*/
public String getMenuItemSummaryText(Context context) {
if (!getBooleanParam(SHOW_SUMMARY) && !getBooleanParam(CUSTOM_SUMMARY)) {
if (!getBooleanParam(SHOW_SUMMARY) && !getBooleanParam(USE_NEW_FEATURES_SUMMARY)
&& !getBooleanParam(CUSTOM_SUMMARY)) {
return "";
}

Expand All @@ -178,6 +180,10 @@ public String getMenuItemSummaryText(Context context) {
return customSummary;
}

if (getBooleanParam(USE_NEW_FEATURES_SUMMARY)) {
return context.getResources().getString(R.string.menu_update_summary_new_features);
}

return context.getResources().getString(R.string.menu_update_summary_default);
}

Expand Down
5 changes: 4 additions & 1 deletion chrome/android/java/strings/android_chrome_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -1774,9 +1774,12 @@ Just open Chrome on your computer, go to the menu, and select “Sign in to Chro
<message name="IDS_MENU_UPDATE" desc="Menu item for updating chrome. [CHAR-LIMIT=24]">
Update Chrome
</message>
<message name="IDS_MENU_UPDATE_SUMMARY_DEFAULT" desc="Summary string for update menu item explaing why Chrome should be updated. [CHAR-LIMIT=30]">
<message name="IDS_MENU_UPDATE_SUMMARY_DEFAULT" desc="Summary string for update menu item explaining that a newer version of Chrome is available. [CHAR-LIMIT=30]">
Newer version is available
</message>
<message name="IDS_MENU_UPDATE_SUMMARY_NEW_FEATURES" desc="Summary string for update menu item explaining that new features are available. [CHAR-LIMIT=30]">
Get the latest features
</message>
<message name="IDS_MENU_NEW_TAB" desc="Menu item for opening a new tab. [CHAR-LIMIT=27]">
New tab
</message>
Expand Down
3 changes: 3 additions & 0 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -14534,6 +14534,9 @@ Please check your email at <ph name="ACCOUNT_EMAIL">$2<ex>jane.doe@gmail.com</ex
<message name="IDS_FLAGS_UPDATE_MENU_ITEM_DEFAULT_SUMMARY" desc="Option to show the default summary for the update menu item.">
Default summary
</message>
<message name="IDS_FLAGS_UPDATE_MENU_ITEM_NEW_FEATURES_SUMMARY" desc="Option to show a summary for the update menu item prompting users to 'get the latest features'.">
New features summary
</message>
<message name="IDS_FLAGS_UPDATE_MENU_ITEM_CUSTOM_SUMMARY" desc="Option to show a custom summary for the update menu item.">
Custom summary
</message>
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ const FeatureEntry::Choice kUpdateMenuItemSummaryChoices[] = {
{IDS_FLAGS_UPDATE_MENU_ITEM_NO_SUMMARY, "", ""},
{IDS_FLAGS_UPDATE_MENU_ITEM_DEFAULT_SUMMARY,
switches::kForceShowUpdateMenuItemSummary, ""},
{IDS_FLAGS_UPDATE_MENU_ITEM_NEW_FEATURES_SUMMARY,
switches::kForceShowUpdateMenuItemNewFeaturesSummary, ""},
{IDS_FLAGS_UPDATE_MENU_ITEM_CUSTOM_SUMMARY,
switches::kForceShowUpdateMenuItemCustomSummary, "Custom summary"},
};
Expand Down
4 changes: 4 additions & 0 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,10 @@ const char kForceShowUpdateMenuItem[] = "force-show-update-menu-item";
// Forces a summary to be displayed below the update menu item.
const char kForceShowUpdateMenuItemSummary[] = "show_summary";

// Forces the new features summary to be displayed below the update menu item.
const char kForceShowUpdateMenuItemNewFeaturesSummary[] =
"use_new_features_summary";

// Forces a custom summary to be displayed below the update menu item.
const char kForceShowUpdateMenuItemCustomSummary[] = "custom_summary";

Expand Down
1 change: 1 addition & 0 deletions chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ extern const char kEnableTabSwitcherInDocumentMode[];
extern const char kNtpSwitchToExistingTab[];
extern const char kForceShowUpdateMenuItem[];
extern const char kForceShowUpdateMenuItemSummary[];
extern const char kForceShowUpdateMenuItemNewFeaturesSummary[];
extern const char kForceShowUpdateMenuItemCustomSummary[];
extern const char kForceShowUpdateMenuBadge[];
extern const char kMarketUrlForTesting[];
Expand Down
1 change: 1 addition & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69280,6 +69280,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="-488779992" label="blink-settings"/>
<int value="-478462945" label="enable-ephemeral-apps"/>
<int value="-462205750" label="enable-service-worker-sync"/>
<int value="-455203267" label="use_new_features_summary"/>
<int value="-430360431" label="disable-password-generation"/>
<int value="-418868128" label="enable-experimental-web-platform-features"/>
<int value="-385337473" label="enable-fast-unload"/>
Expand Down

0 comments on commit c4daa67

Please sign in to comment.