OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_WEBAPKS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WEBAPKS_HANDLER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/android/webapk/webapk_info.h" |
| 13 #include "content/public/browser/web_ui_message_handler.h" |
| 14 |
| 15 namespace base { |
| 16 class ListValue; |
| 17 } // namespace base |
| 18 |
| 19 // Handles JavaScript messages from the chrome://webapks page. |
| 20 class WebApksHandler : public content::WebUIMessageHandler { |
| 21 public: |
| 22 WebApksHandler(); |
| 23 ~WebApksHandler() override; |
| 24 |
| 25 // content::WebUIMessageHandler: |
| 26 void RegisterMessages() override; |
| 27 |
| 28 // Handler for the "requestWebApksInfo" message. This requests |
| 29 // information for the installed WebAPKs and returns it to JS using |
| 30 // OnWebApkInfoReceived(). |
| 31 virtual void HandleRequestWebApksInfo(const base::ListValue* args); |
| 32 |
| 33 private: |
| 34 // Sends information for the installed WebAPKs to JS. |
| 35 void OnWebApkInfoRetrieved(const std::vector<WebApkInfo>& webapks_list); |
| 36 |
| 37 // Factory for the creating refs in callbacks. |
| 38 base::WeakPtrFactory<WebApksHandler> weak_ptr_factory_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(WebApksHandler); |
| 41 }; |
| 42 |
| 43 #endif // CHROME_BROWSER_UI_WEBUI_WEBAPKS_HANDLER_H_ |
OLD | NEW |