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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h

Issue 1407103008: mac: Stop using __weak. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no ifdef Created 5 years, 1 month 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_MENU_BUBBLE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_MENU_BUBBLE_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_MENU_BUBBLE_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_MENU_BUBBLE_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 - (IBAction)switchProfile:(id)sender; 48 - (IBAction)switchProfile:(id)sender;
49 49
50 @end 50 @end
51 51
52 //////////////////////////////////////////////////////////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////////
53 53
54 // This view controller manages the menu item XIB. 54 // This view controller manages the menu item XIB.
55 @interface AvatarMenuItemController : NSViewController<NSAnimationDelegate> { 55 @interface AvatarMenuItemController : NSViewController<NSAnimationDelegate> {
56 @private 56 @private
57 // The parent menu controller; owns this. 57 // The parent menu controller; owns this.
58 __weak AvatarMenuBubbleController* controller_; 58 AvatarMenuBubbleController* controller_; // weak
59 59
60 // The index of the item in the AvatarMenu. 60 // The index of the item in the AvatarMenu.
61 size_t menuIndex_; 61 size_t menuIndex_;
62 62
63 // Tracks whether this item is currently highlighted. 63 // Tracks whether this item is currently highlighted.
64 BOOL isHighlighted_; 64 BOOL isHighlighted_;
65 65
66 // The animation showing the edit link, which is run after the user has 66 // The animation showing the edit link, which is run after the user has
67 // dwelled over the item for a short delay. 67 // dwelled over the item for a short delay.
68 base::scoped_nsobject<NSAnimation> linkAnimation_; 68 base::scoped_nsobject<NSAnimation> linkAnimation_;
69 69
70 // Instance variables that back the outlets. 70 // Instance variables that back the outlets.
71 __weak NSImageView* iconView_; 71 NSImageView* iconView_;
72 __weak NSImageView* activeView_; 72 NSImageView* activeView_;
73 __weak NSTextField* nameField_; 73 NSTextField* nameField_;
74 // These two views sit on top of each other, and only one is visible at a 74 // These two views sit on top of each other, and only one is visible at a
75 // time. The editButton_ is visible when the mouse is over the item and the 75 // time. The editButton_ is visible when the mouse is over the item and the
76 // emailField_ is visible otherwise. 76 // emailField_ is visible otherwise.
77 __weak NSTextField* emailField_; 77 NSTextField* emailField_;
78 __weak NSButton* editButton_; 78 NSButton* editButton_;
79 } 79 }
80 @property(readonly, nonatomic) size_t menuIndex; 80 @property(readonly, nonatomic) size_t menuIndex;
81 @property(assign, nonatomic) BOOL isHighlighted; 81 @property(assign, nonatomic) BOOL isHighlighted;
82 @property(assign, nonatomic) IBOutlet NSImageView* iconView; 82 @property(readonly, nonatomic) IBOutlet NSImageView* iconView;
Robert Sesek 2015/11/03 15:41:11 Why the change from assign -> readonly? That doesn
Nico 2015/11/03 16:01:18 It can't stay assign without the __weak. I could c
Robert Sesek 2015/11/03 22:03:51 If they're now retained, won't they be leaked? (Ma
Nico 2015/11/03 22:15:58 Done.
83 @property(assign, nonatomic) IBOutlet NSImageView* activeView; 83 @property(readonly, nonatomic) IBOutlet NSImageView* activeView;
84 @property(assign, nonatomic) IBOutlet NSTextField* nameField; 84 @property(readonly, nonatomic) IBOutlet NSTextField* nameField;
85 @property(assign, nonatomic) IBOutlet NSTextField* emailField; 85 @property(readonly, nonatomic) IBOutlet NSTextField* emailField;
86 @property(assign, nonatomic) IBOutlet NSButton* editButton; 86 @property(readonly, nonatomic) IBOutlet NSButton* editButton;
87 87
88 // Designated initializer. 88 // Designated initializer.
89 - (id)initWithMenuIndex:(size_t)menuIndex 89 - (id)initWithMenuIndex:(size_t)menuIndex
90 menuController:(AvatarMenuBubbleController*)controller; 90 menuController:(AvatarMenuBubbleController*)controller;
91 91
92 // Actions that are forwarded to the |controller_|. 92 // Actions that are forwarded to the |controller_|.
93 - (IBAction)switchToProfile:(id)sender; 93 - (IBAction)switchToProfile:(id)sender;
94 - (IBAction)editProfile:(id)sender; 94 - (IBAction)editProfile:(id)sender;
95 95
96 // Highlights the subviews appropriately for a given event type from the switch 96 // Highlights the subviews appropriately for a given event type from the switch
97 // profile button. 97 // profile button.
98 - (void)highlightForEventType:(NSEventType)type; 98 - (void)highlightForEventType:(NSEventType)type;
99 99
100 @end 100 @end
101 101
102 //////////////////////////////////////////////////////////////////////////////// 102 ////////////////////////////////////////////////////////////////////////////////
103 103
104 // Simple button cell to get tracking and mouse events forwarded back to the 104 // Simple button cell to get tracking and mouse events forwarded back to the
105 // view controller for changing highlight style of the item subviews. This is 105 // view controller for changing highlight style of the item subviews. This is
106 // an invisible button that underlays most of the menu item and is responsible 106 // an invisible button that underlays most of the menu item and is responsible
107 // for performing the switch profile action. 107 // for performing the switch profile action.
108 @interface AvatarMenuItemView : NSView { 108 @interface AvatarMenuItemView : NSView {
109 @private 109 @private
110 // The controller that manages this. 110 // The controller that manages this.
111 __weak AvatarMenuItemController* viewController_; 111 // weak to not form a reference cycle with the controller.
112 __unsafe_unretained AvatarMenuItemController* viewController_;
112 113
113 // Used to highlight the background on hover. 114 // Used to highlight the background on hover.
114 ui::ScopedCrTrackingArea trackingArea_; 115 ui::ScopedCrTrackingArea trackingArea_;
115 } 116 }
116 @property(assign, nonatomic) IBOutlet AvatarMenuItemController* viewController; 117 @property(assign, nonatomic) IBOutlet AvatarMenuItemController* viewController;
117 @end 118 @end
118 119
119 //////////////////////////////////////////////////////////////////////////////// 120 ////////////////////////////////////////////////////////////////////////////////
120 121
121 @interface AccessibilityIgnoredImageCell : NSImageCell 122 @interface AccessibilityIgnoredImageCell : NSImageCell
(...skipping 10 matching lines...) Expand all
132 anchoredAt:(NSPoint)point; 133 anchoredAt:(NSPoint)point;
133 - (void)performLayout; 134 - (void)performLayout;
134 - (NSMutableArray*)items; 135 - (NSMutableArray*)items;
135 @end 136 @end
136 137
137 @interface AvatarMenuItemController (ExposedForTesting) 138 @interface AvatarMenuItemController (ExposedForTesting)
138 - (void)willStartAnimation:(NSAnimation*)animation; 139 - (void)willStartAnimation:(NSAnimation*)animation;
139 @end 140 @end
140 141
141 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_MENU_BUBBLE_CONTROLLER_H_ 142 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_AVATAR_MENU_BUBBLE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698