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

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

Issue 467853002: Suppress the upgrade tutorial for new profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: roger's comments addressed Created 6 years, 4 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 | Annotate | Revision Log
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 <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"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/first_run/first_run.h"
16 #include "chrome/browser/lifetime/application_lifetime.h" 15 #include "chrome/browser/lifetime/application_lifetime.h"
17 #include "chrome/browser/prefs/incognito_mode_prefs.h" 16 #include "chrome/browser/prefs/incognito_mode_prefs.h"
18 #include "chrome/browser/profiles/avatar_menu.h" 17 #include "chrome/browser/profiles/avatar_menu.h"
19 #include "chrome/browser/profiles/avatar_menu_observer.h" 18 #include "chrome/browser/profiles/avatar_menu_observer.h"
20 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 19 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
21 #include "chrome/browser/profiles/profile_info_cache.h" 20 #include "chrome/browser/profiles/profile_info_cache.h"
22 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/profiles/profile_metrics.h" 22 #include "chrome/browser/profiles/profile_metrics.h"
24 #include "chrome/browser/profiles/profile_window.h" 23 #include "chrome/browser/profiles/profile_window.h"
25 #include "chrome/browser/profiles/profiles_state.h" 24 #include "chrome/browser/profiles/profiles_state.h"
26 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
27 #include "chrome/browser/signin/signin_header_helper.h" 26 #include "chrome/browser/signin/signin_header_helper.h"
28 #include "chrome/browser/signin/signin_manager_factory.h" 27 #include "chrome/browser/signin/signin_manager_factory.h"
29 #include "chrome/browser/signin/signin_promo.h" 28 #include "chrome/browser/signin/signin_promo.h"
29 #include "chrome/browser/signin/signin_ui_util.h"
30 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
31 #include "chrome/browser/ui/browser_commands.h" 31 #include "chrome/browser/ui/browser_commands.h"
32 #include "chrome/browser/ui/browser_dialogs.h" 32 #include "chrome/browser/ui/browser_dialogs.h"
33 #include "chrome/browser/ui/browser_window.h" 33 #include "chrome/browser/ui/browser_window.h"
34 #include "chrome/browser/ui/chrome_pages.h" 34 #include "chrome/browser/ui/chrome_pages.h"
35 #include "chrome/browser/ui/chrome_style.h" 35 #include "chrome/browser/ui/chrome_style.h"
36 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 36 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
37 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 37 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
38 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" 38 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
39 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 39 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Fixed size for embedded sign in pages as defined in Gaia. 88 // Fixed size for embedded sign in pages as defined in Gaia.
89 const CGFloat kFixedGaiaViewWidth = 360; 89 const CGFloat kFixedGaiaViewWidth = 360;
90 const CGFloat kFixedGaiaViewHeight = 400; 90 const CGFloat kFixedGaiaViewHeight = 400;
91 91
92 // Fixed size for the account removal view. 92 // Fixed size for the account removal view.
93 const CGFloat kFixedAccountRemovalViewWidth = 280; 93 const CGFloat kFixedAccountRemovalViewWidth = 280;
94 94
95 // Fixed size for the switch user view. 95 // Fixed size for the switch user view.
96 const int kFixedSwitchUserViewWidth = 280; 96 const int kFixedSwitchUserViewWidth = 280;
97 97
98 // Maximum number of times to show the welcome tutorial in the profile avatar
99 // bubble.
100 const int kUpgradeWelcomeTutorialShowMax = 1;
101
102 // The tag number for the primary account. 98 // The tag number for the primary account.
103 const int kPrimaryProfileTag = -1; 99 const int kPrimaryProfileTag = -1;
104 100
105 gfx::Image CreateProfileImage(const gfx::Image& icon, int imageSize) { 101 gfx::Image CreateProfileImage(const gfx::Image& icon, int imageSize) {
106 return profiles::GetSizedAvatarIcon( 102 return profiles::GetSizedAvatarIcon(
107 icon, true /* image is a square */, imageSize, imageSize); 103 icon, true /* image is a square */, imageSize, imageSize);
108 } 104 }
109 105
110 // Updates the window size and position. 106 // Updates the window size and position.
111 void SetWindowSize(NSWindow* window, NSSize size) { 107 void SetWindowSize(NSWindow* window, NSSize size) {
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_CONFIRM_SIGNIN 1154 return [self tutorialViewWithMode:profiles::TUTORIAL_MODE_CONFIRM_SIGNIN
1159 titleMessage:titleMessage 1155 titleMessage:titleMessage
1160 contentMessage:contentMessage 1156 contentMessage:contentMessage
1161 linkMessage:linkMessage 1157 linkMessage:linkMessage
1162 buttonMessage:buttonMessage 1158 buttonMessage:buttonMessage
1163 linkAction:@selector(configureSyncSettings:) 1159 linkAction:@selector(configureSyncSettings:)
1164 buttonAction:@selector(syncSettingsConfirmed:)]; 1160 buttonAction:@selector(syncSettingsConfirmed:)];
1165 } 1161 }
1166 1162
1167 - (NSView*)buildWelcomeUpgradeTutorialViewIfNeeded { 1163 - (NSView*)buildWelcomeUpgradeTutorialViewIfNeeded {
1168 if (first_run::IsChromeFirstRun())
1169 return nil;
1170
1171 Profile* profile = browser_->profile(); 1164 Profile* profile = browser_->profile();
1172 const AvatarMenu::Item& avatarItem = 1165 const AvatarMenu::Item& avatarItem =
1173 avatarMenu_->GetItemAt(avatarMenu_->GetActiveProfileIndex()); 1166 avatarMenu_->GetItemAt(avatarMenu_->GetActiveProfileIndex());
1174 if (!avatarItem.signed_in) { 1167 if (!avatarItem.signed_in) {
1175 profile->GetPrefs()->SetInteger( 1168 profile->GetPrefs()->SetInteger(
1176 prefs::kProfileAvatarTutorialShown, kUpgradeWelcomeTutorialShowMax + 1); 1169 prefs::kProfileAvatarTutorialShown,
1170 signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1);
1177 return nil; 1171 return nil;
1178 } 1172 }
1179 1173
1180 const int showCount = profile->GetPrefs()->GetInteger( 1174 const int showCount = profile->GetPrefs()->GetInteger(
1181 prefs::kProfileAvatarTutorialShown); 1175 prefs::kProfileAvatarTutorialShown);
1182 // Do not show the tutorial if user has dismissed it. 1176 // Do not show the tutorial if user has dismissed it.
1183 if (showCount > kUpgradeWelcomeTutorialShowMax) 1177 if (showCount > signin_ui_util::kUpgradeWelcomeTutorialShowMax)
1184 return nil; 1178 return nil;
1185 1179
1186 if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) { 1180 if (tutorialMode_ != profiles::TUTORIAL_MODE_WELCOME_UPGRADE) {
1187 if (showCount == kUpgradeWelcomeTutorialShowMax) 1181 if (showCount == signin_ui_util::kUpgradeWelcomeTutorialShowMax)
1188 return nil; 1182 return nil;
1189 profile->GetPrefs()->SetInteger( 1183 profile->GetPrefs()->SetInteger(
1190 prefs::kProfileAvatarTutorialShown, showCount + 1); 1184 prefs::kProfileAvatarTutorialShown, showCount + 1);
1191 } 1185 }
1192 1186
1193 NSString* titleMessage = l10n_util::GetNSStringF( 1187 NSString* titleMessage = l10n_util::GetNSStringF(
1194 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatarItem.name); 1188 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatarItem.name);
1195 NSString* contentMessage = l10n_util::GetNSString( 1189 NSString* contentMessage = l10n_util::GetNSString(
1196 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT); 1190 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_CONTENT_TEXT);
1197 NSString* linkMessage = l10n_util::GetNSStringF( 1191 NSString* linkMessage = l10n_util::GetNSStringF(
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 } 1955 }
1962 1956
1963 - (bool)shouldShowGoIncognito { 1957 - (bool)shouldShowGoIncognito {
1964 bool incognitoAvailable = 1958 bool incognitoAvailable =
1965 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1959 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1966 IncognitoModePrefs::DISABLED; 1960 IncognitoModePrefs::DISABLED;
1967 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 1961 return incognitoAvailable && !browser_->profile()->IsGuestSession();
1968 } 1962 }
1969 1963
1970 @end 1964 @end
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_ui_util.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698