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

Side by Side Diff: chromeos/cryptohome/system_salt_getter.h

Issue 2220433002: ChromeOS: fix crash in HashWallpaperFilesIdStr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ 5 #ifndef CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_
6 #define CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ 6 #define CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 21 matching lines...) Expand all
32 static void Shutdown(); 32 static void Shutdown();
33 static SystemSaltGetter* Get(); 33 static SystemSaltGetter* Get();
34 34
35 // Converts |salt| to a hex encoded string. 35 // Converts |salt| to a hex encoded string.
36 static std::string ConvertRawSaltToHexString(const RawSalt& salt); 36 static std::string ConvertRawSaltToHexString(const RawSalt& salt);
37 37
38 // Returns system hash in hex encoded ascii format. Note: this may return 38 // Returns system hash in hex encoded ascii format. Note: this may return
39 // an empty string (e.g. errors in D-Bus layer) 39 // an empty string (e.g. errors in D-Bus layer)
40 void GetSystemSalt(const GetSystemSaltCallback& callback); 40 void GetSystemSalt(const GetSystemSaltCallback& callback);
41 41
42 // Adds another callback to be called when system salt is received.
43 void AddOnSystemSaltReady(const base::Closure& closure);
44
42 // Returns pointer to binary system salt if it is already known. 45 // Returns pointer to binary system salt if it is already known.
43 // Returns nullptr if system salt is not known. 46 // Returns nullptr if system salt is not known.
44 const RawSalt* GetRawSalt() const; 47 const RawSalt* GetRawSalt() const;
45 48
46 // This is for browser tests API. 49 // This is for browser tests API.
47 void SetRawSaltForTesting(const RawSalt& raw_salt); 50 void SetRawSaltForTesting(const RawSalt& raw_salt);
48 51
49 protected: 52 protected:
50 SystemSaltGetter(); 53 SystemSaltGetter();
51 ~SystemSaltGetter(); 54 ~SystemSaltGetter();
52 55
53 private: 56 private:
54 // Used to implement GetSystemSalt(). 57 // Used to implement GetSystemSalt().
55 void DidWaitForServiceToBeAvailable(const GetSystemSaltCallback& callback, 58 void DidWaitForServiceToBeAvailable(const GetSystemSaltCallback& callback,
56 bool service_is_available); 59 bool service_is_available);
57 void DidGetSystemSalt(const GetSystemSaltCallback& callback, 60 void DidGetSystemSalt(const GetSystemSaltCallback& callback,
58 DBusMethodCallStatus call_status, 61 DBusMethodCallStatus call_status,
59 const RawSalt& system_salt); 62 const RawSalt& system_salt);
60 63
61 RawSalt raw_salt_; 64 RawSalt raw_salt_;
62 std::string system_salt_; 65 std::string system_salt_;
63 66
67 // List of callbacks waiting for system salt ready event.
68 std::vector<base::Closure> on_system_salt_ready_;
69
64 base::WeakPtrFactory<SystemSaltGetter> weak_ptr_factory_; 70 base::WeakPtrFactory<SystemSaltGetter> weak_ptr_factory_;
65 71
66 DISALLOW_COPY_AND_ASSIGN(SystemSaltGetter); 72 DISALLOW_COPY_AND_ASSIGN(SystemSaltGetter);
67 }; 73 };
68 74
69 } // namespace chromeos 75 } // namespace chromeos
70 76
71 #endif // CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ 77 #endif // CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698