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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // to the edge of the avatar button. | 115 // to the edge of the avatar button. |
116 int anchorX = switches::IsNewAvatarMenu() ? NSMaxX([anchor bounds]) : | 116 int anchorX = switches::IsNewAvatarMenu() ? NSMaxX([anchor bounds]) : |
117 NSMidX([anchor bounds]); | 117 NSMidX([anchor bounds]); |
118 NSPoint point = NSMakePoint(anchorX, | 118 NSPoint point = NSMakePoint(anchorX, |
119 NSMaxY([anchor bounds]) - kMenuYOffsetAdjust); | 119 NSMaxY([anchor bounds]) - kMenuYOffsetAdjust); |
120 point = [anchor convertPoint:point toView:nil]; | 120 point = [anchor convertPoint:point toView:nil]; |
121 point = [[anchor window] convertBaseToScreen:point]; | 121 point = [[anchor window] convertBaseToScreen:point]; |
122 | 122 |
123 // |menuController_| will automatically release itself on close. | 123 // |menuController_| will automatically release itself on close. |
124 if (switches::IsNewAvatarMenu()) { | 124 if (switches::IsNewAvatarMenu()) { |
125 BubbleViewMode viewMode = | 125 profiles::BubbleViewMode viewMode = |
126 mode == BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT ? | 126 mode == BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT ? |
127 BUBBLE_VIEW_MODE_PROFILE_CHOOSER : | 127 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER : |
128 BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; | 128 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
129 menuController_ = | 129 menuController_ = |
130 [[ProfileChooserController alloc] initWithBrowser:browser_ | 130 [[ProfileChooserController alloc] initWithBrowser:browser_ |
131 anchoredAt:point | 131 anchoredAt:point |
132 withMode:viewMode]; | 132 withMode:viewMode]; |
133 } else { | 133 } else { |
134 menuController_ = | 134 menuController_ = |
135 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 135 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
136 anchoredAt:point]; | 136 anchoredAt:point]; |
137 } | 137 } |
138 | 138 |
(...skipping 25 matching lines...) Expand all Loading... |
164 | 164 |
165 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent { | 165 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent { |
166 NOTREACHED(); | 166 NOTREACHED(); |
167 } | 167 } |
168 | 168 |
169 - (BaseBubbleController*)menuController { | 169 - (BaseBubbleController*)menuController { |
170 return menuController_; | 170 return menuController_; |
171 } | 171 } |
172 | 172 |
173 @end | 173 @end |
OLD | NEW |