Chromium Code Reviews| Index: chrome/browser/ui/webui/webapks_handler.h |
| diff --git a/chrome/browser/ui/webui/webapks_handler.h b/chrome/browser/ui/webui/webapks_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5c79ac7caa392d5747aa72dd71817ebbefc9941b |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/webapks_handler.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_WEBUI_WEBAPKS_HANDLER_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_WEBAPKS_HANDLER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/values.h" |
| +#include "chrome/browser/android/webapk/webapk_info.h" |
| +#include "content/public/browser/web_ui_message_handler.h" |
| + |
| +// Handles JavaScript messages from the chrome://webapks page. |
| +class WebApksHandler : public content::WebUIMessageHandler { |
| + public: |
| + WebApksHandler(); |
| + ~WebApksHandler() override; |
| + |
| + // content::WebUIMessageHandler implementation. |
|
pkotwicz
2017/01/20 16:57:17
Nit: "content::WebUIMessageHandler implementation.
gonzalon
2017/01/20 19:27:01
Done.
|
| + void RegisterMessages() override; |
| + |
| + // Handler for the "requestWebApksInfo" message. This requests |
| + // information for the installed WebAPKs and returns it to JS using |
| + // OnWebApkInfoReceived(). |
| + virtual void HandleRequestWebApksInfo(const base::ListValue* args); |
| + |
| + private: |
| + // Sends information for the installed WebAPKs to JS. |
| + void OnWebApkInfoReceived(std::vector<const WebApkInfo> webapks_list); |
| + |
| + // Factory for the creating refs in callbacks. |
| + base::WeakPtrFactory<WebApksHandler> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebApksHandler); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_WEBAPKS_HANDLER_H_ |