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/policy/browser_policy_connector_chromeos.h" | 23 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
24 #include "chrome/browser/chromeos/policy/device_local_account.h" | 24 #include "chrome/browser/chromeos/policy/device_local_account.h" |
25 #include "chrome/browser/chromeos/settings/cros_settings.h" | 25 #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" | 26 #include "chrome/browser/extensions/external_loader.h" |
28 #include "chrome/browser/extensions/external_provider_impl.h" | 27 #include "chrome/browser/extensions/external_provider_impl.h" |
29 #include "chrome/common/chrome_paths.h" | 28 #include "chrome/common/chrome_paths.h" |
30 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
31 #include "chromeos/chromeos_paths.h" | 30 #include "chromeos/chromeos_paths.h" |
32 #include "chromeos/cryptohome/async_method_caller.h" | 31 #include "chromeos/cryptohome/async_method_caller.h" |
33 #include "chromeos/settings/cros_settings_names.h" | 32 #include "chromeos/settings/cros_settings_names.h" |
33 #include "components/ownership/owner_key_util.h" | |
34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
35 | 35 |
36 namespace chromeos { | 36 namespace chromeos { |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 // Domain that is used for kiosk-app account IDs. | 40 // Domain that is used for kiosk-app account IDs. |
41 const char kKioskAppAccountDomain[] = "kiosk-apps"; | 41 const char kKioskAppAccountDomain[] = "kiosk-apps"; |
42 | 42 |
43 std::string GenerateKioskAppAccountId(const std::string& app_id) { | 43 std::string GenerateKioskAppAccountId(const std::string& app_id) { |
44 return app_id + '@' + kKioskAppAccountDomain; | 44 return app_id + '@' + kKioskAppAccountDomain; |
45 } | 45 } |
46 | 46 |
47 void OnRemoveAppCryptohomeComplete(const std::string& app, | 47 void OnRemoveAppCryptohomeComplete(const std::string& app, |
48 bool success, | 48 bool success, |
49 cryptohome::MountError return_code) { | 49 cryptohome::MountError return_code) { |
50 if (!success) { | 50 if (!success) { |
51 LOG(ERROR) << "Remove cryptohome for " << app | 51 LOG(ERROR) << "Remove cryptohome for " << app |
52 << " failed, return code: " << return_code; | 52 << " failed, return code: " << return_code; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 // Check for presence of machine owner public key file. | 56 // Check for presence of machine owner public key file. |
57 void CheckOwnerFilePresence(bool *present) { | 57 void CheckOwnerFilePresence(bool *present) { |
58 scoped_refptr<OwnerKeyUtil> util = OwnerKeyUtil::Create(); | 58 scoped_refptr<ownership::OwnerKeyUtil> util = |
59 ownership::OwnerKeyUtil::Create(); | |
erikwright (departed)
2014/08/25 15:51:06
Ideally you would avoid looking up the path again
ygorshenin1
2014/08/26 14:53:35
Done.
| |
59 *present = util->IsPublicKeyPresent(); | 60 *present = util->IsPublicKeyPresent(); |
60 } | 61 } |
61 | 62 |
62 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { | 63 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { |
63 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); | 64 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
64 CHECK(pool); | 65 CHECK(pool); |
65 return pool->GetSequencedTaskRunnerWithShutdownBehavior( | 66 return pool->GetSequencedTaskRunnerWithShutdownBehavior( |
66 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 67 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
67 } | 68 } |
68 | 69 |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir); | 587 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir); |
587 } | 588 } |
588 | 589 |
589 bool KioskAppManager::GetCachedCrx(const std::string& app_id, | 590 bool KioskAppManager::GetCachedCrx(const std::string& app_id, |
590 base::FilePath* file_path, | 591 base::FilePath* file_path, |
591 std::string* version) const { | 592 std::string* version) const { |
592 return external_cache_->GetExtension(app_id, file_path, version); | 593 return external_cache_->GetExtension(app_id, file_path, version); |
593 } | 594 } |
594 | 595 |
595 } // namespace chromeos | 596 } // namespace chromeos |
OLD | NEW |