| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/ui/webui/options/options_ui.h" | 10 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 10 | 11 |
| 11 namespace chromeos { | 12 namespace chromeos { |
| 12 namespace options { | 13 namespace options { |
| 13 | 14 |
| 14 // Storage manager overlay page UI handler. | 15 // Storage manager overlay page UI handler. |
| 15 class StorageManagerHandler : public ::options::OptionsPageUIHandler { | 16 class StorageManagerHandler : public ::options::OptionsPageUIHandler { |
| 16 public: | 17 public: |
| 17 StorageManagerHandler(); | 18 StorageManagerHandler(); |
| 18 ~StorageManagerHandler() override; | 19 ~StorageManagerHandler() override; |
| 19 | 20 |
| 20 // OptionsPageUIHandler implementation. | 21 // OptionsPageUIHandler implementation. |
| 21 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 22 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 22 void InitializePage() override; | 23 void InitializePage() override; |
| 23 | 24 |
| 24 // WebUIMessageHandler implementation. | 25 // WebUIMessageHandler implementation. |
| 25 void RegisterMessages() override; | 26 void RegisterMessages() override; |
| 26 | 27 |
| 27 private: | 28 private: |
| 29 // Handlers of JS messages. |
| 30 void HandleUpdateStorageInfo(const base::ListValue* unused_args); |
| 31 void HandleOpenDownloads(const base::ListValue* unused_args); |
| 32 |
| 33 // Requests updating disk space information. |
| 34 void UpdateSizeStat(); |
| 35 |
| 36 // Callback to update the UI about disk space information. |
| 37 void OnGetSizeStat(int64_t* total_size, int64_t* available_size); |
| 38 |
| 39 // Requests updating the size of Downloads directory. |
| 40 void UpdateDownloadsSize(); |
| 41 |
| 42 // Callback to update the UI about the size of Downloads directory. |
| 43 void OnGetDownloadsSize(int64_t size); |
| 44 |
| 45 base::WeakPtrFactory<StorageManagerHandler> weak_ptr_factory_; |
| 46 |
| 28 DISALLOW_COPY_AND_ASSIGN(StorageManagerHandler); | 47 DISALLOW_COPY_AND_ASSIGN(StorageManagerHandler); |
| 29 }; | 48 }; |
| 30 | 49 |
| 31 } // namespace options | 50 } // namespace options |
| 32 } // namespace chromeos | 51 } // namespace chromeos |
| 33 | 52 |
| 34 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ | 53 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_STORAGE_MANAGER_HANDLER_H_ |
| OLD | NEW |