Index: ios/chrome/browser/ui/tools_menu/tools_menu_model.mm |
diff --git a/ios/chrome/browser/ui/tools_menu/tools_menu_model.mm b/ios/chrome/browser/ui/tools_menu/tools_menu_model.mm |
index 5387390a167d98725731242a9e5f944fb2b2afbb..741f278d2ee1fbd9146e838191c6f70dd35b532f 100644 |
--- a/ios/chrome/browser/ui/tools_menu/tools_menu_model.mm |
+++ b/ios/chrome/browser/ui/tools_menu/tools_menu_model.mm |
@@ -9,10 +9,16 @@ |
#include "ios/chrome/browser/experimental_flags.h" |
#include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
#import "ios/chrome/browser/ui/tools_menu/reading_list_menu_view_item.h" |
+#include "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h" |
#include "ios/chrome/browser/ui/ui_util.h" |
#include "ios/chrome/grit/ios_strings.h" |
#include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
#import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider.h" |
+#include "ios/web/public/user_agent.h" |
+ |
+// TODO(crbug.com/678047) Remove this switch when request mobile site |
+// functionality is implemented. |
+#define HIDE_REQUEST_MOBILE_SITE_CELL |
// Menu items can be marked as visible or not when Incognito is enabled. |
// The following bits are used for |visibility| field in |MenuItemInfo|. |
@@ -72,15 +78,15 @@ const MenuItemInfo itemInfoList[] = { |
}; |
bool ToolsMenuItemShouldBeVisible(const MenuItemInfo& item, |
- bool incognito, |
- ToolbarType toolbarType) { |
+ ToolbarType toolbarType, |
+ ToolsMenuConfiguration* configuration) { |
if (!(item.toolbar_types & toolbarType)) |
return false; |
- if (incognito && (item.visibility & kVisibleNotIncognitoOnly)) |
+ if (configuration.inIncognito && (item.visibility & kVisibleNotIncognitoOnly)) |
return false; |
- if (!incognito && (item.visibility & kVisibleIncognitoOnly)) |
+ if (!configuration.inIncognito && (item.visibility & kVisibleIncognitoOnly)) |
return false; |
switch (item.title_id) { |
@@ -93,9 +99,27 @@ bool ToolsMenuItemShouldBeVisible(const MenuItemInfo& item, |
case IDS_IOS_TOOLS_MENU_SUGGESTIONS: |
return experimental_flags::IsSuggestionsUIEnabled(); |
case IDS_IOS_OPTIONS_REPORT_AN_ISSUE: |
- return !ios::GetChromeBrowserProvider() |
- ->GetUserFeedbackProvider() |
- ->IsUserFeedbackEnabled(); |
+ return ios::GetChromeBrowserProvider() |
+ ->GetUserFeedbackProvider() |
+ ->IsUserFeedbackEnabled(); |
+ // TODO(crbug.com/696676): Talk to UI/UX people to decide the correct |
+ // behavior of "Requestion Desktop/Mobile Site" (e.g. Whether user agent |
+ // flag should stick when going backward and which cell should be visible |
+ // when navigating to native pages). |
+ case IDS_IOS_TOOLS_MENU_REQUEST_DESKTOP_SITE: |
+#ifdef HIDE_REQUEST_MOBILE_SITE_CELL |
+ return true; |
+#else |
+ return (configuration.userAgentType != web::UserAgentType::DESKTOP); |
+#endif |
+ case IDS_IOS_TOOLS_MENU_REQUEST_MOBILE_SITE: |
+// TODO(crbug.com/678047) Remove this switch when request mobile site |
+// functionality is implemented. |
+#ifdef HIDE_REQUEST_MOBILE_SITE_CELL |
+ return false; |
+#else |
+ return (configuration.userAgentType == web::UserAgentType::DESKTOP); |
+#endif |
default: |
return true; |
} |