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

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

Issue 256633002: cros: Fix demo app could bring up CCD. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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 #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 "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" 10 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h"
(...skipping 11 matching lines...) Expand all
22 #include "chromeos/network/network_state_handler.h" 22 #include "chromeos/network/network_state_handler.h"
23 #include "chromeos/network/shill_property_util.h" 23 #include "chromeos/network/shill_property_util.h"
24 #include "extensions/browser/extension_system.h" 24 #include "extensions/browser/extension_system.h"
25 #include "extensions/common/extension.h" 25 #include "extensions/common/extension.h"
26 #include "grit/browser_resources.h" 26 #include "grit/browser_resources.h"
27 #include "ui/base/window_open_disposition.h" 27 #include "ui/base/window_open_disposition.h"
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
31 const char DemoAppLauncher::kDemoUserName[] = "demouser@demo.app.local"; 31 const char DemoAppLauncher::kDemoUserName[] = "demouser@demo.app.local";
32 const char DemoAppLauncher::kDemoAppId[] = "klimoghijjogocdbaikffefjfcfheiel";
32 const base::FilePath::CharType kDefaultDemoAppPath[] = 33 const base::FilePath::CharType kDefaultDemoAppPath[] =
33 FILE_PATH_LITERAL("/usr/share/chromeos-assets/demo_app"); 34 FILE_PATH_LITERAL("/usr/share/chromeos-assets/demo_app");
34 35
35 // static 36 // static
36 base::FilePath* DemoAppLauncher::demo_app_path_ = NULL; 37 base::FilePath* DemoAppLauncher::demo_app_path_ = NULL;
37 38
38 DemoAppLauncher::DemoAppLauncher() { 39 DemoAppLauncher::DemoAppLauncher() {
39 if (!demo_app_path_) 40 if (!demo_app_path_)
40 demo_app_path_ = new base::FilePath(kDefaultDemoAppPath); 41 demo_app_path_ = new base::FilePath(kDefaultDemoAppPath);
41 } 42 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 const extensions::Extension* extension = 80 const extensions::Extension* extension =
80 extension_service->GetExtensionById(extension_id, true); 81 extension_service->GetExtensionById(extension_id, true);
81 if (!extension) { 82 if (!extension) {
82 // We've already done too much setup at this point to just return out, it 83 // We've already done too much setup at this point to just return out, it
83 // is safer to just restart. 84 // is safer to just restart.
84 chrome::AttemptUserExit(); 85 chrome::AttemptUserExit();
85 return; 86 return;
86 } 87 }
87 88
88 CommandLine* command_line = CommandLine::ForCurrentProcess();
89 command_line->AppendSwitch(switches::kForceAppMode);
90 command_line->AppendSwitchASCII(switches::kAppId, extension_id);
91
92 // Disable network before launching the app. 89 // Disable network before launching the app.
93 LOG(WARNING) << "Disabling network before launching demo app.."; 90 LOG(WARNING) << "Disabling network before launching demo app..";
94 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); 91 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
95 handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), 92 handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(),
96 false, 93 false,
97 chromeos::network_handler::ErrorCallback()); 94 chromeos::network_handler::ErrorCallback());
98 95
99 OpenApplication(AppLaunchParams( 96 OpenApplication(AppLaunchParams(
100 profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW)); 97 profile, extension, extensions::LAUNCH_CONTAINER_WINDOW, NEW_WINDOW));
101 InitAppSession(profile, extension_id); 98 InitAppSession(profile, extension_id);
102 99
103 UserManager::Get()->SessionStarted(); 100 UserManager::Get()->SessionStarted();
104 101
105 LoginDisplayHostImpl::default_host()->Finalize(); 102 LoginDisplayHostImpl::default_host()->Finalize();
106 } 103 }
107 104
108 void DemoAppLauncher::OnProfileLoadFailed(KioskAppLaunchError::Error error) { 105 void DemoAppLauncher::OnProfileLoadFailed(KioskAppLaunchError::Error error) {
109 LOG(ERROR) << "Loading the Kiosk Profile failed: " << 106 LOG(ERROR) << "Loading the Kiosk Profile failed: " <<
110 KioskAppLaunchError::GetErrorMessage(error); 107 KioskAppLaunchError::GetErrorMessage(error);
111 } 108 }
112 109
113 } // namespace chromeos 110 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698