Commit 2b0f1d99 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Add popup menu code for Text Zoom feature

This CL just adds the framework for the option in the popup menu (gated
behind a flag).

It uses the same flag that already exists for the text zoom web
feature.

I'm still waiting on the correct icon from design. I'll update that
once I get it.

Bug: 1028938
Change-Id: I7fb26da61c10b4550ec836529ec7dbb09b522a75
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1939972
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720169}
parent 269ff0a6
......@@ -1919,7 +1919,7 @@ Your data was encrypted with your sync passphrase on <ph name="TIME">$2<ex>Sept
Translate
</message>
<message name="IDS_IOS_TOOLS_MENU_FIND_IN_PAGE" desc="The iOS menu item for searching in the current page [iOS only]" meaning="Open the Find In Page menu [Length: unlimited]">
Find in Page...
Find in Page
</message>
<message name="IDS_IOS_TOOLS_MENU_HELP_MOBILE" desc="The Tools menu item for bringing up online help page." meaning="Open the help menu [Length: unlimited]">
Help
......@@ -1973,7 +1973,7 @@ New Search
Settings
</message>
<message name="IDS_IOS_TOOLS_MENU_SHARE" desc="The iOS menu item for sharing the current URL [Length: 15em] [iOS only]">
Share...
Share
</message>
<message name="IDS_IOS_TOOLS_MENU_SITE_INFORMATION" desc="The iOS menu item for getting the site informations.">
Site Information
......@@ -1981,6 +1981,9 @@ New Search
<message name="IDS_IOS_TOOLS_MENU_STOP" desc="The iOS menu item for stoping the loading of the page.">
Stop
</message>
<message name="IDS_IOS_TOOLS_MENU_TEXT_ZOOM" desc="The iOS menu item for zooming the page's text.">
Zoom Text…
</message>
<message name="IDS_IOS_TOOLS_MENU_VISIT_COPIED_LINK" desc="If a user has a URL on their clipboard, this string will appear as an option when the user long-presses on Chrome's search icon. The user can select this option to visit the URL. This string is a complete sentence. If necessary for your language, you can translate as 'Visit Link That You Copied.'" meaning="[Lenth: unlimited]">
Visit Link You Copied
</message>
......
267c5e89fe1033d3b1172cdca8c537893d57519a
\ No newline at end of file
......@@ -38,6 +38,7 @@ source_set("popup_menu") {
"resources:popup_menu_settings",
"resources:popup_menu_site_information",
"resources:popup_menu_stop",
"resources:popup_menu_text_zoom",
"resources:popup_menu_translate",
"resources:popup_menu_voice_search",
"//base",
......@@ -72,6 +73,7 @@ source_set("popup_menu") {
"//ios/chrome/browser/ui/reading_list",
"//ios/chrome/browser/ui/toolbar/public:feature_flags",
"//ios/chrome/browser/ui/util",
"//ios/chrome/browser/web:feature_flags",
"//ios/chrome/browser/web_state_list",
"//ios/public/provider/chrome/browser",
"//ios/public/provider/chrome/browser/user_feedback",
......
......@@ -99,8 +99,8 @@ using base::UserMetricsAction;
RecordAction(UserMetricsAction("MobileMenuHelp"));
[self.dispatcher showHelpPage];
break;
case PopupMenuActionOpenDownloads:
[self.dispatcher showDownloadsFolder];
case PopupMenuActionTextZoom:
RecordAction(UserMetricsAction("MobileMenuTextZoom"));
break;
#if !defined(NDEBUG)
case PopupMenuActionViewSource:
......
......@@ -72,5 +72,7 @@ extern NSString* const kToolsMenuIncognitoSearch;
extern NSString* const kToolsMenuQRCodeSearch;
// Copied Image Search item accessibility Identifier.
extern NSString* const kToolsMenuCopiedImageSearch;
// Text Zoom item accessibility identifier.
extern NSString* const kToolsMenuTextZoom;
#endif // IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONSTANTS_H_
......@@ -43,3 +43,4 @@ NSString* const kToolsMenuSearch = @"kToolsMenuSearch";
NSString* const kToolsMenuIncognitoSearch = @"kToolsMenuIncognitoSearch";
NSString* const kToolsMenuQRCodeSearch = @"kToolsMenuQRCodeSearch";
NSString* const kToolsMenuCopiedImageSearch = @"kToolsMenuCopiedImageSearch";
NSString* const kToolsMenuTextZoom = @"kToolsMenuTextZoom";
......@@ -40,6 +40,7 @@
#import "ios/chrome/browser/ui/toolbar/public/features.h"
#import "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/browser/web/features.h"
#import "ios/chrome/browser/web_state_list/web_state_list.h"
#import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h"
#include "ios/chrome/grit/ios_strings.h"
......@@ -126,6 +127,7 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID,
@property(nonatomic, strong) PopupMenuToolsItem* bookmarkItem;
@property(nonatomic, strong) PopupMenuToolsItem* translateItem;
@property(nonatomic, strong) PopupMenuToolsItem* findInPageItem;
@property(nonatomic, strong) PopupMenuToolsItem* textZoomItem;
@property(nonatomic, strong) PopupMenuToolsItem* siteInformationItem;
@property(nonatomic, strong) PopupMenuToolsItem* requestDesktopSiteItem;
@property(nonatomic, strong) PopupMenuToolsItem* requestMobileSiteItem;
......@@ -450,6 +452,8 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID,
[specificItems addObject:self.translateItem];
if (self.findInPageItem)
[specificItems addObject:self.findInPageItem];
if (self.textZoomItem)
[specificItems addObject:self.textZoomItem];
if (self.siteInformationItem)
[specificItems addObject:self.siteInformationItem];
if (self.requestDesktopSiteItem)
......@@ -539,6 +543,8 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID,
[self updateBookmarkItem];
self.translateItem.enabled = [self isTranslateEnabled];
self.findInPageItem.enabled = [self isFindInPageEnabled];
self.textZoomItem.enabled =
!self.webContentAreaShowingOverlay && [self isCurrentURLWebURL];
self.siteInformationItem.enabled = [self currentWebPageSupportsSiteInfo];
self.requestDesktopSiteItem.enabled =
[self userAgentType] == web::UserAgentType::MOBILE;
......@@ -820,12 +826,20 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID,
}
[actionsArray addObject:self.translateItem];
// Find in Pad.
// Find in Page.
self.findInPageItem = CreateTableViewItem(
IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, PopupMenuActionFindInPage,
@"popup_menu_find_in_page", kToolsMenuFindInPageId);
[actionsArray addObject:self.findInPageItem];
// Text Zoom
if (base::FeatureList::IsEnabled(web::kWebPageTextAccessibility)) {
self.textZoomItem = CreateTableViewItem(
IDS_IOS_TOOLS_MENU_TEXT_ZOOM, PopupMenuActionTextZoom,
@"popup_menu_text_zoom", kToolsMenuTextZoom);
[actionsArray addObject:self.textZoomItem];
}
if ([self userAgentType] != web::UserAgentType::DESKTOP) {
// Request Desktop Site.
self.requestDesktopSiteItem = CreateTableViewItem(
......
......@@ -23,6 +23,7 @@ typedef NS_ENUM(NSInteger, PopupMenuAction) {
PopupMenuActionSiteInformation,
PopupMenuActionReportIssue,
PopupMenuActionHelp,
PopupMenuActionTextZoom,
#if !defined(NDEBUG)
PopupMenuActionViewSource,
#endif // !defined(NDEBUG)
......
......@@ -224,3 +224,11 @@ imageset("popup_menu_help") {
"popup_menu_help.imageset/popup_menu_help@3x.png",
]
}
imageset("popup_menu_text_zoom") {
sources = [
"popup_menu_text_zoom.imageset/Contents.json",
"popup_menu_text_zoom.imageset/popup_menu_text_zoom@2x.png",
"popup_menu_text_zoom.imageset/popup_menu_text_zoom@3x.png",
]
}
{
"images": [
{
"idiom": "universal",
"scale": "2x",
"filename": "popup_menu_text_zoom@2x.png"
},
{
"idiom": "universal",
"scale": "3x",
"filename": "popup_menu_text_zoom@3x.png"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
......@@ -12593,6 +12593,11 @@ should be able to be added at any place in this file.
<description>User pressed the stop option in the app menu.</description>
</action>
<action name="MobileMenuTextZoom">
<owner>rkgibson@google.com</owner>
<description>User pressed 'Zoom Text' in the app menu</description>
</action>
<action name="MobileMenuTranslate">
<owner>frechette@chromium.org</owner>
<description>User pressed the 'Translate' in the app menu.</description>
......
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