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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 private: | 47 private: |
48 ~AddToHomescreenManager() override; | 48 ~AddToHomescreenManager() override; |
49 | 49 |
50 // Shows alert to prompt user for name of home screen shortcut. | 50 // Shows alert to prompt user for name of home screen shortcut. |
51 void ShowDialog(); | 51 void ShowDialog(); |
52 | 52 |
53 // Called only when the AddToHomescreenDataFetcher has retrieved all of the | 53 // Called only when the AddToHomescreenDataFetcher has retrieved all of the |
54 // data needed to add the shortcut. | 54 // data needed to add the shortcut. |
55 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); | 55 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); |
56 | 56 |
| 57 // Called only when the AddToHomescreenDataFetcher has retrieved all of the |
| 58 // data needed to install a WebAPK. |
| 59 void CreateInfoBarForWebAPK(const ShortcutInfo& info, const SkBitmap& icon); |
| 60 |
57 void RecordAddToHomescreen(); | 61 void RecordAddToHomescreen(); |
58 | 62 |
59 // AddToHomescreenDataFetcher::Observer: | 63 // AddToHomescreenDataFetcher::Observer: |
60 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override; | 64 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override; |
61 void OnUserTitleAvailable(const base::string16& user_title) override; | 65 void OnUserTitleAvailable(const base::string16& user_title) override; |
62 void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override; | 66 void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override; |
63 SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, | 67 SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, |
64 const GURL& url, | 68 const GURL& url, |
65 bool* is_generated) override; | 69 bool* is_generated) override; |
66 | 70 |
67 // Points to the Java object. | 71 // Points to the Java object. |
68 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 72 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
69 | 73 |
70 // Whether the user has requested that a shortcut be added while a fetch was | 74 // Whether the user has requested that a shortcut be added while a fetch was |
71 // in progress. | 75 // in progress. |
72 bool add_shortcut_pending_; | 76 bool add_shortcut_pending_; |
73 | 77 |
| 78 // Whether the site is WebAPK-compatible. |
| 79 bool is_webapk_compatible_; |
| 80 |
74 // Fetches data required to add a shortcut. | 81 // Fetches data required to add a shortcut. |
75 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; | 82 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; |
76 | 83 |
77 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); | 84 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); |
78 }; | 85 }; |
79 | 86 |
80 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ | 87 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ |
OLD | NEW |