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

Unified Diff: components/ownership/owner_key_util.h

Issue 494093002: OwnerKeyUtil is moved to components/ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. 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: components/ownership/owner_key_util.h
diff --git a/chrome/browser/chromeos/settings/owner_key_util.h b/components/ownership/owner_key_util.h
similarity index 59%
rename from chrome/browser/chromeos/settings/owner_key_util.h
rename to components/ownership/owner_key_util.h
index 4c3abd3e6a9384e32f645d83ef82b9b901b823b9..c55236a1eaf21f0f9eb539bb96223250a974c2be 100644
--- a/chrome/browser/chromeos/settings/owner_key_util.h
+++ b/components/ownership/owner_key_util.h
@@ -1,21 +1,19 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_
-#define CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_
+#ifndef COMPONENTS_OWNERSHIP_OWNER_KEY_UTIL_H_
+#define COMPONENTS_OWNERSHIP_OWNER_KEY_UTIL_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/files/file_path.h"
-#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
-#include "crypto/rsa_private_key.h"
+#include "components/ownership/ownership_export.h"
#include "net/cert/x509_util_nss.h"
namespace base {
@@ -26,11 +24,12 @@ namespace crypto {
class RSAPrivateKey;
}
-namespace chromeos {
+namespace ownership {
class OwnerKeyUtilTest;
-class PublicKey : public base::RefCountedThreadSafe<PublicKey> {
+class OWNERSHIP_EXPORT PublicKey
+ : public base::RefCountedThreadSafe<PublicKey> {
public:
PublicKey();
@@ -53,7 +52,8 @@ class PublicKey : public base::RefCountedThreadSafe<PublicKey> {
DISALLOW_COPY_AND_ASSIGN(PublicKey);
};
-class PrivateKey : public base::RefCountedThreadSafe<PrivateKey> {
+class OWNERSHIP_EXPORT PrivateKey
+ : public base::RefCountedThreadSafe<PrivateKey> {
public:
explicit PrivateKey(crypto::RSAPrivateKey* key);
@@ -69,10 +69,12 @@ class PrivateKey : public base::RefCountedThreadSafe<PrivateKey> {
DISALLOW_COPY_AND_ASSIGN(PrivateKey);
};
-class OwnerKeyUtil : public base::RefCountedThreadSafe<OwnerKeyUtil> {
+class OWNERSHIP_EXPORT OwnerKeyUtil
erikwright (departed) 2014/08/26 16:49:54 It may still make sense to have a pure-virtual API
ygorshenin1 2014/08/27 20:39:12 It seems that there're no need in pure virtual bas
+ : public base::RefCountedThreadSafe<OwnerKeyUtil> {
public:
// Creates an OwnerKeyUtil instance.
- static OwnerKeyUtil* Create();
+ static scoped_refptr<OwnerKeyUtil> Create(
+ const base::FilePath& public_key_path);
// Attempts to read the public key from the file system.
// Upon success, returns true and populates |output|. False on failure.
@@ -94,32 +96,8 @@ class OwnerKeyUtil : public base::RefCountedThreadSafe<OwnerKeyUtil> {
private:
friend class base::RefCountedThreadSafe<OwnerKeyUtil>;
-
- FRIEND_TEST_ALL_PREFIXES(OwnerKeyUtilTest, ExportImportPublicKey);
-};
-
-// Implementation of OwnerKeyUtil that is used in production code.
-class OwnerKeyUtilImpl : public OwnerKeyUtil {
- public:
- explicit OwnerKeyUtilImpl(const base::FilePath& public_key_file);
-
- // OwnerKeyUtil:
- virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE;
- virtual crypto::RSAPrivateKey* FindPrivateKeyInSlot(
- const std::vector<uint8>& key,
- PK11SlotInfo* slot) OVERRIDE;
- virtual bool IsPublicKeyPresent() OVERRIDE;
-
- protected:
- virtual ~OwnerKeyUtilImpl();
-
- private:
- // The file that holds the public key.
- base::FilePath key_file_;
-
- DISALLOW_COPY_AND_ASSIGN(OwnerKeyUtilImpl);
};
-} // namespace chromeos
+} // namespace ownership
-#endif // CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_
+#endif // COMPONENTS_OWNERSHIP_OWNER_KEY_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698