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

Unified Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h

Issue 808563004: Clean up Smart Lock cryptohome keys logic: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/login/easy_unlock/easy_unlock_key_manager.h
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h
index 309ec6f05d8b1f0646f4c268b72da3eefe7701f1..b60b791cf884aec22a133b217a472cfcd74f1c1d 100644
--- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h
@@ -13,9 +13,8 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.h"
-#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_remove_keys_operation.h"
+#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h"
namespace base {
@@ -30,8 +29,8 @@ class UserContext;
// A class to manage Easy unlock cryptohome keys.
class EasyUnlockKeyManager {
public:
- typedef EasyUnlockCreateKeysOperation::CreateKeysCallback RefreshKeysCallback;
- typedef EasyUnlockRemoveKeysOperation::RemoveKeysCallback RemoveKeysCallback;
+ typedef EasyUnlockRefreshKeysOperation::RefreshKeysCallback
+ RefreshKeysCallback;
typedef EasyUnlockGetKeysOperation::GetKeysCallback GetDeviceDataListCallback;
EasyUnlockKeyManager();
@@ -44,12 +43,6 @@ class EasyUnlockKeyManager {
const base::ListValue& remote_devices,
const RefreshKeysCallback& callback);
- // Remove Easy unlock keys starting at the given index for the given
- // |user_context|.
- void RemoveKeys(const UserContext& user_context,
- size_t start_index,
- const RemoveKeysCallback& callback);
-
// Retrieves the remote device data from cryptohome keys for the given
// |user_context|.
void GetDeviceDataList(const UserContext& user_context,
@@ -82,37 +75,23 @@ class EasyUnlockKeyManager {
static std::string GetKeyLabel(size_t key_index);
private:
- // Returns true if there are pending operations.
- bool HasPendingOperations() const;
-
- // Returns the next operations id. Currently only used for get keys ops.
- int GetNextOperationId();
-
- // Runs the first pending op in |pending_ops_|. No-op if |pending_ops_| is
- // emtpy.
- void RunNextPendingOp();
+ // Runs the next operation if there is one. We first run all the operations in
+ // the |write_operation_queue_| and then run all the operations in the
+ // |read_operation_queue_|.
+ void RunNextOperation();
- // Callback invoked after create keys op.
- void OnKeysCreated(size_t remove_start_index,
- const RefreshKeysCallback& callback,
- bool create_success);
-
- // Callback invoked after remove keys op.
- void OnKeysRemoved(const RemoveKeysCallback& callback, bool remove_success);
+ // Callback invoked after refresh keys operation.
+ void OnKeysRefreshed(const RefreshKeysCallback& callback,
+ bool create_success);
// Callback invoked after get keys op.
- void OnKeysFetched(int op_id,
- const GetDeviceDataListCallback& callback,
+ void OnKeysFetched(const GetDeviceDataListCallback& callback,
bool fetch_success,
const EasyUnlockDeviceKeyDataList& fetched_data);
- int operation_id_;
-
- scoped_ptr<EasyUnlockCreateKeysOperation> create_keys_op_;
- scoped_ptr<EasyUnlockRemoveKeysOperation> remove_keys_op_;
- std::map<int, EasyUnlockGetKeysOperation*> get_keys_ops_;
-
- std::deque<base::Closure> pending_ops_;
+ std::deque<scoped_ptr<EasyUnlockRefreshKeysOperation>> write_operation_queue_;
+ std::deque<scoped_ptr<EasyUnlockGetKeysOperation>> read_operation_queue_;
xiyuan 2014/12/17 00:23:14 Is it safe to put scoped_ptr in stl containers? Sh
Tim Song 2014/12/17 02:05:14 Hmm... I'm not sure how safe it is. There might be
+ bool operation_in_progress_;
base::WeakPtrFactory<EasyUnlockKeyManager> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698