| 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/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; | |
| 109 BOOL _waitForInk; | 108 BOOL _waitForInk; |
| 110 // Weak pointer to ReadingListMenuNotifier, used to set the starting values | 109 // Weak pointer to ReadingListMenuNotifier, used to set the starting values |
| 111 // for the reading list badge. | 110 // for the reading list badge. |
| 112 base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier; | 111 base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier; |
| 113 } | 112 } |
| 114 @property(nonatomic, retain) ToolsMenuCollectionView* menuView; | 113 @property(nonatomic, retain) ToolsMenuCollectionView* menuView; |
| 115 @property(nonatomic, retain) MDCInkView* touchFeedbackView; | 114 @property(nonatomic, retain) MDCInkView* touchFeedbackView; |
| 116 @property(nonatomic, assign) ToolbarType toolbarType; | 115 @property(nonatomic, assign) ToolbarType toolbarType; |
| 117 | 116 |
| 118 // Returns the reading list cell. | 117 // Returns the reading list cell. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 328 |
| 330 - (instancetype)initWithCoder:(NSCoder*)aDecoder { | 329 - (instancetype)initWithCoder:(NSCoder*)aDecoder { |
| 331 self = [super initWithCoder:aDecoder]; | 330 self = [super initWithCoder:aDecoder]; |
| 332 if (self) | 331 if (self) |
| 333 [self commonInitialization]; | 332 [self commonInitialization]; |
| 334 | 333 |
| 335 return self; | 334 return self; |
| 336 } | 335 } |
| 337 | 336 |
| 338 - (void)commonInitialization { | 337 - (void)commonInitialization { |
| 339 _propertyReleaser_ToolsMenuViewController.Init( | |
| 340 self, [ToolsMenuViewController class]); | |
| 341 _readingListMenuNotifier.reset(); | 338 _readingListMenuNotifier.reset(); |
| 342 } | 339 } |
| 343 | 340 |
| 341 - (void)dealloc { |
| 342 base::mac::ReleaseProperties(self); |
| 343 [super dealloc]; |
| 344 } |
| 345 |
| 344 - (void)loadView { | 346 - (void)loadView { |
| 345 [super loadView]; | 347 [super loadView]; |
| 346 | 348 |
| 347 UIView* rootView = [self view]; | 349 UIView* rootView = [self view]; |
| 348 [rootView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | | 350 [rootView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | |
| 349 UIViewAutoresizingFlexibleWidth]; | 351 UIViewAutoresizingFlexibleWidth]; |
| 350 [rootView setBackgroundColor:[UIColor whiteColor]]; | 352 [rootView setBackgroundColor:[UIColor whiteColor]]; |
| 351 | 353 |
| 352 _touchFeedbackView = [[MDCInkView alloc] initWithFrame:CGRectZero]; | 354 _touchFeedbackView = [[MDCInkView alloc] initWithFrame:CGRectZero]; |
| 353 | 355 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 611 |
| 610 - (void)unreadCountChanged:(NSInteger)unreadCount { | 612 - (void)unreadCountChanged:(NSInteger)unreadCount { |
| 611 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; | 613 [[self readingListCell] updateBadgeCount:unreadCount animated:YES]; |
| 612 } | 614 } |
| 613 | 615 |
| 614 - (void)unseenStateChanged:(BOOL)unseenItemsExist { | 616 - (void)unseenStateChanged:(BOOL)unseenItemsExist { |
| 615 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; | 617 [[self readingListCell] updateSeenState:unseenItemsExist animated:YES]; |
| 616 } | 618 } |
| 617 | 619 |
| 618 @end | 620 @end |
| OLD | NEW |