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

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

Issue 2005323002: Remove ContextMenuController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contextMenuWrangler
Patch Set: Created 4 years, 7 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/context_menu_holder.mm
diff --git a/ios/chrome/browser/ui/context_menu/context_menu_holder.mm b/ios/chrome/browser/ui/context_menu/context_menu_holder.mm
deleted file mode 100644
index 52db3155bcc19265abefb991a4281e5fce4df4e0..0000000000000000000000000000000000000000
--- a/ios/chrome/browser/ui/context_menu/context_menu_holder.mm
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "ios/chrome/browser/ui/context_menu/context_menu_holder.h"
-
-#import "base/logging.h"
-#import "base/mac/scoped_nsobject.h"
-
-@implementation ContextMenuHolder {
- // Backs the property of the same name.
- base::scoped_nsobject<NSString> _menuTitle;
- // Stores the itemTitles of the menu items.
- base::scoped_nsobject<NSMutableArray> _itemTitles;
- // Keep a copy of all the actions blocks.
- base::scoped_nsobject<NSMutableArray> _actions;
- // A set of indices in |_actions| that should cause the context menu to be
- // dismissed without animation when tapped.
- base::scoped_nsobject<NSMutableIndexSet> _dismissImmediatelyActions;
-}
-
-- (instancetype)init {
- self = [super init];
- if (self) {
- _itemTitles.reset([[NSMutableArray alloc] init]);
- _actions.reset([[NSMutableArray alloc] init]);
- _dismissImmediatelyActions.reset([[NSMutableIndexSet alloc] init]);
- }
- return self;
-}
-
-- (NSString*)menuTitle {
- return _menuTitle;
-}
-
-- (void)setMenuTitle:(NSString*)newTitle {
- _menuTitle.reset([newTitle copy]);
-}
-
-- (NSArray*)itemTitles {
- return [[_itemTitles copy] autorelease];
-}
-
-- (NSUInteger)itemCount {
- return [_itemTitles count];
-}
-
-- (void)appendItemWithTitle:(NSString*)title action:(ProceduralBlock)action {
- [self appendItemWithTitle:title action:action dismissImmediately:NO];
-}
-
-- (void)appendItemWithTitle:(NSString*)title
- action:(ProceduralBlock)action
- dismissImmediately:(BOOL)dismissImmediately {
- DCHECK(title && action);
- [_itemTitles addObject:title];
- // The action block needs to receive the copy message in order to freeze the
- // stack data it uses. Only then can it be safely retained by the array.
- base::scoped_nsprotocol<id> heapAction([action copy]);
- [_actions addObject:heapAction];
- if (dismissImmediately) {
- [_dismissImmediatelyActions addIndex:[_actions count] - 1];
- }
-}
-
-- (void)performActionAtIndex:(NSUInteger)index {
- static_cast<ProceduralBlock>([_actions objectAtIndex:index])();
-}
-
-- (BOOL)shouldDismissImmediatelyOnClickedAtIndex:(NSUInteger)index {
- return [_dismissImmediatelyActions containsIndex:index];
-}
-
-@end
« no previous file with comments | « ios/chrome/browser/ui/context_menu/context_menu_holder.h ('k') | ios/chrome/browser/ui/context_menu/context_menu_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698