OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_mode/startup_app_launcher.h" | 5 #include "chrome/browser/chromeos/app_mode/startup_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/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" | 14 #include "chrome/browser/chromeos/app_mode/app_session_lifetime.h" |
15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
16 #include "chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.h" | 16 #include "chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.h" |
17 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 17 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/extensions/install_tracker.h" | 19 #include "chrome/browser/extensions/install_tracker.h" |
20 #include "chrome/browser/extensions/install_tracker_factory.h" | 20 #include "chrome/browser/extensions/install_tracker_factory.h" |
21 #include "chrome/browser/extensions/updater/extension_updater.h" | 21 #include "chrome/browser/extensions/updater/extension_updater.h" |
22 #include "chrome/browser/lifetime/application_lifetime.h" | 22 #include "chrome/browser/lifetime/application_lifetime.h" |
23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
24 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
| 25 #include "chrome/browser/ui/extensions/app_launch_params.h" |
25 #include "chrome/browser/ui/extensions/application_launch.h" | 26 #include "chrome/browser/ui/extensions/application_launch.h" |
26 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/chrome_version_info.h" | 29 #include "chrome/common/chrome_version_info.h" |
29 #include "components/crx_file/id_util.h" | 30 #include "components/crx_file/id_util.h" |
30 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 31 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
31 #include "components/signin/core/browser/signin_manager.h" | 32 #include "components/signin/core/browser/signin_manager.h" |
32 #include "components/user_manager/user_manager.h" | 33 #include "components/user_manager/user_manager.h" |
33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
35 #include "extensions/browser/extension_system.h" | 36 #include "extensions/browser/extension_system.h" |
| 37 #include "extensions/common/constants.h" |
36 #include "extensions/common/extension.h" | 38 #include "extensions/common/extension.h" |
37 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 39 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
38 #include "extensions/common/manifest_handlers/offline_enabled_info.h" | 40 #include "extensions/common/manifest_handlers/offline_enabled_info.h" |
39 #include "extensions/common/manifest_url_handlers.h" | 41 #include "extensions/common/manifest_url_handlers.h" |
40 #include "google_apis/gaia/gaia_auth_consumer.h" | 42 #include "google_apis/gaia/gaia_auth_consumer.h" |
41 #include "google_apis/gaia/gaia_constants.h" | 43 #include "google_apis/gaia/gaia_constants.h" |
42 #include "net/base/load_flags.h" | 44 #include "net/base/load_flags.h" |
43 #include "net/url_request/url_fetcher.h" | 45 #include "net/url_request/url_fetcher.h" |
44 #include "net/url_request/url_fetcher_delegate.h" | 46 #include "net/url_request/url_fetcher_delegate.h" |
45 #include "net/url_request/url_request_context_getter.h" | 47 #include "net/url_request/url_request_context_getter.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 CHECK(extension); | 326 CHECK(extension); |
325 | 327 |
326 if (!extensions::KioskModeInfo::IsKioskEnabled(extension)) { | 328 if (!extensions::KioskModeInfo::IsKioskEnabled(extension)) { |
327 OnLaunchFailure(KioskAppLaunchError::NOT_KIOSK_ENABLED); | 329 OnLaunchFailure(KioskAppLaunchError::NOT_KIOSK_ENABLED); |
328 return; | 330 return; |
329 } | 331 } |
330 | 332 |
331 // Always open the app in a window. | 333 // Always open the app in a window. |
332 OpenApplication(AppLaunchParams(profile_, extension, | 334 OpenApplication(AppLaunchParams(profile_, extension, |
333 extensions::LAUNCH_CONTAINER_WINDOW, | 335 extensions::LAUNCH_CONTAINER_WINDOW, |
334 NEW_WINDOW)); | 336 NEW_WINDOW, extensions::SOURCE_KIOSK)); |
335 InitAppSession(profile_, app_id_); | 337 InitAppSession(profile_, app_id_); |
336 | 338 |
337 user_manager::UserManager::Get()->SessionStarted(); | 339 user_manager::UserManager::Get()->SessionStarted(); |
338 | 340 |
339 content::NotificationService::current()->Notify( | 341 content::NotificationService::current()->Notify( |
340 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, | 342 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, |
341 content::NotificationService::AllSources(), | 343 content::NotificationService::AllSources(), |
342 content::NotificationService::NoDetails()); | 344 content::NotificationService::NoDetails()); |
343 | 345 |
344 if (diagnostic_mode_) | 346 if (diagnostic_mode_) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 UpdateAppData(); | 390 UpdateAppData(); |
389 delegate_->OnReadyToLaunch(); | 391 delegate_->OnReadyToLaunch(); |
390 } | 392 } |
391 | 393 |
392 void StartupAppLauncher::UpdateAppData() { | 394 void StartupAppLauncher::UpdateAppData() { |
393 KioskAppManager::Get()->ClearAppData(app_id_); | 395 KioskAppManager::Get()->ClearAppData(app_id_); |
394 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); | 396 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); |
395 } | 397 } |
396 | 398 |
397 } // namespace chromeos | 399 } // namespace chromeos |
OLD | NEW |