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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. Created 4 years, 9 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
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 "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile_attributes_storage.h" 11 #include "chrome/browser/profiles/profile_attributes_storage.h"
12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/profiles/profile_metrics.h" 14 #include "chrome/browser/profiles/profile_metrics.h"
15 #include "chrome/browser/profiles/profile_window.h" 15 #include "chrome/browser/profiles/profile_window.h"
16 #include "chrome/browser/profiles/profiles_state.h" 16 #include "chrome/browser/profiles/profiles_state.h"
17 #include "chrome/browser/signin/chrome_signin_helper.h" 17 #include "chrome/browser/signin/chrome_signin_helper.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_commands.h" 19 #include "chrome/browser/ui/browser_commands.h"
20 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
21 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 21 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
22 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 22 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
23 #import "chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h" 23 #import "chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h"
24 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" 24 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
25 #include "components/signin/core/browser/signin_error_controller.h" 25 #include "components/signin/core/browser/signin_error_controller.h"
26 #include "components/signin/core/common/profile_management_switches.h" 26 #include "components/signin/core/common/profile_management_switches.h"
27 #include "ui/base/cocoa/cocoa_base_utils.h"
27 28
28 // Space between the avatar icon and the avatar menu bubble. 29 // Space between the avatar icon and the avatar menu bubble.
29 const CGFloat kMenuYOffsetAdjust = 1.0; 30 const CGFloat kMenuYOffsetAdjust = 1.0;
30 // Offset needed to align the edge of the avatar bubble with the edge of the 31 // Offset needed to align the edge of the avatar bubble with the edge of the
31 // avatar button. 32 // avatar button.
32 const CGFloat kMenuXOffsetAdjust = 2.0; 33 const CGFloat kMenuXOffsetAdjust = 2.0;
33 34
34 @interface AvatarBaseController (Private) 35 @interface AvatarBaseController (Private)
35 // Shows the avatar bubble. 36 // Shows the avatar bubble.
36 - (IBAction)buttonClicked:(id)sender; 37 - (IBAction)buttonClicked:(id)sender;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 [static_cast<BrowserWindowController*>(wc) 173 [static_cast<BrowserWindowController*>(wc)
173 lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; 174 lockBarVisibilityForOwner:self withAnimation:NO delay:NO];
174 } 175 }
175 176
176 // The new avatar bubble does not have an arrow, and it should be anchored 177 // The new avatar bubble does not have an arrow, and it should be anchored
177 // to the edge of the avatar button. 178 // to the edge of the avatar button.
178 int anchorX = NSMaxX([anchor bounds]) - kMenuXOffsetAdjust; 179 int anchorX = NSMaxX([anchor bounds]) - kMenuXOffsetAdjust;
179 NSPoint point = NSMakePoint(anchorX, 180 NSPoint point = NSMakePoint(anchorX,
180 NSMaxY([anchor bounds]) + kMenuYOffsetAdjust); 181 NSMaxY([anchor bounds]) + kMenuYOffsetAdjust);
181 point = [anchor convertPoint:point toView:nil]; 182 point = [anchor convertPoint:point toView:nil];
182 point = [[anchor window] convertBaseToScreen:point]; 183 point = ui::ConvertPointFromWindowToScreen([anchor window], point);
183 184
184 // |menuController_| will automatically release itself on close. 185 // |menuController_| will automatically release itself on close.
185 profiles::BubbleViewMode viewMode; 186 profiles::BubbleViewMode viewMode;
186 profiles::TutorialMode tutorialMode; 187 profiles::TutorialMode tutorialMode;
187 profiles::BubbleViewModeFromAvatarBubbleMode( 188 profiles::BubbleViewModeFromAvatarBubbleMode(
188 mode, &viewMode, &tutorialMode); 189 mode, &viewMode, &tutorialMode);
189 // Don't start creating the view if it would be an empty fast user switcher. 190 // Don't start creating the view if it would be an empty fast user switcher.
190 // It has to happen here to prevent the view system from creating an empty 191 // It has to happen here to prevent the view system from creating an empty
191 // container. 192 // container.
192 if (viewMode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER && 193 if (viewMode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER &&
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 256 }
256 257
257 - (void)updateErrorStatus:(BOOL)hasError { 258 - (void)updateErrorStatus:(BOOL)hasError {
258 } 259 }
259 260
260 - (BaseBubbleController*)menuController { 261 - (BaseBubbleController*)menuController {
261 return menuController_; 262 return menuController_;
262 } 263 }
263 264
264 @end 265 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/passwords/passwords_bubble_controller.mm ('k') | chrome/browser/ui/cocoa/status_bubble_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698