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

Unified Diff: ios/chrome/browser/ui/popup_menu/popup_menu_view.mm

Issue 2589803002: Upstream Chrome on iOS source code [6/11]. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « ios/chrome/browser/ui/popup_menu/popup_menu_view.h ('k') | ios/chrome/browser/ui/preload_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/popup_menu/popup_menu_view.mm
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_view.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_view.mm
new file mode 100644
index 0000000000000000000000000000000000000000..4115e90cefc02db2aa522e836f5c95ec77ae706b
--- /dev/null
+++ b/ios/chrome/browser/ui/popup_menu/popup_menu_view.mm
@@ -0,0 +1,63 @@
+// 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/popup_menu/popup_menu_view.h"
+
+#import <QuartzCore/QuartzCore.h>
+
+#include "base/mac/scoped_nsobject.h"
+
+namespace {
+// The image edge insets for popup_background.png.
+NS_INLINE UIEdgeInsets PopupBackgroundInsets() {
+ return UIEdgeInsetsMake(28, 28, 28, 28);
+}
+};
+
+@implementation PopupMenuView {
+ base::scoped_nsobject<UIImageView> imageView_;
+}
+
+@synthesize delegate = delegate_;
+
+- (instancetype)initWithFrame:(CGRect)frame {
+ self = [super initWithFrame:frame];
+ if (self)
+ [self commonInitialization];
+
+ return self;
+}
+
+- (instancetype)initWithCoder:(NSCoder*)aDecoder {
+ self = [super initWithCoder:aDecoder];
+ if (self)
+ [self commonInitialization];
+
+ return self;
+}
+
+- (void)commonInitialization {
+ UIImage* image = [UIImage imageNamed:@"popup_background"];
+ image = [image resizableImageWithCapInsets:PopupBackgroundInsets()];
+
+ imageView_.reset([[UIImageView alloc] initWithImage:image]);
+ [self addSubview:imageView_];
+}
+
+- (void)layoutSubviews {
+ [super layoutSubviews];
+ [imageView_ setFrame:[self bounds]];
+}
+
+- (BOOL)accessibilityPerformEscape {
+ if (delegate_) {
+ [delegate_ dismissPopupMenu];
+ UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,
+ nil);
+ return YES;
+ }
+ return NO;
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/ui/popup_menu/popup_menu_view.h ('k') | ios/chrome/browser/ui/preload_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698