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 CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <vector> |
| 11 |
8 #include "base/macros.h" | 12 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/ui/webui/options/options_ui.h" | 14 #include "chrome/browser/ui/webui/options/options_ui.h" |
11 #include "components/arc/storage_manager/arc_storage_manager.h" | 15 #include "components/arc/storage_manager/arc_storage_manager.h" |
| 16 #include "components/user_manager/user.h" |
12 | 17 |
13 namespace chromeos { | 18 namespace chromeos { |
14 namespace options { | 19 namespace options { |
15 | 20 |
16 // Storage manager overlay page UI handler. | 21 // Storage manager overlay page UI handler. |
17 class StorageManagerHandler : public ::options::OptionsPageUIHandler { | 22 class StorageManagerHandler : public ::options::OptionsPageUIHandler { |
18 public: | 23 public: |
19 // Enumeration for device state about remaining space. These values must be | 24 // Enumeration for device state about remaining space. These values must be |
20 // kept in sync with options.StorageSpaceState in JS code. | 25 // kept in sync with options.StorageSpaceState in JS code. |
21 enum StorageSpaceState { | 26 enum StorageSpaceState { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 63 |
59 // Callback to update the UI about the size of Drive Cache. | 64 // Callback to update the UI about the size of Drive Cache. |
60 void OnGetDriveCacheSize(int64_t size); | 65 void OnGetDriveCacheSize(int64_t size); |
61 | 66 |
62 // Requests updating the size of browsing data. | 67 // Requests updating the size of browsing data. |
63 void UpdateBrowsingDataSize(); | 68 void UpdateBrowsingDataSize(); |
64 | 69 |
65 // Callback to update the UI about the size of browsing data. | 70 // Callback to update the UI about the size of browsing data. |
66 void OnGetBrowsingDataSize(bool is_site_data, int64_t size); | 71 void OnGetBrowsingDataSize(bool is_site_data, int64_t size); |
67 | 72 |
| 73 // Requests updating the total size of other users' data. |
| 74 void UpdateOtherUsersSize(); |
| 75 |
| 76 // Callback to save the fetched user sizes and update the UI. |
| 77 void OnGetOtherUserSize(bool success, int64_t size); |
| 78 |
68 // Requests updating the space size used by Android apps and cache. | 79 // Requests updating the space size used by Android apps and cache. |
69 void UpdateArcSize(); | 80 void UpdateArcSize(); |
70 | 81 |
71 // Callback to update the UI about Android apps and cache. | 82 // Callback to update the UI about Android apps and cache. |
72 void OnGetArcSize(bool succeeded, arc::mojom::ApplicationsSizePtr size); | 83 void OnGetArcSize(bool succeeded, arc::mojom::ApplicationsSizePtr size); |
73 | 84 |
74 // Callback called when clearing Drive cache is done. | 85 // Callback called when clearing Drive cache is done. |
75 void OnClearDriveCacheDone(bool success); | 86 void OnClearDriveCacheDone(bool success); |
76 | 87 |
77 // Total size of cache data in browsing data. | 88 // Total size of cache data in browsing data. |
78 int64_t browser_cache_size_; | 89 int64_t browser_cache_size_; |
79 | 90 |
80 // Total size of site data in browsing data. | 91 // Total size of site data in browsing data. |
81 int64_t browser_site_data_size_; | 92 int64_t browser_site_data_size_; |
82 | 93 |
| 94 // The list of other users whose directory sizes will be accumulated as the |
| 95 // size of "Other users". |
| 96 user_manager::UserList other_users_; |
| 97 |
| 98 // Fetched sizes of user directories. |
| 99 std::vector<int64_t> user_sizes_; |
| 100 |
83 base::WeakPtrFactory<StorageManagerHandler> weak_ptr_factory_; | 101 base::WeakPtrFactory<StorageManagerHandler> weak_ptr_factory_; |
84 | 102 |
85 DISALLOW_COPY_AND_ASSIGN(StorageManagerHandler); | 103 DISALLOW_COPY_AND_ASSIGN(StorageManagerHandler); |
86 }; | 104 }; |
87 | 105 |
88 } // namespace options | 106 } // namespace options |
89 } // namespace chromeos | 107 } // namespace chromeos |
90 | 108 |
91 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ | 109 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ |
OLD | NEW |