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

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

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
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/first_run/first_run.h"
11 #include "chrome/browser/lifetime/application_lifetime.h" 10 #include "chrome/browser/lifetime/application_lifetime.h"
12 #include "chrome/browser/prefs/incognito_mode_prefs.h" 11 #include "chrome/browser/prefs/incognito_mode_prefs.h"
13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
14 #include "chrome/browser/profiles/profile_info_cache.h" 13 #include "chrome/browser/profiles/profile_info_cache.h"
15 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/profiles/profile_metrics.h" 15 #include "chrome/browser/profiles/profile_metrics.h"
17 #include "chrome/browser/profiles/profile_window.h" 16 #include "chrome/browser/profiles/profile_window.h"
18 #include "chrome/browser/profiles/profiles_state.h" 17 #include "chrome/browser/profiles/profiles_state.h"
19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
20 #include "chrome/browser/signin/signin_header_helper.h" 19 #include "chrome/browser/signin/signin_header_helper.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 20 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/signin/signin_promo.h" 21 #include "chrome/browser/signin/signin_promo.h"
22 #include "chrome/browser/signin/signin_ui_util.h"
23 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_commands.h" 24 #include "chrome/browser/ui/browser_commands.h"
25 #include "chrome/browser/ui/browser_dialogs.h" 25 #include "chrome/browser/ui/browser_dialogs.h"
26 #include "chrome/browser/ui/chrome_pages.h" 26 #include "chrome/browser/ui/chrome_pages.h"
27 #include "chrome/browser/ui/singleton_tabs.h" 27 #include "chrome/browser/ui/singleton_tabs.h"
28 #include "chrome/browser/ui/views/profiles/user_manager_view.h" 28 #include "chrome/browser/ui/views/profiles/user_manager_view.h"
29 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 29 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
30 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 30 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Helpers -------------------------------------------------------------------- 67 // Helpers --------------------------------------------------------------------
68 68
69 const int kFixedMenuWidth = 250; 69 const int kFixedMenuWidth = 250;
70 const int kButtonHeight = 32; 70 const int kButtonHeight = 32;
71 const int kFixedGaiaViewHeight = 400; 71 const int kFixedGaiaViewHeight = 400;
72 const int kFixedGaiaViewWidth = 360; 72 const int kFixedGaiaViewWidth = 360;
73 const int kFixedAccountRemovalViewWidth = 280; 73 const int kFixedAccountRemovalViewWidth = 280;
74 const int kFixedSwitchUserViewWidth = 280; 74 const int kFixedSwitchUserViewWidth = 280;
75 const int kLargeImageSide = 88; 75 const int kLargeImageSide = 88;
76 76
77 // The maximum number of times to show the welcome tutorial for an upgrade user.
78 const int kUpgradeWelcomeTutorialShowMax = 1;
79
80 // Creates a GridLayout with a single column. This ensures that all the child 77 // Creates a GridLayout with a single column. This ensures that all the child
81 // views added get auto-expanded to fill the full width of the bubble. 78 // views added get auto-expanded to fill the full width of the bubble.
82 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { 79 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) {
83 views::GridLayout* layout = new views::GridLayout(view); 80 views::GridLayout* layout = new views::GridLayout(view);
84 view->SetLayoutManager(layout); 81 view->SetLayoutManager(layout);
85 82
86 views::ColumnSet* columns = layout->AddColumnSet(0); 83 views::ColumnSet* columns = layout->AddColumnSet(0);
87 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, 84 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0,
88 views::GridLayout::FIXED, width, width); 85 views::GridLayout::FIXED, width, width);
89 return layout; 86 return layout;
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 1380
1384 TitleCard* title_card = new TitleCard( 1381 TitleCard* title_card = new TitleCard(
1385 l10n_util::GetStringUTF16(IDS_PROFILES_ACCOUNT_REMOVAL_TITLE), 1382 l10n_util::GetStringUTF16(IDS_PROFILES_ACCOUNT_REMOVAL_TITLE),
1386 this, &account_removal_cancel_button_); 1383 this, &account_removal_cancel_button_);
1387 return TitleCard::AddPaddedTitleCard(view, title_card, 1384 return TitleCard::AddPaddedTitleCard(view, title_card,
1388 kFixedAccountRemovalViewWidth); 1385 kFixedAccountRemovalViewWidth);
1389 } 1386 }
1390 1387
1391 views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialViewIfNeeded( 1388 views::View* ProfileChooserView::CreateWelcomeUpgradeTutorialViewIfNeeded(
1392 bool tutorial_shown, const AvatarMenu::Item& avatar_item){ 1389 bool tutorial_shown, const AvatarMenu::Item& avatar_item){
1393 if (first_run::IsChromeFirstRun())
1394 return NULL;
1395
1396 Profile* profile = browser_->profile(); 1390 Profile* profile = browser_->profile();
1397 if (!avatar_item.signed_in) { 1391 if (!avatar_item.signed_in) {
1398 profile->GetPrefs()->SetInteger( 1392 profile->GetPrefs()->SetInteger(
1399 prefs::kProfileAvatarTutorialShown, kUpgradeWelcomeTutorialShowMax + 1); 1393 prefs::kProfileAvatarTutorialShown,
1394 signin_ui_util::kUpgradeWelcomeTutorialShowMax + 1);
1400 return NULL; 1395 return NULL;
1401 } 1396 }
1402 1397
1403 const int show_count = profile->GetPrefs()->GetInteger( 1398 const int show_count = profile->GetPrefs()->GetInteger(
1404 prefs::kProfileAvatarTutorialShown); 1399 prefs::kProfileAvatarTutorialShown);
1405 // Do not show the tutorial if user has dismissed it. 1400 // Do not show the tutorial if user has dismissed it.
1406 if (show_count > kUpgradeWelcomeTutorialShowMax) 1401 if (show_count > signin_ui_util::kUpgradeWelcomeTutorialShowMax)
1407 return NULL; 1402 return NULL;
1408 1403
1409 if (!tutorial_shown) { 1404 if (!tutorial_shown) {
1410 if (show_count == kUpgradeWelcomeTutorialShowMax) 1405 if (show_count == signin_ui_util::kUpgradeWelcomeTutorialShowMax)
1411 return NULL; 1406 return NULL;
1412 profile->GetPrefs()->SetInteger( 1407 profile->GetPrefs()->SetInteger(
1413 prefs::kProfileAvatarTutorialShown, show_count + 1); 1408 prefs::kProfileAvatarTutorialShown, show_count + 1);
1414 } 1409 }
1415 1410
1416 return CreateTutorialView( 1411 return CreateTutorialView(
1417 profiles::TUTORIAL_MODE_WELCOME_UPGRADE, 1412 profiles::TUTORIAL_MODE_WELCOME_UPGRADE,
1418 l10n_util::GetStringFUTF16( 1413 l10n_util::GetStringFUTF16(
1419 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatar_item.name), 1414 IDS_PROFILES_WELCOME_UPGRADE_TUTORIAL_TITLE, avatar_item.name),
1420 l10n_util::GetStringUTF16( 1415 l10n_util::GetStringUTF16(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1493 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1499 IncognitoModePrefs::DISABLED; 1494 IncognitoModePrefs::DISABLED;
1500 return incognito_available && !browser_->profile()->IsGuestSession(); 1495 return incognito_available && !browser_->profile()->IsGuestSession();
1501 } 1496 }
1502 1497
1503 void ProfileChooserView::PostActionPerformed( 1498 void ProfileChooserView::PostActionPerformed(
1504 ProfileMetrics::ProfileDesktopMenu action_performed) { 1499 ProfileMetrics::ProfileDesktopMenu action_performed) {
1505 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1500 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1506 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1501 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1507 } 1502 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698