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

Side by Side Diff: ios/chrome/browser/ui/tools_menu/tools_menu_configuration.mm

Issue 2815233002: [ios] Move ToolsMenuConfiguration to shared. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/ui/tools_menu/tools_menu_configuration.h"
6
7 #import "base/ios/weak_nsobject.h"
8 #import "base/logging.h"
9 #import "ios/chrome/browser/ui/reading_list/reading_list_menu_notifier.h"
10 #include "ios/web/public/user_agent.h"
11
12 @implementation ToolsMenuConfiguration {
13 base::WeakNSObject<UIView> _displayView;
14 base::WeakNSObject<UIButton> _toolsMenuButton;
15 base::WeakNSObject<ReadingListMenuNotifier> _readingListMenuNotifier;
16 }
17
18 @synthesize inTabSwitcher = _inTabSwitcher;
19 @synthesize noOpenedTabs = _noOpenedTabs;
20 @synthesize inIncognito = _inIncognito;
21 @synthesize userAgentType = _userAgentType;
22
23 - (instancetype)initWithDisplayView:(UIView*)displayView {
24 if (self = [super init]) {
25 _userAgentType = web::UserAgentType::NONE;
26 _displayView.reset(displayView);
27 _readingListMenuNotifier.reset();
28 }
29 return self;
30 }
31
32 - (instancetype)init {
33 NOTREACHED();
34 return nil;
35 }
36
37 - (UIEdgeInsets)toolsButtonInsets {
38 return self.toolsMenuButton ? [self.toolsMenuButton imageEdgeInsets]
39 : UIEdgeInsetsZero;
40 }
41
42 - (CGRect)sourceRect {
43 // Set the origin for the tools popup to the horizontal center of the tools
44 // menu button.
45 return self.toolsMenuButton
46 ? [self.displayView convertRect:self.toolsMenuButton.bounds
47 fromView:self.toolsMenuButton]
48 : CGRectZero;
49 }
50
51 - (void)setToolsMenuButton:(UIButton*)toolsMenuButton {
52 _toolsMenuButton.reset(toolsMenuButton);
53 }
54
55 - (UIButton*)toolsMenuButton {
56 return _toolsMenuButton;
57 }
58
59 - (UIView*)displayView {
60 return _displayView;
61 }
62
63 - (void)setReadingListMenuNotifier:
64 (ReadingListMenuNotifier*)readingListMenuNotifier {
65 _readingListMenuNotifier.reset(readingListMenuNotifier);
66 }
67
68 - (ReadingListMenuNotifier*)readingListMenuNotifier {
69 return _readingListMenuNotifier;
70 }
71
72 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698