| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" | 5 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 NSString* const kToolsMenuBookmarksId = @"kToolsMenuBookmarksId"; | 46 NSString* const kToolsMenuBookmarksId = @"kToolsMenuBookmarksId"; |
| 47 NSString* const kToolsMenuReadingListId = @"kToolsMenuReadingListId"; | 47 NSString* const kToolsMenuReadingListId = @"kToolsMenuReadingListId"; |
| 48 NSString* const kToolsMenuOtherDevicesId = @"kToolsMenuOtherDevicesId"; | 48 NSString* const kToolsMenuOtherDevicesId = @"kToolsMenuOtherDevicesId"; |
| 49 NSString* const kToolsMenuHistoryId = @"kToolsMenuHistoryId"; | 49 NSString* const kToolsMenuHistoryId = @"kToolsMenuHistoryId"; |
| 50 NSString* const kToolsMenuReportAnIssueId = @"kToolsMenuReportAnIssueId"; | 50 NSString* const kToolsMenuReportAnIssueId = @"kToolsMenuReportAnIssueId"; |
| 51 NSString* const kToolsMenuFindInPageId = @"kToolsMenuFindInPageId"; | 51 NSString* const kToolsMenuFindInPageId = @"kToolsMenuFindInPageId"; |
| 52 NSString* const kToolsMenuReaderMode = @"kToolsMenuReaderMode"; | 52 NSString* const kToolsMenuReaderMode = @"kToolsMenuReaderMode"; |
| 53 NSString* const kToolsMenuRequestDesktopId = @"kToolsMenuRequestDesktopId"; | 53 NSString* const kToolsMenuRequestDesktopId = @"kToolsMenuRequestDesktopId"; |
| 54 NSString* const kToolsMenuSettingsId = @"kToolsMenuSettingsId"; | 54 NSString* const kToolsMenuSettingsId = @"kToolsMenuSettingsId"; |
| 55 NSString* const kToolsMenuHelpId = @"kToolsMenuHelpId"; | 55 NSString* const kToolsMenuHelpId = @"kToolsMenuHelpId"; |
| 56 NSString* const kToolsMenuSuggestionsUIId = @"kToolsMenuSuggestionsUIId"; |
| 56 | 57 |
| 57 namespace { | 58 namespace { |
| 58 | 59 |
| 59 // Time for ink to fade into view. | 60 // Time for ink to fade into view. |
| 60 static const NSTimeInterval kMDCInkTouchDelayInterval = 0.15; | 61 static const NSTimeInterval kMDCInkTouchDelayInterval = 0.15; |
| 61 | 62 |
| 62 static const CGFloat kMenuItemHeight = 48; | 63 static const CGFloat kMenuItemHeight = 48; |
| 63 | 64 |
| 64 static NSString* const kToolsItemCellID = @"ToolsItemCellID"; | 65 static NSString* const kToolsItemCellID = @"ToolsItemCellID"; |
| 65 | 66 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 { IDS_IOS_TOOLS_MENU_CLOSE_ALL_INCOGNITO_TABS, | 114 { IDS_IOS_TOOLS_MENU_CLOSE_ALL_INCOGNITO_TABS, |
| 114 kToolsMenuCloseAllIncognitoTabsId, | 115 kToolsMenuCloseAllIncognitoTabsId, |
| 115 IDC_CLOSE_ALL_INCOGNITO_TABS, kToolbarTypeSwitcheriPhone, | 116 IDC_CLOSE_ALL_INCOGNITO_TABS, kToolbarTypeSwitcheriPhone, |
| 116 kVisibleIncognitoOnly, nil }, | 117 kVisibleIncognitoOnly, nil }, |
| 117 { IDS_IOS_TOOLS_MENU_BOOKMARKS, kToolsMenuBookmarksId, | 118 { IDS_IOS_TOOLS_MENU_BOOKMARKS, kToolsMenuBookmarksId, |
| 118 IDC_SHOW_BOOKMARK_MANAGER, kToolbarTypeWebAll, | 119 IDC_SHOW_BOOKMARK_MANAGER, kToolbarTypeWebAll, |
| 119 0, nil }, | 120 0, nil }, |
| 120 { IDS_IOS_TOOLS_MENU_READING_LIST, kToolsMenuReadingListId, | 121 { IDS_IOS_TOOLS_MENU_READING_LIST, kToolsMenuReadingListId, |
| 121 IDC_SHOW_READING_LIST, kToolbarTypeWebAll, | 122 IDC_SHOW_READING_LIST, kToolbarTypeWebAll, |
| 122 0, [ReadingListMenuViewItem class] }, | 123 0, [ReadingListMenuViewItem class] }, |
| 124 { IDS_IOS_TOOLS_MENU_SUGGESTIONS_UI, kToolsMenuSuggestionsUIId, |
| 125 IDC_SHOW_SUGGESTIONS_UI, kToolbarTypeWebAll, |
| 126 0, nil }, |
| 123 { IDS_IOS_TOOLS_MENU_RECENT_TABS, kToolsMenuOtherDevicesId, | 127 { IDS_IOS_TOOLS_MENU_RECENT_TABS, kToolsMenuOtherDevicesId, |
| 124 IDC_SHOW_OTHER_DEVICES, kToolbarTypeWebAll, | 128 IDC_SHOW_OTHER_DEVICES, kToolbarTypeWebAll, |
| 125 kVisibleNotIncognitoOnly, nil }, | 129 kVisibleNotIncognitoOnly, nil }, |
| 126 { IDS_HISTORY_SHOW_HISTORY, kToolsMenuHistoryId, | 130 { IDS_HISTORY_SHOW_HISTORY, kToolsMenuHistoryId, |
| 127 IDC_SHOW_HISTORY, kToolbarTypeWebAll, | 131 IDC_SHOW_HISTORY, kToolbarTypeWebAll, |
| 128 0, nil }, | 132 0, nil }, |
| 129 { IDS_IOS_OPTIONS_REPORT_AN_ISSUE, kToolsMenuReportAnIssueId, | 133 { IDS_IOS_OPTIONS_REPORT_AN_ISSUE, kToolsMenuReportAnIssueId, |
| 130 IDC_REPORT_AN_ISSUE, kToolbarTypeAll, | 134 IDC_REPORT_AN_ISSUE, kToolbarTypeAll, |
| 131 0, nil }, | 135 0, nil }, |
| 132 { IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, kToolsMenuFindInPageId, | 136 { IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, kToolsMenuFindInPageId, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return NO; | 174 return NO; |
| 171 } | 175 } |
| 172 } | 176 } |
| 173 | 177 |
| 174 if (item.title_id == IDS_IOS_TOOLS_MENU_READING_LIST) { | 178 if (item.title_id == IDS_IOS_TOOLS_MENU_READING_LIST) { |
| 175 if (!reading_list::switches::IsReadingListEnabled()) { | 179 if (!reading_list::switches::IsReadingListEnabled()) { |
| 176 return NO; | 180 return NO; |
| 177 } | 181 } |
| 178 } | 182 } |
| 179 | 183 |
| 184 if (item.title_id == IDS_IOS_TOOLS_MENU_SUGGESTIONS_UI) { |
| 185 if (!experimental_flags::IsSuggestionsUIEnabled()) { |
| 186 return NO; |
| 187 } |
| 188 } |
| 189 |
| 180 if (item.title_id == IDS_IOS_OPTIONS_REPORT_AN_ISSUE) { | 190 if (item.title_id == IDS_IOS_OPTIONS_REPORT_AN_ISSUE) { |
| 181 if (!ios::GetChromeBrowserProvider() | 191 if (!ios::GetChromeBrowserProvider() |
| 182 ->GetUserFeedbackProvider() | 192 ->GetUserFeedbackProvider() |
| 183 ->IsUserFeedbackEnabled()) { | 193 ->IsUserFeedbackEnabled()) { |
| 184 return NO; | 194 return NO; |
| 185 } | 195 } |
| 186 } | 196 } |
| 187 | 197 |
| 188 return YES; | 198 return YES; |
| 189 } | 199 } |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 | 950 |
| 941 - (void)unreadCountChanged:(NSInteger)unreadCount { | 951 - (void)unreadCountChanged:(NSInteger)unreadCount { |
| 942 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; | 952 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; |
| 943 } | 953 } |
| 944 | 954 |
| 945 - (void)unseenStateChanged:(BOOL)unseenItemsExist { | 955 - (void)unseenStateChanged:(BOOL)unseenItemsExist { |
| 946 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; | 956 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; |
| 947 } | 957 } |
| 948 | 958 |
| 949 @end | 959 @end |
| OLD | NEW |