Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: ios/chrome/browser/ui/context_menu/cru_context_menu_controller.mm

Issue 1891863004: Copy contents of ui/base/ios into ios/chrome/browser/ui/context_menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add to gn Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/context_menu/cru_context_menu_controller.mm
diff --git a/ui/base/ios/cru_context_menu_controller.mm b/ios/chrome/browser/ui/context_menu/cru_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/cru_context_menu_controller.mm
index d052c99070ab2279a09499754d79e07bb9e327c6..6b8fcfdd84d5ef22e0f3ee964315893f53282d7b 100644
--- a/ui/base/ios/cru_context_menu_controller.mm
+++ b/ios/chrome/browser/ui/context_menu/cru_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/cru_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/cru_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.
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.
- 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];

Powered by Google App Engine
This is Rietveld 408576698