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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 NSString* const kToolsMenuBookmarksId = @"kToolsMenuBookmarksId"; | 45 NSString* const kToolsMenuBookmarksId = @"kToolsMenuBookmarksId"; |
46 NSString* const kToolsMenuReadingListId = @"kToolsMenuReadingListId"; | 46 NSString* const kToolsMenuReadingListId = @"kToolsMenuReadingListId"; |
47 NSString* const kToolsMenuOtherDevicesId = @"kToolsMenuOtherDevicesId"; | 47 NSString* const kToolsMenuOtherDevicesId = @"kToolsMenuOtherDevicesId"; |
48 NSString* const kToolsMenuHistoryId = @"kToolsMenuHistoryId"; | 48 NSString* const kToolsMenuHistoryId = @"kToolsMenuHistoryId"; |
49 NSString* const kToolsMenuReportAnIssueId = @"kToolsMenuReportAnIssueId"; | 49 NSString* const kToolsMenuReportAnIssueId = @"kToolsMenuReportAnIssueId"; |
50 NSString* const kToolsMenuFindInPageId = @"kToolsMenuFindInPageId"; | 50 NSString* const kToolsMenuFindInPageId = @"kToolsMenuFindInPageId"; |
51 NSString* const kToolsMenuReaderMode = @"kToolsMenuReaderMode"; | 51 NSString* const kToolsMenuReaderMode = @"kToolsMenuReaderMode"; |
52 NSString* const kToolsMenuRequestDesktopId = @"kToolsMenuRequestDesktopId"; | 52 NSString* const kToolsMenuRequestDesktopId = @"kToolsMenuRequestDesktopId"; |
53 NSString* const kToolsMenuSettingsId = @"kToolsMenuSettingsId"; | 53 NSString* const kToolsMenuSettingsId = @"kToolsMenuSettingsId"; |
54 NSString* const kToolsMenuHelpId = @"kToolsMenuHelpId"; | 54 NSString* const kToolsMenuHelpId = @"kToolsMenuHelpId"; |
| 55 NSString* const kToolsMenuSuggestionsId = @"kToolsMenuSuggestionsId"; |
55 | 56 |
56 namespace { | 57 namespace { |
57 | 58 |
58 // Time for ink to fade into view. | 59 // Time for ink to fade into view. |
59 static const NSTimeInterval kMDCInkTouchDelayInterval = 0.15; | 60 static const NSTimeInterval kMDCInkTouchDelayInterval = 0.15; |
60 | 61 |
61 static const CGFloat kMenuItemHeight = 48; | 62 static const CGFloat kMenuItemHeight = 48; |
62 | 63 |
63 static NSString* const kToolsItemCellID = @"ToolsItemCellID"; | 64 static NSString* const kToolsItemCellID = @"ToolsItemCellID"; |
64 | 65 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 { IDS_IOS_TOOLS_MENU_CLOSE_ALL_INCOGNITO_TABS, | 113 { IDS_IOS_TOOLS_MENU_CLOSE_ALL_INCOGNITO_TABS, |
113 kToolsMenuCloseAllIncognitoTabsId, | 114 kToolsMenuCloseAllIncognitoTabsId, |
114 IDC_CLOSE_ALL_INCOGNITO_TABS, kToolbarTypeSwitcheriPhone, | 115 IDC_CLOSE_ALL_INCOGNITO_TABS, kToolbarTypeSwitcheriPhone, |
115 kVisibleIncognitoOnly, nil }, | 116 kVisibleIncognitoOnly, nil }, |
116 { IDS_IOS_TOOLS_MENU_BOOKMARKS, kToolsMenuBookmarksId, | 117 { IDS_IOS_TOOLS_MENU_BOOKMARKS, kToolsMenuBookmarksId, |
117 IDC_SHOW_BOOKMARK_MANAGER, kToolbarTypeWebAll, | 118 IDC_SHOW_BOOKMARK_MANAGER, kToolbarTypeWebAll, |
118 0, nil }, | 119 0, nil }, |
119 { IDS_IOS_TOOLS_MENU_READING_LIST, kToolsMenuReadingListId, | 120 { IDS_IOS_TOOLS_MENU_READING_LIST, kToolsMenuReadingListId, |
120 IDC_SHOW_READING_LIST, kToolbarTypeWebAll, | 121 IDC_SHOW_READING_LIST, kToolbarTypeWebAll, |
121 0, [ReadingListMenuViewItem class] }, | 122 0, [ReadingListMenuViewItem class] }, |
| 123 { IDS_IOS_TOOLS_MENU_SUGGESTIONS, kToolsMenuSuggestionsId, |
| 124 IDC_SHOW_SUGGESTIONS, kToolbarTypeWebAll, |
| 125 0, nil }, |
122 { IDS_IOS_TOOLS_MENU_RECENT_TABS, kToolsMenuOtherDevicesId, | 126 { IDS_IOS_TOOLS_MENU_RECENT_TABS, kToolsMenuOtherDevicesId, |
123 IDC_SHOW_OTHER_DEVICES, kToolbarTypeWebAll, | 127 IDC_SHOW_OTHER_DEVICES, kToolbarTypeWebAll, |
124 kVisibleNotIncognitoOnly, nil }, | 128 kVisibleNotIncognitoOnly, nil }, |
125 { IDS_HISTORY_SHOW_HISTORY, kToolsMenuHistoryId, | 129 { IDS_HISTORY_SHOW_HISTORY, kToolsMenuHistoryId, |
126 IDC_SHOW_HISTORY, kToolbarTypeWebAll, | 130 IDC_SHOW_HISTORY, kToolbarTypeWebAll, |
127 0, nil }, | 131 0, nil }, |
128 { IDS_IOS_OPTIONS_REPORT_AN_ISSUE, kToolsMenuReportAnIssueId, | 132 { IDS_IOS_OPTIONS_REPORT_AN_ISSUE, kToolsMenuReportAnIssueId, |
129 IDC_REPORT_AN_ISSUE, kToolbarTypeAll, | 133 IDC_REPORT_AN_ISSUE, kToolbarTypeAll, |
130 0, nil }, | 134 0, nil }, |
131 { IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, kToolsMenuFindInPageId, | 135 { IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, kToolsMenuFindInPageId, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return NO; | 173 return NO; |
170 } | 174 } |
171 } | 175 } |
172 | 176 |
173 if (item.title_id == IDS_IOS_TOOLS_MENU_READING_LIST) { | 177 if (item.title_id == IDS_IOS_TOOLS_MENU_READING_LIST) { |
174 if (!reading_list::switches::IsReadingListEnabled()) { | 178 if (!reading_list::switches::IsReadingListEnabled()) { |
175 return NO; | 179 return NO; |
176 } | 180 } |
177 } | 181 } |
178 | 182 |
| 183 if (item.title_id == IDS_IOS_TOOLS_MENU_SUGGESTIONS) { |
| 184 if (!experimental_flags::IsSuggestionsUIEnabled()) { |
| 185 return NO; |
| 186 } |
| 187 } |
| 188 |
179 if (item.title_id == IDS_IOS_OPTIONS_REPORT_AN_ISSUE) { | 189 if (item.title_id == IDS_IOS_OPTIONS_REPORT_AN_ISSUE) { |
180 if (!ios::GetChromeBrowserProvider() | 190 if (!ios::GetChromeBrowserProvider() |
181 ->GetUserFeedbackProvider() | 191 ->GetUserFeedbackProvider() |
182 ->IsUserFeedbackEnabled()) { | 192 ->IsUserFeedbackEnabled()) { |
183 return NO; | 193 return NO; |
184 } | 194 } |
185 } | 195 } |
186 | 196 |
187 return YES; | 197 return YES; |
188 } | 198 } |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 747 |
738 - (void)unreadCountChanged:(NSInteger)unreadCount { | 748 - (void)unreadCountChanged:(NSInteger)unreadCount { |
739 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; | 749 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; |
740 } | 750 } |
741 | 751 |
742 - (void)unseenStateChanged:(BOOL)unseenItemsExist { | 752 - (void)unseenStateChanged:(BOOL)unseenItemsExist { |
743 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; | 753 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; |
744 } | 754 } |
745 | 755 |
746 @end | 756 @end |
OLD | NEW |