| 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 19 matching lines...) Expand all Loading... |
| 30 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 30 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 31 #import "ios/chrome/common/material_timing.h" | 31 #import "ios/chrome/common/material_timing.h" |
| 32 #include "ios/chrome/grit/ios_strings.h" | 32 #include "ios/chrome/grit/ios_strings.h" |
| 33 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 33 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 34 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" | 34 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" |
| 35 #import "ios/third_party/material_components_ios/src/components/Ink/src/Material
Ink.h" | 35 #import "ios/third_party/material_components_ios/src/components/Ink/src/Material
Ink.h" |
| 36 #include "ios/web/public/user_agent.h" | 36 #include "ios/web/public/user_agent.h" |
| 37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| 38 #include "ui/base/l10n/l10n_util_mac.h" | 38 #include "ui/base/l10n/l10n_util_mac.h" |
| 39 | 39 |
| 40 // TODO(crbug.com/678047) Remove this switch when request mobile site | |
| 41 // functionality is implemented. | |
| 42 #define HIDE_REQUEST_MOBILE_SITE_CELL | |
| 43 | |
| 44 using ios::material::TimingFunction; | 40 using ios::material::TimingFunction; |
| 45 | 41 |
| 46 namespace { | 42 namespace { |
| 47 | 43 |
| 48 // Time for ink to fade into view. | 44 // Time for ink to fade into view. |
| 49 static const NSTimeInterval kMDCInkTouchDelayInterval = 0.15; | 45 static const NSTimeInterval kMDCInkTouchDelayInterval = 0.15; |
| 50 | 46 |
| 51 static const CGFloat kMenuItemHeight = 48; | 47 static const CGFloat kMenuItemHeight = 48; |
| 52 | 48 |
| 53 static NSString* const kToolsItemCellID = @"ToolsItemCellID"; | 49 static NSString* const kToolsItemCellID = @"ToolsItemCellID"; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // "Request Desktop Site" and "Request Mobile Site". | 262 // "Request Desktop Site" and "Request Mobile Site". |
| 267 switch (configuration.userAgentType) { | 263 switch (configuration.userAgentType) { |
| 268 case web::UserAgentType::NONE: | 264 case web::UserAgentType::NONE: |
| 269 [self setItemEnabled:NO withTag:IDC_REQUEST_DESKTOP_SITE]; | 265 [self setItemEnabled:NO withTag:IDC_REQUEST_DESKTOP_SITE]; |
| 270 break; | 266 break; |
| 271 case web::UserAgentType::MOBILE: | 267 case web::UserAgentType::MOBILE: |
| 272 [self setItemEnabled:YES withTag:IDC_REQUEST_DESKTOP_SITE]; | 268 [self setItemEnabled:YES withTag:IDC_REQUEST_DESKTOP_SITE]; |
| 273 break; | 269 break; |
| 274 case web::UserAgentType::DESKTOP: | 270 case web::UserAgentType::DESKTOP: |
| 275 [self setItemEnabled:YES withTag:IDC_REQUEST_MOBILE_SITE]; | 271 [self setItemEnabled:YES withTag:IDC_REQUEST_MOBILE_SITE]; |
| 276 | |
| 277 // TODO(crbug.com/678047) Remove this switch when request mobile site | |
| 278 // functionality is implemented. | |
| 279 #ifdef HIDE_REQUEST_MOBILE_SITE_CELL | |
| 280 [self setItemEnabled:NO withTag:IDC_REQUEST_DESKTOP_SITE]; | |
| 281 #endif | |
| 282 break; | 272 break; |
| 283 } | 273 } |
| 284 | 274 |
| 285 // Disable IDC_CLOSE_ALL_TABS menu item if on phone with no tabs. | 275 // Disable IDC_CLOSE_ALL_TABS menu item if on phone with no tabs. |
| 286 if (!IsIPadIdiom()) { | 276 if (!IsIPadIdiom()) { |
| 287 [self setItemEnabled:!configuration.hasNoOpenedTabs | 277 [self setItemEnabled:!configuration.hasNoOpenedTabs |
| 288 withTag:IDC_CLOSE_ALL_TABS]; | 278 withTag:IDC_CLOSE_ALL_TABS]; |
| 289 } | 279 } |
| 290 } | 280 } |
| 291 | 281 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 609 |
| 620 - (void)unreadCountChanged:(NSInteger)unreadCount { | 610 - (void)unreadCountChanged:(NSInteger)unreadCount { |
| 621 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; | 611 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; |
| 622 } | 612 } |
| 623 | 613 |
| 624 - (void)unseenStateChanged:(BOOL)unseenItemsExist { | 614 - (void)unseenStateChanged:(BOOL)unseenItemsExist { |
| 625 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; | 615 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; |
| 626 } | 616 } |
| 627 | 617 |
| 628 @end | 618 @end |
| OLD | NEW |