| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ios/chrome/browser/ui/tools_menu/tools_menu_model.h" | 5 #include "ios/chrome/browser/ui/tools_menu/tools_menu_model.h" |
| 6 | 6 |
| 7 #include "components/reading_list/core/reading_list_switches.h" | |
| 8 #include "components/strings/grit/components_strings.h" | 7 #include "components/strings/grit/components_strings.h" |
| 9 #include "ios/chrome/browser/experimental_flags.h" | 8 #include "ios/chrome/browser/experimental_flags.h" |
| 10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 9 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 11 #import "ios/chrome/browser/ui/tools_menu/reading_list_menu_view_item.h" | 10 #import "ios/chrome/browser/ui/tools_menu/reading_list_menu_view_item.h" |
| 12 #include "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h" | 11 #include "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h" |
| 13 #include "ios/chrome/browser/ui/ui_util.h" | 12 #include "ios/chrome/browser/ui/ui_util.h" |
| 14 #include "ios/chrome/grit/ios_strings.h" | 13 #include "ios/chrome/grit/ios_strings.h" |
| 15 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 14 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 16 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" | 15 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" |
| 17 #include "ios/web/public/user_agent.h" | 16 #include "ios/web/public/user_agent.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return false; | 86 return false; |
| 88 | 87 |
| 89 if (!configuration.inIncognito && (item.visibility & kVisibleIncognitoOnly)) | 88 if (!configuration.inIncognito && (item.visibility & kVisibleIncognitoOnly)) |
| 90 return false; | 89 return false; |
| 91 | 90 |
| 92 switch (item.title_id) { | 91 switch (item.title_id) { |
| 93 case IDS_IOS_TOOLBAR_SHOW_TABS: | 92 case IDS_IOS_TOOLBAR_SHOW_TABS: |
| 94 return IsIPadIdiom(); | 93 return IsIPadIdiom(); |
| 95 case IDS_IOS_TOOLS_MENU_READER_MODE: | 94 case IDS_IOS_TOOLS_MENU_READER_MODE: |
| 96 return experimental_flags::IsReaderModeEnabled(); | 95 return experimental_flags::IsReaderModeEnabled(); |
| 97 case IDS_IOS_TOOLS_MENU_READING_LIST: | |
| 98 return reading_list::switches::IsReadingListEnabled(); | |
| 99 case IDS_IOS_TOOLS_MENU_SUGGESTIONS: | 96 case IDS_IOS_TOOLS_MENU_SUGGESTIONS: |
| 100 return experimental_flags::IsSuggestionsUIEnabled(); | 97 return experimental_flags::IsSuggestionsUIEnabled(); |
| 101 case IDS_IOS_OPTIONS_REPORT_AN_ISSUE: | 98 case IDS_IOS_OPTIONS_REPORT_AN_ISSUE: |
| 102 return ios::GetChromeBrowserProvider() | 99 return ios::GetChromeBrowserProvider() |
| 103 ->GetUserFeedbackProvider() | 100 ->GetUserFeedbackProvider() |
| 104 ->IsUserFeedbackEnabled(); | 101 ->IsUserFeedbackEnabled(); |
| 105 // TODO(crbug.com/696676): Talk to UI/UX people to decide the correct | 102 // TODO(crbug.com/696676): Talk to UI/UX people to decide the correct |
| 106 // behavior of "Requestion Desktop/Mobile Site" (e.g. Whether user agent | 103 // behavior of "Requestion Desktop/Mobile Site" (e.g. Whether user agent |
| 107 // flag should stick when going backward and which cell should be visible | 104 // flag should stick when going backward and which cell should be visible |
| 108 // when navigating to native pages). | 105 // when navigating to native pages). |
| 109 case IDS_IOS_TOOLS_MENU_REQUEST_DESKTOP_SITE: | 106 case IDS_IOS_TOOLS_MENU_REQUEST_DESKTOP_SITE: |
| 110 #ifdef HIDE_REQUEST_MOBILE_SITE_CELL | 107 #ifdef HIDE_REQUEST_MOBILE_SITE_CELL |
| 111 return true; | 108 return true; |
| 112 #else | 109 #else |
| 113 return (configuration.userAgentType != web::UserAgentType::DESKTOP); | 110 return (configuration.userAgentType != web::UserAgentType::DESKTOP); |
| 114 #endif | 111 #endif |
| 115 case IDS_IOS_TOOLS_MENU_REQUEST_MOBILE_SITE: | 112 case IDS_IOS_TOOLS_MENU_REQUEST_MOBILE_SITE: |
| 116 // TODO(crbug.com/678047) Remove this switch when request mobile site | 113 // TODO(crbug.com/678047) Remove this switch when request mobile site |
| 117 // functionality is implemented. | 114 // functionality is implemented. |
| 118 #ifdef HIDE_REQUEST_MOBILE_SITE_CELL | 115 #ifdef HIDE_REQUEST_MOBILE_SITE_CELL |
| 119 return false; | 116 return false; |
| 120 #else | 117 #else |
| 121 return (configuration.userAgentType == web::UserAgentType::DESKTOP); | 118 return (configuration.userAgentType == web::UserAgentType::DESKTOP); |
| 122 #endif | 119 #endif |
| 123 default: | 120 default: |
| 124 return true; | 121 return true; |
| 125 } | 122 } |
| 126 } | 123 } |
| OLD | NEW |