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

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

Issue 2111043003: Storage manager: Show the disk usage of other users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo and the order of storage items. Created 4 years, 5 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 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 CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ 5 #ifndef CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_
6 #define CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ 6 #define CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 #include <vector> 11 #include <vector>
10 12
11 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
12 #include "chromeos/chromeos_export.h" 14 #include "chromeos/chromeos_export.h"
13 #include "chromeos/cryptohome/cryptohome_parameters.h" 15 #include "chromeos/cryptohome/cryptohome_parameters.h"
14 #include "chromeos/dbus/cryptohome_client.h" 16 #include "chromeos/dbus/cryptohome_client.h"
15 #include "third_party/cros_system_api/dbus/service_constants.h" 17 #include "third_party/cros_system_api/dbus/service_constants.h"
16 18
17 namespace cryptohome { 19 namespace cryptohome {
18 20
19 // This class manages calls to Cryptohome service's home directory methods: 21 // This class manages calls to Cryptohome service's home directory methods:
20 // Mount, CheckKey, Add/UpdateKey. 22 // Mount, CheckKey, Add/UpdateKey.
21 class CHROMEOS_EXPORT HomedirMethods { 23 class CHROMEOS_EXPORT HomedirMethods {
22 public: 24 public:
23 // Callbacks that are called back on the UI thread when the results of the 25 // Callbacks that are called back on the UI thread when the results of the
24 // respective method calls are ready. 26 // respective method calls are ready.
25 typedef base::Callback<void(bool success, MountError return_code)> Callback; 27 typedef base::Callback<void(bool success, MountError return_code)> Callback;
26 typedef base::Callback<void( 28 typedef base::Callback<void(
27 bool success, 29 bool success,
28 MountError return_code, 30 MountError return_code,
29 const std::vector<KeyDefinition>& key_definitions)> GetKeyDataCallback; 31 const std::vector<KeyDefinition>& key_definitions)> GetKeyDataCallback;
30 typedef base::Callback< 32 typedef base::Callback<
31 void(bool success, MountError return_code, const std::string& mount_hash)> 33 void(bool success, MountError return_code, const std::string& mount_hash)>
32 MountCallback; 34 MountCallback;
35 typedef base::Callback<void(bool success, int64_t size)>
36 GetAccountDiskUsageCallback;
33 37
34 virtual ~HomedirMethods() {} 38 virtual ~HomedirMethods() {}
35 39
36 // Asks cryptohomed to return data about the key identified by |label| for the 40 // Asks cryptohomed to return data about the key identified by |label| for the
37 // user identified by |id|. At present, this does not return any secret 41 // user identified by |id|. At present, this does not return any secret
38 // information and the request does not need to be authenticated. 42 // information and the request does not need to be authenticated.
39 virtual void GetKeyDataEx(const Identification& id, 43 virtual void GetKeyDataEx(const Identification& id,
40 const std::string& label, 44 const std::string& label,
41 const GetKeyDataCallback& callback) = 0; 45 const GetKeyDataCallback& callback) = 0;
42 46
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const Authorization& auth, 92 const Authorization& auth,
89 const std::string& label, 93 const std::string& label,
90 const Callback& callback) = 0; 94 const Callback& callback) = 0;
91 95
92 // Asks cryptohomed to change cryptohome identification |id_from| to |id_to|, 96 // Asks cryptohomed to change cryptohome identification |id_from| to |id_to|,
93 // which results in cryptohome directory renaming. 97 // which results in cryptohome directory renaming.
94 virtual void RenameCryptohome(const Identification& id_from, 98 virtual void RenameCryptohome(const Identification& id_from,
95 const Identification& id_to, 99 const Identification& id_to,
96 const Callback& callback) = 0; 100 const Callback& callback) = 0;
97 101
102 // Asks cryptohomed to compute the size of cryptohome for user identified by
103 // |id|.
104 virtual void GetAccountDiskUsage(
105 const Identification& id,
106 const GetAccountDiskUsageCallback& callback) = 0;
107
98 // Creates the global HomedirMethods instance. 108 // Creates the global HomedirMethods instance.
99 static void Initialize(); 109 static void Initialize();
100 110
101 // Similar to Initialize(), but can inject an alternative 111 // Similar to Initialize(), but can inject an alternative
102 // HomedirMethods such as MockHomedirMethods for testing. 112 // HomedirMethods such as MockHomedirMethods for testing.
103 // The injected object will be owned by the internal pointer and deleted 113 // The injected object will be owned by the internal pointer and deleted
104 // by Shutdown(). 114 // by Shutdown().
105 static void InitializeForTesting(HomedirMethods* homedir_methods); 115 static void InitializeForTesting(HomedirMethods* homedir_methods);
106 116
107 // Destroys the global HomedirMethods instance if it exists. 117 // Destroys the global HomedirMethods instance if it exists.
108 static void Shutdown(); 118 static void Shutdown();
109 119
110 // Returns a pointer to the global HomedirMethods instance. 120 // Returns a pointer to the global HomedirMethods instance.
111 // Initialize() should already have been called. 121 // Initialize() should already have been called.
112 static HomedirMethods* GetInstance(); 122 static HomedirMethods* GetInstance();
113 }; 123 };
114 124
115 } // namespace cryptohome 125 } // namespace cryptohome
116 126
117 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ 127 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc ('k') | chromeos/cryptohome/homedir_methods.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698