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

Unified Diff: chrome/browser/chromeos/ownership/owner_settings_service.cc

Issue 494093002: OwnerKeyUtil is moved to components/ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added public static OwnerSettingsService::MakeOwnerKeyUtil() method. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/ownership/owner_settings_service.cc
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service.cc b/chrome/browser/chromeos/ownership/owner_settings_service.cc
index 9b4ccef7175695c57ef080ab9cee70b54eb5fb89..7cbf834cb49becb895074c247789403e92d77d6a 100644
--- a/chrome/browser/chromeos/ownership/owner_settings_service.cc
+++ b/chrome/browser/chromeos/ownership/owner_settings_service.cc
@@ -9,12 +9,15 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
+#include "base/path_service.h"
+#include "base/prefs/pref_service.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/session_manager_operation.h"
#include "chrome/browser/profiles/profile.h"
+#include "chromeos/chromeos_paths.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -31,6 +34,9 @@
namespace em = enterprise_management;
using content::BrowserThread;
+using ownership::OwnerKeyUtil;
+using ownership::PrivateKey;
+using ownership::PublicKey;
namespace chromeos {
@@ -176,7 +182,11 @@ void DoesPrivateKeyExistAsync(
if (g_owner_key_util_for_testing)
owner_key_util = *g_owner_key_util_for_testing;
else
- owner_key_util = OwnerKeyUtil::Create();
+ owner_key_util = OwnerSettingsService::MakeOwnerKeyUtil();
+ if (!owner_key_util) {
+ callback.Run(false);
+ return;
+ }
scoped_refptr<base::TaskRunner> task_runner =
content::BrowserThread::GetBlockingPool()
->GetTaskRunnerWithShutdownBehavior(
@@ -232,7 +242,7 @@ bool CheckManagementModeTransition(em::PolicyData::ManagementMode current_mode,
OwnerSettingsService::OwnerSettingsService(Profile* profile)
: profile_(profile),
- owner_key_util_(OwnerKeyUtil::Create()),
+ owner_key_util_(MakeOwnerKeyUtil()),
waiting_for_profile_creation_(true),
waiting_for_tpm_token_(true),
weak_factory_(this) {
@@ -410,6 +420,15 @@ void OwnerSettingsService::SetDeviceSettingsServiceForTesting(
g_device_settings_service_for_testing = device_settings_service;
}
+// static
+scoped_refptr<ownership::OwnerKeyUtil>
+OwnerSettingsService::MakeOwnerKeyUtil() {
+ base::FilePath public_key_path;
+ if (!PathService::Get(chromeos::FILE_OWNER_KEY, &public_key_path))
+ return NULL;
+ return OwnerKeyUtil::Create(public_key_path);
+}
+
void OwnerSettingsService::ReloadPrivateKey() {
DCHECK(thread_checker_.CalledOnValidThread());
if (waiting_for_profile_creation_ || waiting_for_tpm_token_)

Powered by Google App Engine
This is Rietveld 408576698