| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/mac/objc_property_releaser.h" | 12 #include "base/mac/objc_release_properties.h" |
| 13 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 15 #include "components/reading_list/core/reading_list_switches.h" | 15 #include "components/reading_list/core/reading_list_switches.h" |
| 16 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
| 17 #include "ios/chrome/browser/experimental_flags.h" | 17 #include "ios/chrome/browser/experimental_flags.h" |
| 18 #import "ios/chrome/browser/ui/animation_util.h" | 18 #import "ios/chrome/browser/ui/animation_util.h" |
| 19 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 19 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 20 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 20 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 21 #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notification_deleg
ate.h" | 21 #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notification_deleg
ate.h" |
| 22 #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notifier.h" | 22 #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notifier.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 _touchEndPoint = [[touches anyObject] locationInView:self]; | 246 _touchEndPoint = [[touches anyObject] locationInView:self]; |
| 247 [super touchesEnded:touches withEvent:event]; | 247 [super touchesEnded:touches withEvent:event]; |
| 248 } | 248 } |
| 249 | 249 |
| 250 @end | 250 @end |
| 251 | 251 |
| 252 // Class Extension for private methods. | 252 // Class Extension for private methods. |
| 253 @interface ToolsMenuViewController ()<UICollectionViewDelegateFlowLayout, | 253 @interface ToolsMenuViewController ()<UICollectionViewDelegateFlowLayout, |
| 254 UICollectionViewDataSource, | 254 UICollectionViewDataSource, |
| 255 ReadingListMenuNotificationDelegate> { | 255 ReadingListMenuNotificationDelegate> { |
| 256 base::mac::ObjCPropertyReleaser _propertyReleaser_ToolsMenuViewController; | |
| 257 BOOL _waitForInk; | 256 BOOL _waitForInk; |
| 258 // Weak pointer to ReadingListMenuNotifier, used to set the starting values | 257 // Weak pointer to ReadingListMenuNotifier, used to set the starting values |
| 259 // for the reading list badge. | 258 // for the reading list badge. |
| 260 base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier; | 259 base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier; |
| 261 } | 260 } |
| 262 @property(nonatomic, retain) ToolsMenuCollectionView* menuView; | 261 @property(nonatomic, retain) ToolsMenuCollectionView* menuView; |
| 263 @property(nonatomic, retain) MDCInkView* touchFeedbackView; | 262 @property(nonatomic, retain) MDCInkView* touchFeedbackView; |
| 264 @property(nonatomic, retain) NSMutableArray* menuItems; | 263 @property(nonatomic, retain) NSMutableArray* menuItems; |
| 265 @property(nonatomic, assign) kToolbarType toolbarType; | 264 @property(nonatomic, assign) kToolbarType toolbarType; |
| 266 | 265 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 466 |
| 468 - (instancetype)initWithCoder:(NSCoder*)aDecoder { | 467 - (instancetype)initWithCoder:(NSCoder*)aDecoder { |
| 469 self = [super initWithCoder:aDecoder]; | 468 self = [super initWithCoder:aDecoder]; |
| 470 if (self) | 469 if (self) |
| 471 [self commonInitialization]; | 470 [self commonInitialization]; |
| 472 | 471 |
| 473 return self; | 472 return self; |
| 474 } | 473 } |
| 475 | 474 |
| 476 - (void)commonInitialization { | 475 - (void)commonInitialization { |
| 477 _propertyReleaser_ToolsMenuViewController.Init( | |
| 478 self, [ToolsMenuViewController class]); | |
| 479 _readingListMenuNotifier.reset(); | 476 _readingListMenuNotifier.reset(); |
| 480 } | 477 } |
| 481 | 478 |
| 479 - (void)dealloc { |
| 480 base::mac::ReleaseProperties(self); |
| 481 [super dealloc]; |
| 482 } |
| 483 |
| 482 - (void)loadView { | 484 - (void)loadView { |
| 483 [super loadView]; | 485 [super loadView]; |
| 484 | 486 |
| 485 UIView* rootView = [self view]; | 487 UIView* rootView = [self view]; |
| 486 [rootView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | | 488 [rootView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | |
| 487 UIViewAutoresizingFlexibleWidth]; | 489 UIViewAutoresizingFlexibleWidth]; |
| 488 [rootView setBackgroundColor:[UIColor whiteColor]]; | 490 [rootView setBackgroundColor:[UIColor whiteColor]]; |
| 489 | 491 |
| 490 _touchFeedbackView = [[MDCInkView alloc] initWithFrame:CGRectZero]; | 492 _touchFeedbackView = [[MDCInkView alloc] initWithFrame:CGRectZero]; |
| 491 | 493 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 749 |
| 748 - (void)unreadCountChanged:(NSInteger)unreadCount { | 750 - (void)unreadCountChanged:(NSInteger)unreadCount { |
| 749 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; | 751 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; |
| 750 } | 752 } |
| 751 | 753 |
| 752 - (void)unseenStateChanged:(BOOL)unseenItemsExist { | 754 - (void)unseenStateChanged:(BOOL)unseenItemsExist { |
| 753 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; | 755 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; |
| 754 } | 756 } |
| 755 | 757 |
| 756 @end | 758 @end |
| OLD | NEW |