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

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_manager.cc

Issue 494093002: OwnerKeyUtil is moved to components/ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 6 years, 3 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 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 base::FilePath public_key_path;
59 *present = util->IsPublicKeyPresent(); 59 if (!PathService::Get(chromeos::FILE_OWNER_KEY, &public_key_path)) {
60 *present = false;
61 return;
62 }
63 scoped_refptr<ownership::OwnerKeyUtil> util =
64 ownership::OwnerKeyUtil::Create(public_key_path);
65 *present = util.get() && util->IsPublicKeyPresent();
60 } 66 }
61 67
62 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() { 68 scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner() {
63 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); 69 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
64 CHECK(pool); 70 CHECK(pool);
65 return pool->GetSequencedTaskRunnerWithShutdownBehavior( 71 return pool->GetSequencedTaskRunnerWithShutdownBehavior(
66 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); 72 pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
67 } 73 }
68 74
69 } // namespace 75 } // namespace
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir); 592 *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir);
587 } 593 }
588 594
589 bool KioskAppManager::GetCachedCrx(const std::string& app_id, 595 bool KioskAppManager::GetCachedCrx(const std::string& app_id,
590 base::FilePath* file_path, 596 base::FilePath* file_path,
591 std::string* version) const { 597 std::string* version) const {
592 return external_cache_->GetExtension(app_id, file_path, version); 598 return external_cache_->GetExtension(app_id, file_path, version);
593 } 599 }
594 600
595 } // namespace chromeos 601 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698