| 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_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Talks to Chrome WebAPK server and Google Play to generate a WebAPK on the | 38 // Talks to Chrome WebAPK server and Google Play to generate a WebAPK on the |
| 39 // server, download it, and install it. | 39 // server, download it, and install it. |
| 40 class WebApkInstaller : public net::URLFetcherDelegate { | 40 class WebApkInstaller : public net::URLFetcherDelegate { |
| 41 public: | 41 public: |
| 42 using FinishCallback = base::Callback<void(bool)>; | 42 using FinishCallback = base::Callback<void(bool)>; |
| 43 | 43 |
| 44 WebApkInstaller(const ShortcutInfo& shortcut_info, | 44 WebApkInstaller(const ShortcutInfo& shortcut_info, |
| 45 const SkBitmap& shorcut_icon); | 45 const SkBitmap& shorcut_icon); |
| 46 ~WebApkInstaller() override; | 46 ~WebApkInstaller() override; |
| 47 | 47 |
| 48 // Register JNI methods. | |
| 49 static bool Register(JNIEnv* env); | |
| 50 | |
| 51 // Talks to the Chrome WebAPK server to generate a WebAPK on the server and to | 48 // Talks to the Chrome WebAPK server to generate a WebAPK on the server and to |
| 52 // Google Play to install the generated WebAPK. Calls |callback| after the | 49 // Google Play to install the generated WebAPK. Calls |callback| after the |
| 53 // request to install the WebAPK is sent to Google Play. | 50 // request to install the WebAPK is sent to Google Play. |
| 54 void InstallAsync(content::BrowserContext* browser_context, | 51 void InstallAsync(content::BrowserContext* browser_context, |
| 55 const FinishCallback& callback); | 52 const FinishCallback& callback); |
| 56 | 53 |
| 57 // Same as InstallAsync() but uses the passed in |request_context_getter|. | 54 // Same as InstallAsync() but uses the passed in |request_context_getter|. |
| 58 void InstallAsyncWithURLRequestContextGetter( | 55 void InstallAsyncWithURLRequestContextGetter( |
| 59 net::URLRequestContextGetter* request_context_getter, | 56 net::URLRequestContextGetter* request_context_getter, |
| 60 const FinishCallback& callback); | 57 const FinishCallback& callback); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // WebAPK server URL. | 131 // WebAPK server URL. |
| 135 GURL server_url_; | 132 GURL server_url_; |
| 136 | 133 |
| 137 // Used to get |weak_ptr_| on the IO thread. | 134 // Used to get |weak_ptr_| on the IO thread. |
| 138 base::WeakPtrFactory<WebApkInstaller> io_weak_ptr_factory_; | 135 base::WeakPtrFactory<WebApkInstaller> io_weak_ptr_factory_; |
| 139 | 136 |
| 140 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); | 137 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); |
| 141 }; | 138 }; |
| 142 | 139 |
| 143 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ | 140 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ |
| OLD | NEW |