| 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/kiosk_app_manager.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/prefs/scoped_user_pref_update.h" | 16 #include "base/prefs/scoped_user_pref_update.h" |
| 17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| 18 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/app_mode/kiosk_app_data.h" | 20 #include "chrome/browser/chromeos/app_mode/kiosk_app_data.h" |
| 21 #include "chrome/browser/chromeos/app_mode/kiosk_app_external_loader.h" | 21 #include "chrome/browser/chromeos/app_mode/kiosk_app_external_loader.h" |
| 22 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" | 22 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" |
| 23 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" |
| 23 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 24 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 24 #include "chrome/browser/chromeos/policy/device_local_account.h" | 25 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 25 #include "chrome/browser/chromeos/settings/cros_settings.h" | 26 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 26 #include "chrome/browser/chromeos/settings/owner_key_util.h" | |
| 27 #include "chrome/browser/extensions/external_loader.h" | 27 #include "chrome/browser/extensions/external_loader.h" |
| 28 #include "chrome/browser/extensions/external_provider_impl.h" | 28 #include "chrome/browser/extensions/external_provider_impl.h" |
| 29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 30 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
| 31 #include "chromeos/chromeos_paths.h" | 31 #include "chromeos/chromeos_paths.h" |
| 32 #include "chromeos/cryptohome/async_method_caller.h" | 32 #include "chromeos/cryptohome/async_method_caller.h" |
| 33 #include "chromeos/settings/cros_settings_names.h" | 33 #include "chromeos/settings/cros_settings_names.h" |
| 34 #include "components/ownership/owner_key_util.h" |
| 34 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 35 | 36 |
| 36 namespace chromeos { | 37 namespace chromeos { |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 // Domain that is used for kiosk-app account IDs. | 41 // Domain that is used for kiosk-app account IDs. |
| 41 const char kKioskAppAccountDomain[] = "kiosk-apps"; | 42 const char kKioskAppAccountDomain[] = "kiosk-apps"; |
| 42 | 43 |
| 43 std::string GenerateKioskAppAccountId(const std::string& app_id) { | 44 std::string GenerateKioskAppAccountId(const std::string& app_id) { |
| 44 return app_id + '@' + kKioskAppAccountDomain; | 45 return app_id + '@' + kKioskAppAccountDomain; |
| 45 } | 46 } |
| 46 | 47 |
| 47 void OnRemoveAppCryptohomeComplete(const std::string& app, | 48 void OnRemoveAppCryptohomeComplete(const std::string& app, |
| 48 bool success, | 49 bool success, |
| 49 cryptohome::MountError return_code) { | 50 cryptohome::MountError return_code) { |
| 50 if (!success) { | 51 if (!success) { |
| 51 LOG(ERROR) << "Remove cryptohome for " << app | 52 LOG(ERROR) << "Remove cryptohome for " << app |
| 52 << " failed, return code: " << return_code; | 53 << " failed, return code: " << return_code; |
| 53 } | 54 } |
| 54 } | 55 } |
| 55 | 56 |
| 56 // Check for presence of machine owner public key file. | 57 // Check for presence of machine owner public key file. |
| 57 void CheckOwnerFilePresence(bool *present) { | 58 void CheckOwnerFilePresence(bool *present) { |
| 58 scoped_refptr<OwnerKeyUtil> util = OwnerKeyUtil::Create(); | 59 scoped_refptr<ownership::OwnerKeyUtil> util = |
| 59 *present = util->IsPublicKeyPresent(); | 60 OwnerSettingsService::MakeOwnerKeyUtil(); |
| 61 *present = util.get() && util->IsPublicKeyPresent(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { | 64 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { |
| 63 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); | 65 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
| 64 CHECK(pool); | 66 CHECK(pool); |
| 65 return pool->GetSequencedTaskRunnerWithShutdownBehavior( | 67 return pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 66 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 68 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace | 71 } // namespace |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir); | 588 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir); |
| 587 } | 589 } |
| 588 | 590 |
| 589 bool KioskAppManager::GetCachedCrx(const std::string& app_id, | 591 bool KioskAppManager::GetCachedCrx(const std::string& app_id, |
| 590 base::FilePath* file_path, | 592 base::FilePath* file_path, |
| 591 std::string* version) const { | 593 std::string* version) const { |
| 592 return external_cache_->GetExtension(app_id, file_path, version); | 594 return external_cache_->GetExtension(app_id, file_path, version); |
| 593 } | 595 } |
| 594 | 596 |
| 595 } // namespace chromeos | 597 } // namespace chromeos |
| OLD | NEW |