| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_STORAGE_MANAGER_ARC_STORAGE_MANAGER_H | 5 #ifndef COMPONENTS_ARC_STORAGE_MANAGER_ARC_STORAGE_MANAGER_H_ |
| 6 #define COMPONENTS_ARC_STORAGE_MANAGER_ARC_STORAGE_MANAGER_H | 6 #define COMPONENTS_ARC_STORAGE_MANAGER_ARC_STORAGE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/arc/arc_bridge_service.h" | 12 #include "components/arc/arc_bridge_service.h" |
| 13 #include "components/arc/arc_service.h" | 13 #include "components/arc/arc_service.h" |
| 14 #include "components/arc/common/storage_manager.mojom.h" | 14 #include "components/arc/common/storage_manager.mojom.h" |
| 15 | 15 |
| 16 namespace arc { | 16 namespace arc { |
| 17 | 17 |
| 18 // This class represents as a simple proxy of StorageManager to Chrome OS. | 18 // This class represents as a simple proxy of StorageManager to Chrome OS. |
| 19 class ArcStorageManager : public ArcService, | 19 class ArcStorageManager : public ArcService { |
| 20 public ArcBridgeService::Observer { | |
| 21 public: | 20 public: |
| 22 explicit ArcStorageManager(ArcBridgeService* bridge_service); | 21 explicit ArcStorageManager(ArcBridgeService* bridge_service); |
| 23 ~ArcStorageManager() override; | 22 ~ArcStorageManager() override; |
| 24 | 23 |
| 25 // Gets the singleton instance of the ARC Storage Manager. | 24 // Gets the singleton instance of the ARC Storage Manager. |
| 26 // MUST be called while ArcStorageManager is alive, otherwise it returns | 25 // MUST be called while ArcStorageManager is alive, otherwise it returns |
| 27 // nullptr (or aborts on Debug build). | 26 // nullptr (or aborts on Debug build). |
| 28 static ArcStorageManager* Get(); | 27 static ArcStorageManager* Get(); |
| 29 | 28 |
| 30 // ArcBridgeService::Observer | |
| 31 void OnStorageManagerInstanceReady() override; | |
| 32 | |
| 33 // Opens detailed preference screen of private volume on ARC. | 29 // Opens detailed preference screen of private volume on ARC. |
| 34 // Returns false when an instance of ARC-side isn't ready yet. | 30 // Returns false when an instance of ARC-side isn't ready yet. |
| 35 bool OpenPrivateVolumeSettings(); | 31 bool OpenPrivateVolumeSettings(); |
| 36 | 32 |
| 37 // Gets storage usage of all application's APK, data, and cache size. | 33 // Gets storage usage of all application's APK, data, and cache size. |
| 38 using GetApplicationsSizeCallback = base::Callback< | 34 using GetApplicationsSizeCallback = |
| 39 void(bool succeeded, arc::mojom::ApplicationsSizePtr)>; | 35 base::Callback<void(bool succeeded, arc::mojom::ApplicationsSizePtr)>; |
| 40 bool GetApplicationsSize(const GetApplicationsSizeCallback& callback); | 36 bool GetApplicationsSize(const GetApplicationsSizeCallback& callback); |
| 41 | 37 |
| 42 // Deletes all applications' cache files. | 38 // Deletes all applications' cache files. |
| 43 bool DeleteApplicationsCache(const base::Callback<void()>& callback); | 39 bool DeleteApplicationsCache(const base::Callback<void()>& callback); |
| 44 | 40 |
| 45 private: | 41 private: |
| 46 mojom::StorageManagerInstance* GetStorageManagerInstance(); | 42 mojom::StorageManagerInstance* GetStorageManagerInstance(); |
| 47 | 43 |
| 48 DISALLOW_COPY_AND_ASSIGN(ArcStorageManager); | 44 DISALLOW_COPY_AND_ASSIGN(ArcStorageManager); |
| 49 }; | 45 }; |
| 50 | 46 |
| 51 } // namespace arc | 47 } // namespace arc |
| 52 | 48 |
| 53 #endif // COMPONENTS_ARC_STORAGE_MANAGER_ARC_STORAGE_MANAGER_H | 49 #endif // COMPONENTS_ARC_STORAGE_MANAGER_ARC_STORAGE_MANAGER_H_ |
| OLD | NEW |