| 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/profile_chooser_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> // kVK_Return. | 7 #import <Carbon/Carbon.h> // kVK_Return. |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 | 1187 |
| 1188 - (void)cleanUpEmbeddedViewContents { | 1188 - (void)cleanUpEmbeddedViewContents { |
| 1189 webContents_.reset(); | 1189 webContents_.reset(); |
| 1190 webContentsDelegate_.reset(); | 1190 webContentsDelegate_.reset(); |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 - (id)initWithBrowser:(Browser*)browser | 1193 - (id)initWithBrowser:(Browser*)browser |
| 1194 anchoredAt:(NSPoint)point | 1194 anchoredAt:(NSPoint)point |
| 1195 viewMode:(profiles::BubbleViewMode)viewMode | 1195 viewMode:(profiles::BubbleViewMode)viewMode |
| 1196 tutorialMode:(profiles::TutorialMode)tutorialMode | 1196 tutorialMode:(profiles::TutorialMode)tutorialMode |
| 1197 serviceType:(signin::GAIAServiceType)serviceType { | 1197 serviceType:(signin::GAIAServiceType)serviceType |
| 1198 accessPoint:(signin_metrics::AccessPoint)accessPoint { |
| 1198 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] | 1199 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] |
| 1199 initWithContentRect:ui::kWindowSizeDeterminedLater | 1200 initWithContentRect:ui::kWindowSizeDeterminedLater |
| 1200 styleMask:NSBorderlessWindowMask | 1201 styleMask:NSBorderlessWindowMask |
| 1201 backing:NSBackingStoreBuffered | 1202 backing:NSBackingStoreBuffered |
| 1202 defer:NO]); | 1203 defer:NO]); |
| 1203 | 1204 |
| 1204 if ((self = [super initWithWindow:window | 1205 if ((self = [super initWithWindow:window |
| 1205 parentWindow:browser->window()->GetNativeWindow() | 1206 parentWindow:browser->window()->GetNativeWindow() |
| 1206 anchoredAt:point])) { | 1207 anchoredAt:point])) { |
| 1207 browser_ = browser; | 1208 browser_ = browser; |
| 1208 viewMode_ = viewMode; | 1209 viewMode_ = viewMode; |
| 1209 tutorialMode_ = tutorialMode; | 1210 tutorialMode_ = tutorialMode; |
| 1210 observer_.reset(new ActiveProfileObserverBridge(self, browser_)); | 1211 observer_.reset(new ActiveProfileObserverBridge(self, browser_)); |
| 1211 serviceType_ = serviceType; | 1212 serviceType_ = serviceType; |
| 1213 accessPoint_ = accessPoint; |
| 1212 | 1214 |
| 1213 avatarMenu_.reset(new AvatarMenu( | 1215 avatarMenu_.reset(new AvatarMenu( |
| 1214 &g_browser_process->profile_manager()->GetProfileInfoCache(), | 1216 &g_browser_process->profile_manager()->GetProfileInfoCache(), |
| 1215 observer_.get(), | 1217 observer_.get(), |
| 1216 browser_)); | 1218 browser_)); |
| 1217 avatarMenu_->RebuildMenu(); | 1219 avatarMenu_->RebuildMenu(); |
| 1218 | 1220 |
| 1219 // Guest profiles do not have a token service. | 1221 // Guest profiles do not have a token service. |
| 1220 isGuestSession_ = browser_->profile()->IsGuestSession(); | 1222 isGuestSession_ = browser_->profile()->IsGuestSession(); |
| 1221 | 1223 |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 | 2071 |
| 2070 - (NSView*)buildGaiaEmbeddedView { | 2072 - (NSView*)buildGaiaEmbeddedView { |
| 2071 base::scoped_nsobject<NSView> container( | 2073 base::scoped_nsobject<NSView> container( |
| 2072 [[NSView alloc] initWithFrame:NSZeroRect]); | 2074 [[NSView alloc] initWithFrame:NSZeroRect]); |
| 2073 CGFloat yOffset = 0; | 2075 CGFloat yOffset = 0; |
| 2074 | 2076 |
| 2075 GURL url; | 2077 GURL url; |
| 2076 int messageId = -1; | 2078 int messageId = -1; |
| 2077 switch (viewMode_) { | 2079 switch (viewMode_) { |
| 2078 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: | 2080 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: |
| 2079 url = signin::GetPromoURL(signin_metrics::SOURCE_AVATAR_BUBBLE_SIGN_IN, | 2081 url = signin::GetPromoURL( |
| 2080 false /* auto_close */, | 2082 accessPoint_, signin_metrics::REASON_SIGNIN_PRIMARY_ACCOUNT, |
| 2081 true /* is_constrained */); | 2083 false /* auto_close */, true /* is_constrained */); |
| 2082 messageId = IDS_PROFILES_GAIA_SIGNIN_TITLE; | 2084 messageId = IDS_PROFILES_GAIA_SIGNIN_TITLE; |
| 2083 break; | 2085 break; |
| 2084 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: | 2086 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: |
| 2085 url = signin::GetPromoURL( | 2087 url = signin::GetPromoURL( |
| 2086 signin_metrics::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT, | 2088 accessPoint_, signin_metrics::REASON_ADD_SECONDARY_ACCOUNT, |
| 2087 false /* auto_close */, | 2089 false /* auto_close */, true /* is_constrained */); |
| 2088 true /* is_constrained */); | |
| 2089 messageId = IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE; | 2090 messageId = IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE; |
| 2090 break; | 2091 break; |
| 2091 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: | 2092 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: |
| 2092 DCHECK(HasAuthError(browser_->profile())); | 2093 DCHECK(HasAuthError(browser_->profile())); |
| 2093 url = signin::GetReauthURL( | 2094 url = signin::GetReauthURL( |
| 2095 accessPoint_, signin_metrics::REASON_REAUTHENTICATION, |
| 2094 browser_->profile(), GetAuthErrorAccountId(browser_->profile())); | 2096 browser_->profile(), GetAuthErrorAccountId(browser_->profile())); |
| 2095 messageId = IDS_PROFILES_GAIA_REAUTH_TITLE; | 2097 messageId = IDS_PROFILES_GAIA_REAUTH_TITLE; |
| 2096 break; | 2098 break; |
| 2097 default: | 2099 default: |
| 2098 NOTREACHED() << "Called with invalid mode=" << viewMode_; | 2100 NOTREACHED() << "Called with invalid mode=" << viewMode_; |
| 2099 break; | 2101 break; |
| 2100 } | 2102 } |
| 2101 | 2103 |
| 2102 webContents_.reset(content::WebContents::Create( | 2104 webContents_.reset(content::WebContents::Create( |
| 2103 content::WebContents::CreateParams(browser_->profile()))); | 2105 content::WebContents::CreateParams(browser_->profile()))); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 } | 2405 } |
| 2404 | 2406 |
| 2405 - (bool)shouldShowGoIncognito { | 2407 - (bool)shouldShowGoIncognito { |
| 2406 bool incognitoAvailable = | 2408 bool incognitoAvailable = |
| 2407 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2409 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2408 IncognitoModePrefs::DISABLED; | 2410 IncognitoModePrefs::DISABLED; |
| 2409 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2411 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
| 2410 } | 2412 } |
| 2411 | 2413 |
| 2412 @end | 2414 @end |
| OLD | NEW |