OLD | NEW |
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 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 9 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 int anchorX = switches::IsNewAvatarMenu() ? | 158 int anchorX = switches::IsNewAvatarMenu() ? |
159 NSMaxX([anchor bounds]) - kMenuXOffsetAdjust : | 159 NSMaxX([anchor bounds]) - kMenuXOffsetAdjust : |
160 NSMidX([anchor bounds]); | 160 NSMidX([anchor bounds]); |
161 NSPoint point = NSMakePoint(anchorX, | 161 NSPoint point = NSMakePoint(anchorX, |
162 NSMaxY([anchor bounds]) - kMenuYOffsetAdjust); | 162 NSMaxY([anchor bounds]) - kMenuYOffsetAdjust); |
163 point = [anchor convertPoint:point toView:nil]; | 163 point = [anchor convertPoint:point toView:nil]; |
164 point = [[anchor window] convertBaseToScreen:point]; | 164 point = [[anchor window] convertBaseToScreen:point]; |
165 | 165 |
166 // |menuController_| will automatically release itself on close. | 166 // |menuController_| will automatically release itself on close. |
167 if (switches::IsNewAvatarMenu()) { | 167 if (switches::IsNewAvatarMenu()) { |
168 profiles::BubbleViewMode viewMode = | 168 profiles::BubbleViewMode viewMode; |
169 profiles::BubbleViewModeFromAvatarBubbleMode(mode); | 169 profiles::TutorialMode tutorialMode; |
| 170 profiles::BubbleViewModeFromAvatarBubbleMode( |
| 171 mode, &viewMode, &tutorialMode); |
170 menuController_ = | 172 menuController_ = |
171 [[ProfileChooserController alloc] initWithBrowser:browser_ | 173 [[ProfileChooserController alloc] initWithBrowser:browser_ |
172 anchoredAt:point | 174 anchoredAt:point |
173 withMode:viewMode | 175 viewMode:viewMode |
174 withServiceType:serviceType]; | 176 tutorialMode:tutorialMode |
| 177 serviceType:serviceType]; |
175 } else { | 178 } else { |
176 menuController_ = | 179 menuController_ = |
177 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 180 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
178 anchoredAt:point]; | 181 anchoredAt:point]; |
179 } | 182 } |
180 | 183 |
181 [[NSNotificationCenter defaultCenter] | 184 [[NSNotificationCenter defaultCenter] |
182 addObserver:self | 185 addObserver:self |
183 selector:@selector(bubbleWillClose:) | 186 selector:@selector(bubbleWillClose:) |
184 name:NSWindowWillCloseNotification | 187 name:NSWindowWillCloseNotification |
(...skipping 25 matching lines...) Expand all Loading... |
210 } | 213 } |
211 | 214 |
212 - (void)updateErrorStatus:(BOOL)hasError { | 215 - (void)updateErrorStatus:(BOOL)hasError { |
213 } | 216 } |
214 | 217 |
215 - (BaseBubbleController*)menuController { | 218 - (BaseBubbleController*)menuController { |
216 return menuController_; | 219 return menuController_; |
217 } | 220 } |
218 | 221 |
219 @end | 222 @end |
OLD | NEW |