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

Unified Diff: ios/chrome/browser/ui/tools_menu/tools_menu_context.mm

Issue 2588733002: Upstream Chrome on iOS source code [9/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
Index: ios/chrome/browser/ui/tools_menu/tools_menu_context.mm
diff --git a/ios/chrome/browser/ui/tools_menu/tools_menu_context.mm b/ios/chrome/browser/ui/tools_menu/tools_menu_context.mm
new file mode 100644
index 0000000000000000000000000000000000000000..c1a6d048d6de32fa1dfd3e952259dac9e5c7a95b
--- /dev/null
+++ b/ios/chrome/browser/ui/tools_menu/tools_menu_context.mm
@@ -0,0 +1,69 @@
+// Copyright 2016 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/tools_menu/tools_menu_context.h"
+
+#import "base/ios/weak_nsobject.h"
+#import "base/logging.h"
+#import "ios/chrome/browser/ui/reading_list/reading_list_menu_notifier.h"
+
+@implementation ToolsMenuContext {
+ base::WeakNSObject<UIView> _displayView;
+ base::WeakNSObject<UIButton> _toolsMenuButton;
+ base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier;
+}
+
+@synthesize inTabSwitcher = _inTabSwitcher;
+@synthesize noOpenedTabs = _noOpenedTabs;
+@synthesize inIncognito = _inIncognito;
+
+- (instancetype)initWithDisplayView:(UIView*)displayView {
+ if (self = [super init]) {
+ _displayView.reset(displayView);
+ _readingListMenuNotifier.reset();
+ }
+ return self;
+}
+
+- (instancetype)init {
+ NOTREACHED();
+ return nil;
+}
+
+- (UIEdgeInsets)toolsButtonInsets {
+ return self.toolsMenuButton ? [self.toolsMenuButton imageEdgeInsets]
+ : UIEdgeInsetsZero;
+}
+
+- (CGRect)sourceRect {
+ // Set the origin for the tools popup to the horizontal center of the tools
+ // menu button.
+ return self.toolsMenuButton
+ ? [self.displayView convertRect:self.toolsMenuButton.bounds
+ fromView:self.toolsMenuButton]
+ : CGRectZero;
+}
+
+- (void)setToolsMenuButton:(UIButton*)toolsMenuButton {
+ _toolsMenuButton.reset(toolsMenuButton);
+}
+
+- (UIButton*)toolsMenuButton {
+ return _toolsMenuButton;
+}
+
+- (UIView*)displayView {
+ return _displayView;
+}
+
+- (void)setReadingListMenuNotifier:
+ (ReadingListMenuNotifier*)readingListMenuNotifier {
+ _readingListMenuNotifier.reset(readingListMenuNotifier);
+}
+
+- (ReadingListMenuNotifier*)readingListMenuNotifier {
+ return _readingListMenuNotifier;
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/ui/tools_menu/tools_menu_context.h ('k') | ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698