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

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

Issue 1473543002: Implement newly designed sign-in related histograms for desktop platorms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years 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/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "chrome/browser/ui/singleton_tabs.h" 43 #include "chrome/browser/ui/singleton_tabs.h"
44 #include "chrome/browser/ui/user_manager.h" 44 #include "chrome/browser/ui/user_manager.h"
45 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 45 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
46 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 46 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
47 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
48 #include "chrome/common/url_constants.h" 48 #include "chrome/common/url_constants.h"
49 #include "chrome/grit/chromium_strings.h" 49 #include "chrome/grit/chromium_strings.h"
50 #include "chrome/grit/generated_resources.h" 50 #include "chrome/grit/generated_resources.h"
51 #include "components/signin/core/browser/profile_oauth2_token_service.h" 51 #include "components/signin/core/browser/profile_oauth2_token_service.h"
52 #include "components/signin/core/browser/signin_manager.h" 52 #include "components/signin/core/browser/signin_manager.h"
53 #include "components/signin/core/browser/signin_metrics.h"
53 #include "components/signin/core/common/profile_management_switches.h" 54 #include "components/signin/core/common/profile_management_switches.h"
54 #include "content/public/browser/native_web_keyboard_event.h" 55 #include "content/public/browser/native_web_keyboard_event.h"
55 #include "content/public/browser/notification_service.h" 56 #include "content/public/browser/notification_service.h"
56 #include "content/public/browser/render_widget_host_view.h" 57 #include "content/public/browser/render_widget_host_view.h"
57 #include "content/public/browser/web_contents.h" 58 #include "content/public/browser/web_contents.h"
58 #include "google_apis/gaia/oauth2_token_service.h" 59 #include "google_apis/gaia/oauth2_token_service.h"
59 #include "grit/theme_resources.h" 60 #include "grit/theme_resources.h"
60 #include "skia/ext/skia_utils_mac.h" 61 #include "skia/ext/skia_utils_mac.h"
61 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" 62 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
62 #import "ui/base/cocoa/cocoa_base_utils.h" 63 #import "ui/base/cocoa/cocoa_base_utils.h"
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1188
1188 - (void)cleanUpEmbeddedViewContents { 1189 - (void)cleanUpEmbeddedViewContents {
1189 webContents_.reset(); 1190 webContents_.reset();
1190 webContentsDelegate_.reset(); 1191 webContentsDelegate_.reset();
1191 } 1192 }
1192 1193
1193 - (id)initWithBrowser:(Browser*)browser 1194 - (id)initWithBrowser:(Browser*)browser
1194 anchoredAt:(NSPoint)point 1195 anchoredAt:(NSPoint)point
1195 viewMode:(profiles::BubbleViewMode)viewMode 1196 viewMode:(profiles::BubbleViewMode)viewMode
1196 tutorialMode:(profiles::TutorialMode)tutorialMode 1197 tutorialMode:(profiles::TutorialMode)tutorialMode
1197 serviceType:(signin::GAIAServiceType)serviceType { 1198 serviceType:(signin::GAIAServiceType)serviceType
1199 accessPoint:(signin_metrics::AccessPoint)accessPoint {
1198 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] 1200 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc]
1199 initWithContentRect:ui::kWindowSizeDeterminedLater 1201 initWithContentRect:ui::kWindowSizeDeterminedLater
1200 styleMask:NSBorderlessWindowMask 1202 styleMask:NSBorderlessWindowMask
1201 backing:NSBackingStoreBuffered 1203 backing:NSBackingStoreBuffered
1202 defer:NO]); 1204 defer:NO]);
1203 1205
1204 if ((self = [super initWithWindow:window 1206 if ((self = [super initWithWindow:window
1205 parentWindow:browser->window()->GetNativeWindow() 1207 parentWindow:browser->window()->GetNativeWindow()
1206 anchoredAt:point])) { 1208 anchoredAt:point])) {
1207 browser_ = browser; 1209 browser_ = browser;
1208 viewMode_ = viewMode; 1210 viewMode_ = viewMode;
1209 tutorialMode_ = tutorialMode; 1211 tutorialMode_ = tutorialMode;
1210 observer_.reset(new ActiveProfileObserverBridge(self, browser_)); 1212 observer_.reset(new ActiveProfileObserverBridge(self, browser_));
1211 serviceType_ = serviceType; 1213 serviceType_ = serviceType;
1214 accessPoint_ = accessPoint;
1212 1215
1213 avatarMenu_.reset(new AvatarMenu( 1216 avatarMenu_.reset(new AvatarMenu(
1214 &g_browser_process->profile_manager()->GetProfileInfoCache(), 1217 &g_browser_process->profile_manager()->GetProfileInfoCache(),
1215 observer_.get(), 1218 observer_.get(),
1216 browser_)); 1219 browser_));
1217 avatarMenu_->RebuildMenu(); 1220 avatarMenu_->RebuildMenu();
1218 1221
1219 // Guest profiles do not have a token service. 1222 // Guest profiles do not have a token service.
1220 isGuestSession_ = browser_->profile()->IsGuestSession(); 1223 isGuestSession_ = browser_->profile()->IsGuestSession();
1221 1224
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 2072
2070 - (NSView*)buildGaiaEmbeddedView { 2073 - (NSView*)buildGaiaEmbeddedView {
2071 base::scoped_nsobject<NSView> container( 2074 base::scoped_nsobject<NSView> container(
2072 [[NSView alloc] initWithFrame:NSZeroRect]); 2075 [[NSView alloc] initWithFrame:NSZeroRect]);
2073 CGFloat yOffset = 0; 2076 CGFloat yOffset = 0;
2074 2077
2075 GURL url; 2078 GURL url;
2076 int messageId = -1; 2079 int messageId = -1;
2077 switch (viewMode_) { 2080 switch (viewMode_) {
2078 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: 2081 case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN:
2079 url = signin::GetPromoURL(signin_metrics::SOURCE_AVATAR_BUBBLE_SIGN_IN, 2082 url = signin::GetPromoURL(
2080 false /* auto_close */, 2083 accessPoint_, signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT,
2081 true /* is_constrained */); 2084 false /* auto_close */, true /* is_constrained */);
2082 messageId = IDS_PROFILES_GAIA_SIGNIN_TITLE; 2085 messageId = IDS_PROFILES_GAIA_SIGNIN_TITLE;
2083 break; 2086 break;
2084 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT: 2087 case profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT:
2085 url = signin::GetPromoURL( 2088 url = signin::GetPromoURL(
2086 signin_metrics::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT, 2089 accessPoint_, signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT,
2087 false /* auto_close */, 2090 false /* auto_close */, true /* is_constrained */);
2088 true /* is_constrained */);
2089 messageId = IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE; 2091 messageId = IDS_PROFILES_GAIA_ADD_ACCOUNT_TITLE;
2090 break; 2092 break;
2091 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH: 2093 case profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH:
2092 DCHECK(HasAuthError(browser_->profile())); 2094 DCHECK(HasAuthError(browser_->profile()));
2093 url = signin::GetReauthURL( 2095 url = signin::GetReauthURL(
2096 accessPoint_, signin_metrics::Reason::REASON_REAUTHENTICATION,
2094 browser_->profile(), GetAuthErrorAccountId(browser_->profile())); 2097 browser_->profile(), GetAuthErrorAccountId(browser_->profile()));
2095 messageId = IDS_PROFILES_GAIA_REAUTH_TITLE; 2098 messageId = IDS_PROFILES_GAIA_REAUTH_TITLE;
2096 break; 2099 break;
2097 default: 2100 default:
2098 NOTREACHED() << "Called with invalid mode=" << viewMode_; 2101 NOTREACHED() << "Called with invalid mode=" << viewMode_;
2099 break; 2102 break;
2100 } 2103 }
2101 2104
2102 webContents_.reset(content::WebContents::Create( 2105 webContents_.reset(content::WebContents::Create(
2103 content::WebContents::CreateParams(browser_->profile()))); 2106 content::WebContents::CreateParams(browser_->profile())));
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 } 2406 }
2404 2407
2405 - (bool)shouldShowGoIncognito { 2408 - (bool)shouldShowGoIncognito {
2406 bool incognitoAvailable = 2409 bool incognitoAvailable =
2407 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2410 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2408 IncognitoModePrefs::DISABLED; 2411 IncognitoModePrefs::DISABLED;
2409 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 2412 return incognitoAvailable && !browser_->profile()->IsGuestSession();
2410 } 2413 }
2411 2414
2412 @end 2415 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698