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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 2601803003: Introduce kiosk.autolaunched feature session type (Closed)
Patch Set: . Created 3 years, 11 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
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/chromeos/login/session/user_session_manager.h" 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #include "components/signin/core/browser/signin_manager_base.h" 106 #include "components/signin/core/browser/signin_manager_base.h"
107 #include "components/user_manager/known_user.h" 107 #include "components/user_manager/known_user.h"
108 #include "components/user_manager/user.h" 108 #include "components/user_manager/user.h"
109 #include "components/user_manager/user_manager.h" 109 #include "components/user_manager/user_manager.h"
110 #include "components/user_manager/user_names.h" 110 #include "components/user_manager/user_names.h"
111 #include "components/user_manager/user_type.h" 111 #include "components/user_manager/user_type.h"
112 #include "content/public/browser/browser_thread.h" 112 #include "content/public/browser/browser_thread.h"
113 #include "content/public/browser/notification_service.h" 113 #include "content/public/browser/notification_service.h"
114 #include "content/public/browser/storage_partition.h" 114 #include "content/public/browser/storage_partition.h"
115 #include "content/public/common/content_switches.h" 115 #include "content/public/common/content_switches.h"
116 #include "extensions/common/features/feature_session_type.h"
116 #include "net/cert/sth_distributor.h" 117 #include "net/cert/sth_distributor.h"
117 #include "rlz/features/features.h" 118 #include "rlz/features/features.h"
118 #include "ui/base/ime/chromeos/input_method_descriptor.h" 119 #include "ui/base/ime/chromeos/input_method_descriptor.h"
119 #include "ui/base/ime/chromeos/input_method_manager.h" 120 #include "ui/base/ime/chromeos/input_method_manager.h"
120 #include "url/gurl.h" 121 #include "url/gurl.h"
121 122
122 #if BUILDFLAG(ENABLE_RLZ) 123 #if BUILDFLAG(ENABLE_RLZ)
123 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" 124 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
124 #include "components/rlz/rlz_tracker.h" 125 #include "components/rlz/rlz_tracker.h"
125 #endif 126 #endif
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 delegate_ = nullptr; 500 delegate_ = nullptr;
500 } 501 }
501 502
502 void UserSessionManager::PerformPostUserLoggedInActions() { 503 void UserSessionManager::PerformPostUserLoggedInActions() {
503 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 504 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
504 if (user_manager->GetLoggedInUsers().size() == 1) { 505 if (user_manager->GetLoggedInUsers().size() == 1) {
505 if (network_portal_detector::IsInitialized()) { 506 if (network_portal_detector::IsInitialized()) {
506 network_portal_detector::GetInstance()->SetStrategy( 507 network_portal_detector::GetInstance()->SetStrategy(
507 PortalDetectorStrategy::STRATEGY_ID_SESSION); 508 PortalDetectorStrategy::STRATEGY_ID_SESSION);
508 } 509 }
510
511 InitNonKioskExtensionFeaturesSessionType(user_manager->GetPrimaryUser());
509 } 512 }
510 } 513 }
511 514
512 void UserSessionManager::RestoreAuthenticationSession(Profile* user_profile) { 515 void UserSessionManager::RestoreAuthenticationSession(Profile* user_profile) {
513 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 516 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
514 // We need to restore session only for logged in GAIA (regular) users. 517 // We need to restore session only for logged in GAIA (regular) users.
515 // Note: stub user is a special case that is used for tests, running 518 // Note: stub user is a special case that is used for tests, running
516 // linux_chromeos build on dev workstations w/o user_id parameters. 519 // linux_chromeos build on dev workstations w/o user_id parameters.
517 // Stub user is considered to be a regular GAIA user but it has special 520 // Stub user is considered to be a regular GAIA user but it has special
518 // user_id (kStubUser) and certain services like restoring OAuth session are 521 // user_id (kStubUser) and certain services like restoring OAuth session are
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 FROM_HERE, base::TaskTraits() 570 FROM_HERE, base::TaskTraits()
568 .WithShutdownBehavior( 571 .WithShutdownBehavior(
569 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) 572 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
570 .WithPriority(base::TaskPriority::BACKGROUND) 573 .WithPriority(base::TaskPriority::BACKGROUND)
571 .MayBlock(), 574 .MayBlock(),
572 base::Bind(&base::PathExists, GetRlzDisabledFlagPath()), 575 base::Bind(&base::PathExists, GetRlzDisabledFlagPath()),
573 base::Bind(&UserSessionManager::InitRlzImpl, AsWeakPtr(), profile)); 576 base::Bind(&UserSessionManager::InitRlzImpl, AsWeakPtr(), profile));
574 #endif 577 #endif
575 } 578 }
576 579
580 void UserSessionManager::InitNonKioskExtensionFeaturesSessionType(
581 const user_manager::User* user) {
582 // Kiosk session should be set as part of kiosk user session initialization
583 // in normal circumstances (to be able to properly determine whether kiosk
584 // was auto-launched); in case of user session restore, feature session
585 // type has be set before kiosk app controller takes over, as at that point
586 // kiosk app profile would already be initialized - feature session type
587 // should be set before that.
588 // TODO(tbarzic): Note that this does not work well for auto-launched
589 // sessions, as information about whether session was auto-launched is not
590 // persisted over session restart - http://crbug.com/677340.
591 if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP) {
592 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
593 switches::kLoginUser)) {
594 extensions::SetCurrentFeatureSessionType(
595 extensions::FeatureSessionType::KIOSK);
596 }
597 return;
598 }
599
600 extensions::SetCurrentFeatureSessionType(
601 user->HasGaiaAccount() ? extensions::FeatureSessionType::REGULAR
602 : extensions::FeatureSessionType::UNKNOWN);
603 }
604
577 void UserSessionManager::SetFirstLoginPrefs( 605 void UserSessionManager::SetFirstLoginPrefs(
578 Profile* profile, 606 Profile* profile,
579 const std::string& public_session_locale, 607 const std::string& public_session_locale,
580 const std::string& public_session_input_method) { 608 const std::string& public_session_input_method) {
581 VLOG(1) << "Setting first login prefs"; 609 VLOG(1) << "Setting first login prefs";
582 InitLocaleAndInputMethodsForNewUser( 610 InitLocaleAndInputMethodsForNewUser(
583 this, profile, public_session_locale, public_session_input_method); 611 this, profile, public_session_locale, public_session_input_method);
584 } 612 }
585 613
586 bool UserSessionManager::GetAppModeChromeClientOAuthInfo( 614 bool UserSessionManager::GetAppModeChromeClientOAuthInfo(
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 ->browser_policy_connector_chromeos() 1871 ->browser_policy_connector_chromeos()
1844 ->IsEnterpriseManaged()) { 1872 ->IsEnterpriseManaged()) {
1845 return false; 1873 return false;
1846 } 1874 }
1847 1875
1848 // Do not show end of life notification if this is a guest session 1876 // Do not show end of life notification if this is a guest session
1849 return !profile->IsGuestSession(); 1877 return !profile->IsGuestSession();
1850 } 1878 }
1851 1879
1852 } // namespace chromeos 1880 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698