| 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_release_properties.h" | 12 #include "base/mac/objc_property_releaser.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/strings/grit/components_strings.h" | 15 #include "components/strings/grit/components_strings.h" |
| 16 #include "ios/chrome/browser/experimental_flags.h" | 16 #include "ios/chrome/browser/experimental_flags.h" |
| 17 #import "ios/chrome/browser/ui/animation_util.h" | 17 #import "ios/chrome/browser/ui/animation_util.h" |
| 18 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 18 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 19 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 19 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 20 #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notification_deleg
ate.h" | 20 #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_notifier.h" | 21 #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notifier.h" |
| 22 #import "ios/chrome/browser/ui/tools_menu/reading_list_menu_view_item.h" | 22 #import "ios/chrome/browser/ui/tools_menu/reading_list_menu_view_item.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 _touchEndPoint = [[touches anyObject] locationInView:self]; | 98 _touchEndPoint = [[touches anyObject] locationInView:self]; |
| 99 [super touchesEnded:touches withEvent:event]; | 99 [super touchesEnded:touches withEvent:event]; |
| 100 } | 100 } |
| 101 | 101 |
| 102 @end | 102 @end |
| 103 | 103 |
| 104 // Class Extension for private methods. | 104 // Class Extension for private methods. |
| 105 @interface ToolsMenuViewController ()<UICollectionViewDelegateFlowLayout, | 105 @interface ToolsMenuViewController ()<UICollectionViewDelegateFlowLayout, |
| 106 UICollectionViewDataSource, | 106 UICollectionViewDataSource, |
| 107 ReadingListMenuNotificationDelegate> { | 107 ReadingListMenuNotificationDelegate> { |
| 108 base::mac::ObjCPropertyReleaser _propertyReleaser_ToolsMenuViewController; |
| 108 BOOL _waitForInk; | 109 BOOL _waitForInk; |
| 109 // Weak pointer to ReadingListMenuNotifier, used to set the starting values | 110 // Weak pointer to ReadingListMenuNotifier, used to set the starting values |
| 110 // for the reading list badge. | 111 // for the reading list badge. |
| 111 base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier; | 112 base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier; |
| 112 } | 113 } |
| 113 @property(nonatomic, retain) ToolsMenuCollectionView* menuView; | 114 @property(nonatomic, retain) ToolsMenuCollectionView* menuView; |
| 114 @property(nonatomic, retain) MDCInkView* touchFeedbackView; | 115 @property(nonatomic, retain) MDCInkView* touchFeedbackView; |
| 115 @property(nonatomic, assign) ToolbarType toolbarType; | 116 @property(nonatomic, assign) ToolbarType toolbarType; |
| 116 | 117 |
| 117 // Returns the reading list cell. | 118 // Returns the reading list cell. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 329 |
| 329 - (instancetype)initWithCoder:(NSCoder*)aDecoder { | 330 - (instancetype)initWithCoder:(NSCoder*)aDecoder { |
| 330 self = [super initWithCoder:aDecoder]; | 331 self = [super initWithCoder:aDecoder]; |
| 331 if (self) | 332 if (self) |
| 332 [self commonInitialization]; | 333 [self commonInitialization]; |
| 333 | 334 |
| 334 return self; | 335 return self; |
| 335 } | 336 } |
| 336 | 337 |
| 337 - (void)commonInitialization { | 338 - (void)commonInitialization { |
| 339 _propertyReleaser_ToolsMenuViewController.Init( |
| 340 self, [ToolsMenuViewController class]); |
| 338 _readingListMenuNotifier.reset(); | 341 _readingListMenuNotifier.reset(); |
| 339 } | 342 } |
| 340 | 343 |
| 341 - (void)dealloc { | |
| 342 base::mac::ReleaseProperties(self); | |
| 343 [super dealloc]; | |
| 344 } | |
| 345 | |
| 346 - (void)loadView { | 344 - (void)loadView { |
| 347 [super loadView]; | 345 [super loadView]; |
| 348 | 346 |
| 349 UIView* rootView = [self view]; | 347 UIView* rootView = [self view]; |
| 350 [rootView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | | 348 [rootView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | |
| 351 UIViewAutoresizingFlexibleWidth]; | 349 UIViewAutoresizingFlexibleWidth]; |
| 352 [rootView setBackgroundColor:[UIColor whiteColor]]; | 350 [rootView setBackgroundColor:[UIColor whiteColor]]; |
| 353 | 351 |
| 354 _touchFeedbackView = [[MDCInkView alloc] initWithFrame:CGRectZero]; | 352 _touchFeedbackView = [[MDCInkView alloc] initWithFrame:CGRectZero]; |
| 355 | 353 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 609 |
| 612 - (void)unreadCountChanged:(NSInteger)unreadCount { | 610 - (void)unreadCountChanged:(NSInteger)unreadCount { |
| 613 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; | 611 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; |
| 614 } | 612 } |
| 615 | 613 |
| 616 - (void)unseenStateChanged:(BOOL)unseenItemsExist { | 614 - (void)unseenStateChanged:(BOOL)unseenItemsExist { |
| 617 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; | 615 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; |
| 618 } | 616 } |
| 619 | 617 |
| 620 @end | 618 @end |
| OLD | NEW |