| 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_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/android/webapk/chrome_webapk_host.h" |
| 11 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" | 12 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 class WebContents; | 15 class WebContents; |
| 15 } | 16 } |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 struct ShortcutInfo; | 20 struct ShortcutInfo; |
| 20 | 21 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 void AddShortcut(JNIEnv* env, | 37 void AddShortcut(JNIEnv* env, |
| 37 const base::android::JavaParamRef<jobject>& obj, | 38 const base::android::JavaParamRef<jobject>& obj, |
| 38 const base::android::JavaParamRef<jstring>& title); | 39 const base::android::JavaParamRef<jstring>& title); |
| 39 | 40 |
| 40 // Starts the add-to-homescreen process. | 41 // Starts the add-to-homescreen process. |
| 41 void Start(content::WebContents* web_contents); | 42 void Start(content::WebContents* web_contents); |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 ~AddToHomescreenManager() override; | 45 ~AddToHomescreenManager() override; |
| 45 | 46 |
| 47 // Called by |Start()| which may check whether the WebAPK Install API is |
| 48 // availabel asynchrously. |
| 49 void StartImpl(content::WebContents* web_contents, |
| 50 bool check_webapk_compatible, |
| 51 bool can_use_webapk_install_flow); |
| 52 |
| 53 // Checks whether the Google Play Install API is available when the Google |
| 54 // Play install is allowed. |
| 55 void CanUseGooglePlayInstallApi( |
| 56 const ChromeWebApkHost::CanUseGooglePlayInstallApiCallback& callback); |
| 57 |
| 58 // Called when the check of whether the Google Play Install API is available |
| 59 // is done. |
| 60 void OnCanUseGooglePlayInstallApi(content::WebContents* web_contents, |
| 61 bool check_webapk_compatible, |
| 62 bool isAvailable); |
| 63 |
| 46 // Shows alert to prompt user for name of home screen shortcut. | 64 // Shows alert to prompt user for name of home screen shortcut. |
| 47 void ShowDialog(); | 65 void ShowDialog(); |
| 48 | 66 |
| 49 // Called only when the AddToHomescreenDataFetcher has retrieved all of the | 67 // Called only when the AddToHomescreenDataFetcher has retrieved all of the |
| 50 // data needed to add the shortcut. | 68 // data needed to add the shortcut. |
| 51 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); | 69 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); |
| 52 | 70 |
| 53 // Called only when the AddToHomescreenDataFetcher has retrieved all of the | 71 // Called only when the AddToHomescreenDataFetcher has retrieved all of the |
| 54 // data needed to install a WebAPK. | 72 // data needed to install a WebAPK. |
| 55 void CreateInfoBarForWebApk(const ShortcutInfo& info, const SkBitmap& icon); | 73 void CreateInfoBarForWebApk(const ShortcutInfo& info, const SkBitmap& icon); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 76 // Whether the site is WebAPK-compatible. | 94 // Whether the site is WebAPK-compatible. |
| 77 bool is_webapk_compatible_; | 95 bool is_webapk_compatible_; |
| 78 | 96 |
| 79 // Fetches data required to add a shortcut. | 97 // Fetches data required to add a shortcut. |
| 80 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; | 98 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; |
| 81 | 99 |
| 82 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); | 100 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); |
| 83 }; | 101 }; |
| 84 | 102 |
| 85 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ | 103 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ |
| OLD | NEW |