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

Side by Side Diff: chrome/browser/chromeos/login/ownership_service.h

Issue 3141031: [Chrome OS] Wire up ownership API from libcros (Closed)
Patch Set: address davemoore comments Created 10 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
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/ref_counted.h"
12 #include "base/singleton.h"
13 #include "chrome/browser/chromeos/login/owner_key_utils.h"
14 #include "chrome/browser/chromeos/login/owner_manager.h"
15
16 namespace chromeos {
17
18 class OwnershipService {
19 public:
20 // Returns the singleton instance of the OwnershipService.
21 static OwnershipService* GetSharedInstance();
22 virtual ~OwnershipService();
23
24 bool IsAlreadyOwned();
25
26 // If the device has been owned already, posts a task to the FILE thread to
27 // fetch the public key off disk.
28 // Returns true if the attempt was initiated, false otherwise.
29 //
30 // Sends out a OWNER_KEY_FETCH_ATTEMPT_SUCCESS notification on success,
31 // OWNER_KEY_FETCH_ATTEMPT_FAILED on failure.
32 bool StartLoadOwnerKeyAttempt();
33
34 // If the device has not yet been owned, posts a task to the FILE
35 // thread to generate the owner's keys and put them in the right
36 // places. Keeps them in memory as well, for later use.
37 // Returns true if the attempt was initiated, false otherwise.
38 //
39 // Sends out a OWNER_KEY_FETCH_ATTEMPT_SUCCESS notification on success,
40 // OWNER_KEY_FETCH_ATTEMPT_FAILED on failure.
41 bool StartTakeOwnershipAttempt();
42
43 // Initiate an attempt to sign |data| with |private_key_|. Will call
44 // d->OnKeyOpComplete() when done. Upon success, the signature will be passed
45 // as the |payload| argument to d->OnKeyOpComplete().
46 // Returns true if the attempt was initiated, false otherwise.
47 //
48 // If you call this on a well-known thread, you'll be called back on that
49 // thread. Otherwise, you'll get called back on the UI thread.
50 bool StartSigningAttempt(const std::string& data, OwnerManager::Delegate* d);
51
52 // Initiate an attempt to verify that |signature| is valid over |data| with
53 // |public_key_|. When the attempt is completed, an appropriate KeyOpCode
54 // will be passed to d->OnKeyOpComplete().
55 // Returns true if the attempt was initiated, false otherwise.
56 //
57 // If you call this on a well-known thread, you'll be called back on that
58 // thread. Otherwise, you'll get called back on the UI thread.
59 bool StartVerifyAttempt(const std::string& data,
60 const std::string& signature,
61 OwnerManager::Delegate* d);
62
63 private:
64 friend struct DefaultSingletonTraits<OwnershipService>;
65 friend class OwnershipServiceTest;
66
67 OwnershipService();
68
69 scoped_refptr<OwnerManager> manager_;
70 scoped_refptr<OwnerKeyUtils> utils_;
71 };
72
73 } // namespace chromeos
74
75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/owner_manager_unittest.cc ('k') | chrome/browser/chromeos/login/ownership_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698