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

Unified Diff: ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm

Issue 2862783002: [iOS Clean] Wired up ContextMenuCommands. (Closed)
Patch Set: fix deps Created 3 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/clean/chrome/browser/ui/context_menu/context_menu_item.mm
diff --git a/ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm b/ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm
new file mode 100644
index 0000000000000000000000000000000000000000..7af094159c5970b1fb9637519dabe113c4e27dfe
--- /dev/null
+++ b/ios/clean/chrome/browser/ui/context_menu/context_menu_item.mm
@@ -0,0 +1,48 @@
+// Copyright 2017 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/clean/chrome/browser/ui/context_menu/context_menu_item.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface ContextMenuItem () {
+ // Backing object for |commands|.
+ std::vector<SEL> _commands;
+}
+
+// Convenience initializer for use by the factory method.
+- (instancetype)initWithTitle:(NSString*)title
+ commands:(const std::vector<SEL>&)commands;
+
+@end
+
+@implementation ContextMenuItem
+
+@synthesize title = _title;
+
+- (instancetype)initWithTitle:(NSString*)title
+ commands:(const std::vector<SEL>&)commands {
+ if ((self = [super init])) {
+ _title = [title copy];
+ _commands = commands;
+ }
+ return self;
+}
+
+#pragma mark - Accessors
+
+- (const std::vector<SEL>&)commands {
+ return _commands;
+}
+
+#pragma mark - Public
+
++ (instancetype)itemWithTitle:(NSString*)title
+ commands:(const std::vector<SEL>&)commands {
+ return [[ContextMenuItem alloc] initWithTitle:title commands:commands];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698