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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.h

Issue 2343213002: chromeos: Avoid EasyUnlockGetKeysOperation D-Bus log spam. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_GET_KEYS_OPERATION _H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_GET_KEYS_OPERATION _H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_GET_KEYS_OPERATION _H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_GET_KEYS_OPERATION _H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" 13 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h"
14 #include "chromeos/cryptohome/homedir_methods.h" 14 #include "chromeos/cryptohome/homedir_methods.h"
15 #include "chromeos/login/auth/user_context.h" 15 #include "chromeos/login/auth/user_context.h"
16 #include "third_party/cros_system_api/dbus/service_constants.h" 16 #include "third_party/cros_system_api/dbus/service_constants.h"
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 class EasyUnlockGetKeysOperation { 20 class EasyUnlockGetKeysOperation {
21 public: 21 public:
22 typedef base::Callback<void(bool success, 22 typedef base::Callback<void(bool success,
23 const EasyUnlockDeviceKeyDataList& data_list)> 23 const EasyUnlockDeviceKeyDataList& data_list)>
24 GetKeysCallback; 24 GetKeysCallback;
25 EasyUnlockGetKeysOperation(const UserContext& user_context, 25 EasyUnlockGetKeysOperation(const UserContext& user_context,
26 const GetKeysCallback& callback); 26 const GetKeysCallback& callback);
27 ~EasyUnlockGetKeysOperation(); 27 ~EasyUnlockGetKeysOperation();
28 28
29 // Starts the operation. If the cryptohome service is not yet available, the
30 // request will be deferred until it is ready.
29 void Start(); 31 void Start();
30 32
31 private: 33 private:
34 // Called once when the cryptohome service is available.
35 void OnCryptohomeAvailable(bool available);
36
37 // Asynchronously requests data for |key_index_| from cryptohome.
32 void GetKeyData(); 38 void GetKeyData();
39
40 // Callback for GetKeyData(). Updates |devices_|, increments |key_index_|, and
41 // calls GetKeyData() again.
33 void OnGetKeyData( 42 void OnGetKeyData(
34 bool success, 43 bool success,
35 cryptohome::MountError return_code, 44 cryptohome::MountError return_code,
36 const std::vector<cryptohome::KeyDefinition>& key_definitions); 45 const std::vector<cryptohome::KeyDefinition>& key_definitions);
37 46
38 UserContext user_context_; 47 UserContext user_context_;
39 GetKeysCallback callback_; 48 GetKeysCallback callback_;
40 49
41 size_t key_index_; 50 size_t key_index_;
42 EasyUnlockDeviceKeyDataList devices_; 51 EasyUnlockDeviceKeyDataList devices_;
43 52
44 base::WeakPtrFactory<EasyUnlockGetKeysOperation> weak_ptr_factory_; 53 base::WeakPtrFactory<EasyUnlockGetKeysOperation> weak_ptr_factory_;
45 54
46 DISALLOW_COPY_AND_ASSIGN(EasyUnlockGetKeysOperation); 55 DISALLOW_COPY_AND_ASSIGN(EasyUnlockGetKeysOperation);
47 }; 56 };
48 57
49 } // namespace chromeos 58 } // namespace chromeos
50 59
51 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_GET_KEYS_OPERAT ION_H_ 60 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_GET_KEYS_OPERAT ION_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698