Chromium Code Reviews| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1191 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: | 1191 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: |
| 1192 subView = [self buildGaiaEmbeddedView]; | 1192 subView = [self buildGaiaEmbeddedView]; |
| 1193 break; | 1193 break; |
| 1194 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: | 1194 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL: |
| 1195 subView = [self buildAccountRemovalView]; | 1195 subView = [self buildAccountRemovalView]; |
| 1196 break; | 1196 break; |
| 1197 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: | 1197 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: |
| 1198 subView = [self buildSwitchUserView]; | 1198 subView = [self buildSwitchUserView]; |
| 1199 break; | 1199 break; |
| 1200 case profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER: | 1200 case profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER: |
| 1201 case profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER: | |
| 1201 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT: | 1202 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT: |
| 1202 subView = [self buildProfileChooserView]; | 1203 subView = [self buildProfileChooserView]; |
| 1203 break; | 1204 break; |
| 1204 } | 1205 } |
| 1205 | 1206 |
| 1206 // Clears tutorial mode for all non-profile-chooser views. | 1207 // Clears tutorial mode for all non-profile-chooser views. |
| 1207 if (viewMode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) | 1208 if (viewMode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) |
| 1208 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 1209 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 1209 | 1210 |
| 1210 // Add a dummy, empty element so that we don't initially display any | 1211 // Add a dummy, empty element so that we don't initially display any |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1258 } | 1259 } |
| 1259 } | 1260 } |
| 1260 if (!currentProfileView) // Guest windows don't have an active profile. | 1261 if (!currentProfileView) // Guest windows don't have an active profile. |
| 1261 currentProfileView = [self createGuestProfileView]; | 1262 currentProfileView = [self createGuestProfileView]; |
| 1262 | 1263 |
| 1263 // |yOffset| is the next position at which to draw in |container| | 1264 // |yOffset| is the next position at which to draw in |container| |
| 1264 // coordinates. Add a pixel offset so that the bottom option buttons don't | 1265 // coordinates. Add a pixel offset so that the bottom option buttons don't |
| 1265 // overlap the bubble's rounded corners. | 1266 // overlap the bubble's rounded corners. |
| 1266 CGFloat yOffset = 1; | 1267 CGFloat yOffset = 1; |
| 1267 | 1268 |
| 1268 // Option buttons. | 1269 if(viewMode_ != profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER) { |
|
Alexei Svitkine (slow)
2015/02/02 17:22:31
Space after if
anthonyvd
2015/02/03 21:53:20
Done.
| |
| 1269 NSRect rect = NSMakeRect(0, yOffset, kFixedMenuWidth, 0); | 1270 // Option buttons. |
| 1270 NSView* optionsView = [self createOptionsViewWithRect:rect | 1271 NSRect rect = NSMakeRect(0, yOffset, kFixedMenuWidth, 0); |
| 1271 displayLock:displayLock]; | 1272 NSView* optionsView = [self createOptionsViewWithRect:rect |
| 1272 [container addSubview:optionsView]; | 1273 displayLock:displayLock]; |
| 1273 rect.origin.y = NSMaxY([optionsView frame]); | 1274 [container addSubview:optionsView]; |
| 1275 rect.origin.y = NSMaxY([optionsView frame]); | |
| 1274 | 1276 |
| 1275 NSBox* separator = [self horizontalSeparatorWithFrame:rect]; | 1277 NSBox* separator = [self horizontalSeparatorWithFrame:rect]; |
| 1276 [container addSubview:separator]; | 1278 [container addSubview:separator]; |
| 1277 yOffset = NSMaxY([separator frame]); | 1279 yOffset = NSMaxY([separator frame]); |
| 1280 } | |
| 1278 | 1281 |
| 1279 if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && | 1282 if ((viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER && |
| 1280 switches::IsFastUserSwitching()) { | 1283 switches::IsFastUserSwitching()) || |
|
Alexei Svitkine (slow)
2015/02/02 17:22:30
Nit: Align with viewMode_ above.
anthonyvd
2015/02/03 21:53:20
Done.
| |
| 1284 viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER) { | |
| 1281 // Other profiles switcher. The profiles have already been sorted | 1285 // Other profiles switcher. The profiles have already been sorted |
| 1282 // by their y-coordinate, so they can be added in the existing order. | 1286 // by their y-coordinate, so they can be added in the existing order. |
| 1283 for (NSView *otherProfileView in otherProfiles.get()) { | 1287 for (NSView *otherProfileView in otherProfiles.get()) { |
| 1284 [otherProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; | 1288 [otherProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 1285 [container addSubview:otherProfileView]; | 1289 [container addSubview:otherProfileView]; |
| 1286 yOffset = NSMaxY([otherProfileView frame]); | 1290 yOffset = NSMaxY([otherProfileView frame]); |
| 1287 | 1291 |
| 1288 NSBox* separator = [self horizontalSeparatorWithFrame:NSMakeRect( | 1292 NSBox* separator = [self horizontalSeparatorWithFrame:NSMakeRect( |
| 1289 0, yOffset, kFixedMenuWidth, 0)]; | 1293 0, yOffset, kFixedMenuWidth, 0)]; |
| 1290 [container addSubview:separator]; | 1294 [container addSubview:separator]; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1313 [container addSubview:currentProfileAccountsView]; | 1317 [container addSubview:currentProfileAccountsView]; |
| 1314 yOffset = NSMaxY([currentProfileAccountsView frame]); | 1318 yOffset = NSMaxY([currentProfileAccountsView frame]); |
| 1315 | 1319 |
| 1316 NSBox* accountsSeparator = [self horizontalSeparatorWithFrame: | 1320 NSBox* accountsSeparator = [self horizontalSeparatorWithFrame: |
| 1317 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; | 1321 NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; |
| 1318 [container addSubview:accountsSeparator]; | 1322 [container addSubview:accountsSeparator]; |
| 1319 yOffset = NSMaxY([accountsSeparator frame]); | 1323 yOffset = NSMaxY([accountsSeparator frame]); |
| 1320 } | 1324 } |
| 1321 | 1325 |
| 1322 // Active profile card. | 1326 // Active profile card. |
| 1323 if (currentProfileView) { | 1327 if (viewMode_ != profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER && |
|
Alexei Svitkine (slow)
2015/02/02 17:22:31
Nit: Maybe make a BOOL local variable isFastProfil
anthonyvd
2015/02/03 21:53:20
Done.
| |
| 1328 currentProfileView) { | |
| 1324 yOffset += kVerticalSpacing; | 1329 yOffset += kVerticalSpacing; |
| 1325 [currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; | 1330 [currentProfileView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 1326 [container addSubview:currentProfileView]; | 1331 [container addSubview:currentProfileView]; |
| 1327 yOffset = NSMaxY([currentProfileView frame]) + kVerticalSpacing; | 1332 yOffset = NSMaxY([currentProfileView frame]) + kVerticalSpacing; |
| 1328 } | 1333 } |
| 1329 | 1334 |
| 1330 if (tutorialView) { | 1335 if (viewMode_ != profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER && |
| 1336 tutorialView) { | |
| 1331 [tutorialView setFrameOrigin:NSMakePoint(0, yOffset)]; | 1337 [tutorialView setFrameOrigin:NSMakePoint(0, yOffset)]; |
| 1332 [container addSubview:tutorialView]; | 1338 [container addSubview:tutorialView]; |
| 1333 yOffset = NSMaxY([tutorialView frame]); | 1339 yOffset = NSMaxY([tutorialView frame]); |
| 1334 //TODO(mlerman): update UMA stats for the new tutorials. | 1340 //TODO(mlerman): update UMA stats for the new tutorials. |
| 1335 } else { | 1341 } else { |
| 1336 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; | 1342 tutorialMode_ = profiles::TUTORIAL_MODE_NONE; |
| 1337 } | 1343 } |
| 1338 | 1344 |
| 1339 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; | 1345 [container setFrameSize:NSMakeSize(kFixedMenuWidth, yOffset)]; |
| 1340 return container.autorelease(); | 1346 return container.autorelease(); |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2259 } | 2265 } |
| 2260 | 2266 |
| 2261 - (bool)shouldShowGoIncognito { | 2267 - (bool)shouldShowGoIncognito { |
| 2262 bool incognitoAvailable = | 2268 bool incognitoAvailable = |
| 2263 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2269 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2264 IncognitoModePrefs::DISABLED; | 2270 IncognitoModePrefs::DISABLED; |
| 2265 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2271 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
| 2266 } | 2272 } |
| 2267 | 2273 |
| 2268 @end | 2274 @end |
| OLD | NEW |