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

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: Fixed GYP file. 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..e2b380559e3f5d2e5300bba1f6c2db3a39756ce7 100644
--- a/chrome/browser/chromeos/ownership/owner_settings_service.cc
+++ b/chrome/browser/chromeos/ownership/owner_settings_service.cc
@@ -9,13 +9,17 @@
#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/ownership/owner_key_util_impl.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
@@ -31,6 +35,9 @@
namespace em = enterprise_management;
using content::BrowserThread;
+using ownership::OwnerKeyUtil;
+using ownership::PrivateKey;
+using ownership::PublicKey;
namespace chromeos {
@@ -176,7 +183,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 +243,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) {
@@ -390,6 +401,15 @@ void OwnerSettingsService::IsOwnerForSafeModeAsync(
}
// 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 new ownership::OwnerKeyUtilImpl(public_key_path);
+}
+
+// static
void OwnerSettingsService::SetOwnerKeyUtilForTesting(
const scoped_refptr<OwnerKeyUtil>& owner_key_util) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

Powered by Google App Engine
This is Rietveld 408576698