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

Side by Side Diff: chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc

Issue 156493004: Add the ability to show a demo app on OOBE if a machine is derelict. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
6
7 #include "base/command_line.h"
8 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h"
9 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
10 #include "chrome/browser/chromeos/login/user_manager.h"
11 #include "chrome/browser/extensions/component_loader.h"
12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/ui/extensions/application_launch.h"
14 #include "chrome/common/chrome_switches.h"
15 #include "extensions/browser/extension_system.h"
16 #include "grit/browser_resources.h"
17
18 namespace {
19
20 const char kDemoAppUserId[] = "demouser@demo.app";
21 }
xiyuan 2014/02/11 03:42:45 nit: insert an empty line
rkc 2014/02/11 04:35:57 Done.
22
23 namespace chromeos {
24
25 DemoAppLauncher::DemoAppLauncher() : profile_(NULL) {}
26
27 DemoAppLauncher::~DemoAppLauncher() {}
28
29 void DemoAppLauncher::StartDemoAppLaunch() {
30 DVLOG(1) << "Launching demo app...";
31 kiosk_profile_loader_.reset(new KioskProfileLoader(kDemoAppUserId, this));
32 kiosk_profile_loader_->Start();
33 }
34
35 void DemoAppLauncher::OnProfileLoaded(Profile* profile) {
36 DVLOG(1) << "Profile loaded... Starting demo app launch.";
37 profile_ = profile;
38
39 kiosk_profile_loader_.reset();
40
41 // Load our demo app, then launch it.
42 ExtensionService* extension_service =
43 extensions::ExtensionSystem::Get(profile_)->extension_service();
44 std::string extension_id = extension_service->component_loader()->Add(
45 IDR_DEMO_APP_MANIFEST,
46 base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/demo_app")));
47
48 const extensions::Extension* extension =
49 extension_service->GetExtensionById(extension_id, true);
50
51 CommandLine* command_line = CommandLine::ForCurrentProcess();
52 command_line->AppendSwitch(switches::kForceAppMode);
53 command_line->AppendSwitchASCII(switches::kAppId, extension_id);
54
55 OpenApplication(AppLaunchParams(
56 profile_, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW));
57 InitAppSession(profile_, extension_id);
58
59 LoginDisplayHostImpl::default_host()->Finalize();
60 }
61
62 void DemoAppLauncher::OnProfileLoadFailed(KioskAppLaunchError::Error error) {
63 LOG(ERROR) << "Loading the Kiosk Profile failed.";
64 }
65
66 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698