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" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void StartFetching(content::WebContents* web_contents, | 61 void StartFetching(content::WebContents* web_contents, |
62 bool check_installable); | 62 bool check_installable); |
63 | 63 |
64 // Shows alert to prompt user for name of home screen shortcut. | 64 // Shows alert to prompt user for name of home screen shortcut. |
65 void ShowDialog(); | 65 void ShowDialog(); |
66 | 66 |
67 // Called only when the AddToHomescreenDataFetcher has retrieved all of the | 67 // Called only when the AddToHomescreenDataFetcher has retrieved all of the |
68 // data needed to add the shortcut. | 68 // data needed to add the shortcut. |
69 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); | 69 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); |
70 | 70 |
| 71 // Called only when the AddToHomescreenDataFetcher has retrieved all of the |
| 72 // data needed to install a WebAPK. |
| 73 void CreateInfoBarForWebAPK(const ShortcutInfo& info, const SkBitmap& icon); |
| 74 |
71 void RecordAddToHomescreen(); | 75 void RecordAddToHomescreen(); |
72 | 76 |
73 // AddToHomescreenDataFetcher::Observer: | 77 // AddToHomescreenDataFetcher::Observer: |
74 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override; | 78 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override; |
75 void OnUserTitleAvailable(const base::string16& user_title) override; | 79 void OnUserTitleAvailable(const base::string16& user_title) override; |
76 void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override; | 80 void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override; |
77 SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, | 81 SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, |
78 const GURL& url, | 82 const GURL& url, |
79 bool* is_generated) override; | 83 bool* is_generated) override; |
80 | 84 |
81 // Points to the Java object. | 85 // Points to the Java object. |
82 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 86 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
83 | 87 |
84 // Whether the user has requested that a shortcut be added while a fetch was | 88 // Whether the user has requested that a shortcut be added while a fetch was |
85 // in progress. | 89 // in progress. |
86 bool add_shortcut_pending_; | 90 bool add_shortcut_pending_; |
87 | 91 |
| 92 // Whether the site is WebAPK-compatible. |
| 93 bool is_webapk_compatible_; |
| 94 |
88 // Fetches data required to add a shortcut. | 95 // Fetches data required to add a shortcut. |
89 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; | 96 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; |
90 | 97 |
91 base::WeakPtrFactory<AddToHomescreenManager> weak_ptr_factory_; | 98 base::WeakPtrFactory<AddToHomescreenManager> weak_ptr_factory_; |
92 | 99 |
93 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); | 100 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); |
94 }; | 101 }; |
95 | 102 |
96 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ | 103 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ |
OLD | NEW |