Chromium Code Reviews| Index: ios/chrome/browser/ui/context_menu/context_menu_controller.mm |
| diff --git a/ui/base/ios/cru_context_menu_controller.mm b/ios/chrome/browser/ui/context_menu/context_menu_controller.mm |
| similarity index 81% |
| copy from ui/base/ios/cru_context_menu_controller.mm |
| copy to ios/chrome/browser/ui/context_menu/context_menu_controller.mm |
| index d052c99070ab2279a09499754d79e07bb9e327c6..f41b83b195080a665b1f87d534a16b2a3d05f816 100644 |
| --- a/ui/base/ios/cru_context_menu_controller.mm |
| +++ b/ios/chrome/browser/ui/context_menu/context_menu_controller.mm |
| @@ -2,26 +2,26 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#import "ui/base/ios/cru_context_menu_controller.h" |
| +#import "ios/chrome/browser/ui/context_menu/context_menu_controller.h" |
| #include <algorithm> |
| #include "base/ios/weak_nsobject.h" |
| #include "base/logging.h" |
| #import "base/mac/scoped_nsobject.h" |
| +#import "ios/chrome/browser/ui/context_menu/context_menu_holder.h" |
| #include "ui/base/device_form_factor.h" |
| -#import "ui/base/ios/cru_context_menu_holder.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/strings/grit/ui_strings.h" |
| // Abstracts system implementation of popovers and action sheets. |
| -@protocol CRUContextMenuControllerImpl<NSObject> |
| +@protocol ContextMenuControllerImpl<NSObject> |
| // Whether the context menu is visible. |
| @property(nonatomic, readonly, getter=isVisible) BOOL visible; |
| // Displays a context menu. |
| -- (void)showWithHolder:(CRUContextMenuHolder*)menuHolder |
| +- (void)showWithHolder:(ContextMenuHolder*)menuHolder |
| atPoint:(CGPoint)localPoint |
| inView:(UIView*)view; |
| @@ -31,8 +31,8 @@ |
| @end |
| -// Backs up CRUContextMenuController by using UIAlertController. |
| -@interface CRUAlertController : NSObject<CRUContextMenuControllerImpl> { |
| +// Backs up ContextMenuController by using UIAlertController. |
| +@interface AlertController : NSObject<ContextMenuControllerImpl> { |
| // Weak underlying UIAlertController. |
|
sdefresne
2016/04/18 08:47:29
nit: This comment is redundant with "base::WeakNSO
Jackie Quinn
2016/04/19 14:24:27
Done.
|
| base::WeakNSObject<UIAlertController> _alert; |
| } |
| @@ -41,9 +41,9 @@ |
| @end |
| // Displays a context menu. Implements Bridge pattern. |
| -@implementation CRUContextMenuController { |
| +@implementation ContextMenuController { |
| // Implementation specific for iOS version. |
|
sdefresne
2016/04/18 08:47:29
nit: This comment is redundant, this file is in a
Jackie Quinn
2016/04/19 14:24:27
Done.
|
| - base::scoped_nsprotocol<id<CRUContextMenuControllerImpl>> _impl; |
| + base::scoped_nsprotocol<id<ContextMenuControllerImpl>> _impl; |
| } |
| - (BOOL)isVisible { |
| @@ -53,7 +53,7 @@ |
| - (instancetype)init { |
| self = [super init]; |
| if (self) { |
| - _impl.reset([[CRUAlertController alloc] init]); |
| + _impl.reset([[AlertController alloc] init]); |
| } |
| return self; |
| } |
| @@ -63,7 +63,7 @@ |
| [super dealloc]; |
| } |
| -- (void)showWithHolder:(CRUContextMenuHolder*)menuHolder |
| +- (void)showWithHolder:(ContextMenuHolder*)menuHolder |
| atPoint:(CGPoint)point |
| inView:(UIView*)view { |
| DCHECK(menuHolder.itemCount); |
| @@ -81,10 +81,10 @@ |
| @end |
| -@implementation CRUAlertController |
| +@implementation AlertController |
| @synthesize visible = _visible; |
| -- (CGSize)sizeForTitleThatFitsMenuWithHolder:(CRUContextMenuHolder*)menuHolder |
| +- (CGSize)sizeForTitleThatFitsMenuWithHolder:(ContextMenuHolder*)menuHolder |
| atPoint:(CGPoint)point |
| inView:(UIView*)view { |
| // Presenting and dismissing a dummy UIAlertController flushes a screen. |
| @@ -99,7 +99,7 @@ |
| return CGSizeMake(kAvailableWidth, kAvailableHeightPhone); |
| } |
| -- (void)showWithHolder:(CRUContextMenuHolder*)menuHolder |
| +- (void)showWithHolder:(ContextMenuHolder*)menuHolder |
| atPoint:(CGPoint)point |
| inView:(UIView*)view { |
| UIAlertController* alert = [UIAlertController |
| @@ -111,10 +111,9 @@ |
| CGRectMake(point.x, point.y, 1.0, 1.0); |
| // Add the actions. |
| - base::WeakNSObject<CRUAlertController> weakSelf(self); |
| - [menuHolder.itemTitles enumerateObjectsUsingBlock:^(NSString* itemTitle, |
| - NSUInteger itemIndex, |
| - BOOL*) { |
| + base::WeakNSObject<AlertController> weakSelf(self); |
| + [menuHolder.itemTitles enumerateObjectsUsingBlock:^( |
| + NSString* itemTitle, NSUInteger itemIndex, BOOL*) { |
| void (^actionHandler)(UIAlertAction*) = ^(UIAlertAction* action) { |
| [menuHolder performActionAtIndex:itemIndex]; |
| [weakSelf setVisible:NO]; |