| 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 "apps/launcher.h" | 5 #include "apps/launcher.h" |
| 6 | 6 |
| 7 #include <set> |
| 7 #include <utility> | 8 #include <utility> |
| 8 #include <set> | |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 17 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
| 18 #include "chrome/browser/extensions/api/file_handlers/mime_util.h" | 18 #include "chrome/browser/extensions/api/file_handlers/mime_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 33 #include "extensions/browser/process_manager.h" | 33 #include "extensions/browser/process_manager.h" |
| 34 #include "extensions/common/api/app_runtime.h" | 34 #include "extensions/common/api/app_runtime.h" |
| 35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 36 #include "extensions/common/extension_messages.h" | 36 #include "extensions/common/extension_messages.h" |
| 37 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 37 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| 38 #include "net/base/filename_util.h" | 38 #include "net/base/filename_util.h" |
| 39 #include "net/base/net_util.h" | 39 #include "net/base/net_util.h" |
| 40 #include "url/gurl.h" | 40 #include "url/gurl.h" |
| 41 | 41 |
| 42 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
| 43 #include "chrome/browser/chromeos/login/users/user_manager.h" | 43 #include "components/user_manager/user_manager.h" |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 namespace app_runtime = extensions::core_api::app_runtime; | 46 namespace app_runtime = extensions::core_api::app_runtime; |
| 47 | 47 |
| 48 using content::BrowserThread; | 48 using content::BrowserThread; |
| 49 using extensions::AppRuntimeEventRouter; | 49 using extensions::AppRuntimeEventRouter; |
| 50 using extensions::app_file_handler_util::CreateFileEntry; | 50 using extensions::app_file_handler_util::CreateFileEntry; |
| 51 using extensions::app_file_handler_util::FileHandlerCanHandleFile; | 51 using extensions::app_file_handler_util::FileHandlerCanHandleFile; |
| 52 using extensions::app_file_handler_util::FileHandlerForId; | 52 using extensions::app_file_handler_util::FileHandlerForId; |
| 53 using extensions::app_file_handler_util::FirstFileHandlerForFile; | 53 using extensions::app_file_handler_util::FirstFileHandlerForFile; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 void LaunchPlatformAppWithCommandLine(Profile* profile, | 311 void LaunchPlatformAppWithCommandLine(Profile* profile, |
| 312 const Extension* extension, | 312 const Extension* extension, |
| 313 const CommandLine& command_line, | 313 const CommandLine& command_line, |
| 314 const base::FilePath& current_directory) { | 314 const base::FilePath& current_directory) { |
| 315 // An app with "kiosk_only" should not be installed and launched | 315 // An app with "kiosk_only" should not be installed and launched |
| 316 // outside of ChromeOS kiosk mode in the first place. This is a defensive | 316 // outside of ChromeOS kiosk mode in the first place. This is a defensive |
| 317 // check in case this scenario does occur. | 317 // check in case this scenario does occur. |
| 318 if (extensions::KioskModeInfo::IsKioskOnly(extension)) { | 318 if (extensions::KioskModeInfo::IsKioskOnly(extension)) { |
| 319 bool in_kiosk_mode = false; | 319 bool in_kiosk_mode = false; |
| 320 #if defined(OS_CHROMEOS) | 320 #if defined(OS_CHROMEOS) |
| 321 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 321 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 322 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); | 322 in_kiosk_mode = user_manager && user_manager->IsLoggedInAsKioskApp(); |
| 323 #endif | 323 #endif |
| 324 if (!in_kiosk_mode) { | 324 if (!in_kiosk_mode) { |
| 325 LOG(ERROR) << "App with 'kiosk_only' attribute must be run in " | 325 LOG(ERROR) << "App with 'kiosk_only' attribute must be run in " |
| 326 << " ChromeOS kiosk mode."; | 326 << " ChromeOS kiosk mode."; |
| 327 NOTREACHED(); | 327 NOTREACHED(); |
| 328 return; | 328 return; |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 void LaunchPlatformAppWithUrl(Profile* profile, | 403 void LaunchPlatformAppWithUrl(Profile* profile, |
| 404 const Extension* extension, | 404 const Extension* extension, |
| 405 const std::string& handler_id, | 405 const std::string& handler_id, |
| 406 const GURL& url, | 406 const GURL& url, |
| 407 const GURL& referrer_url) { | 407 const GURL& referrer_url) { |
| 408 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( | 408 AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( |
| 409 profile, extension, handler_id, url, referrer_url); | 409 profile, extension, handler_id, url, referrer_url); |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace apps | 412 } // namespace apps |
| OLD | NEW |