| 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 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 5 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" | 8 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" |
| 9 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 9 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
| 11 #include "chrome/browser/extensions/component_loader.h" | 11 #include "chrome/browser/extensions/component_loader.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/ui/extensions/application_launch.h" | 13 #include "chrome/browser/ui/extensions/application_launch.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "extensions/browser/extension_system.h" | 15 #include "extensions/browser/extension_system.h" |
| 16 #include "grit/browser_resources.h" | 16 #include "grit/browser_resources.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace chromeos { |
| 19 | 19 |
| 20 const char kDemoAppUserId[] = "demouser@demo.app.local"; | 20 const char DemoAppLauncher::kDemoUserName[] = "demouser@demo.app.local"; |
| 21 | |
| 22 } | |
| 23 | |
| 24 namespace chromeos { | |
| 25 | 21 |
| 26 DemoAppLauncher::DemoAppLauncher() : profile_(NULL) {} | 22 DemoAppLauncher::DemoAppLauncher() : profile_(NULL) {} |
| 27 | 23 |
| 28 DemoAppLauncher::~DemoAppLauncher() {} | 24 DemoAppLauncher::~DemoAppLauncher() {} |
| 29 | 25 |
| 30 void DemoAppLauncher::StartDemoAppLaunch() { | 26 void DemoAppLauncher::StartDemoAppLaunch() { |
| 31 DVLOG(1) << "Launching demo app..."; | 27 DVLOG(1) << "Launching demo app..."; |
| 32 // user_id = DemoAppUserId, force_emphemeral = true, delegate = this. | 28 // user_id = DemoAppUserId, force_emphemeral = true, delegate = this. |
| 33 kiosk_profile_loader_.reset( | 29 kiosk_profile_loader_.reset( |
| 34 new KioskProfileLoader(kDemoAppUserId, true, this)); | 30 new KioskProfileLoader(kDemoUserName, true, this)); |
| 35 kiosk_profile_loader_->Start(); | 31 kiosk_profile_loader_->Start(); |
| 36 } | 32 } |
| 37 | 33 |
| 38 // static | 34 // static |
| 39 bool DemoAppLauncher::IsDemoAppSession(const std::string& user_id) { | 35 bool DemoAppLauncher::IsDemoAppSession(const std::string& user_id) { |
| 40 return user_id == kDemoAppUserId ? true : false; | 36 return user_id == kDemoUserName ? true : false; |
| 41 } | 37 } |
| 42 | 38 |
| 43 void DemoAppLauncher::OnProfileLoaded(Profile* profile) { | 39 void DemoAppLauncher::OnProfileLoaded(Profile* profile) { |
| 44 DVLOG(1) << "Profile loaded... Starting demo app launch."; | 40 DVLOG(1) << "Profile loaded... Starting demo app launch."; |
| 45 profile_ = profile; | 41 profile_ = profile; |
| 46 | 42 |
| 47 kiosk_profile_loader_.reset(); | 43 kiosk_profile_loader_.reset(); |
| 48 | 44 |
| 49 // Load our demo app, then launch it. | 45 // Load our demo app, then launch it. |
| 50 ExtensionService* extension_service = | 46 ExtensionService* extension_service = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 67 UserManager::Get()->SessionStarted(); | 63 UserManager::Get()->SessionStarted(); |
| 68 | 64 |
| 69 LoginDisplayHostImpl::default_host()->Finalize(); | 65 LoginDisplayHostImpl::default_host()->Finalize(); |
| 70 } | 66 } |
| 71 | 67 |
| 72 void DemoAppLauncher::OnProfileLoadFailed(KioskAppLaunchError::Error error) { | 68 void DemoAppLauncher::OnProfileLoadFailed(KioskAppLaunchError::Error error) { |
| 73 LOG(ERROR) << "Loading the Kiosk Profile failed."; | 69 LOG(ERROR) << "Loading the Kiosk Profile failed."; |
| 74 } | 70 } |
| 75 | 71 |
| 76 } // namespace chromeos | 72 } // namespace chromeos |
| OLD | NEW |