| 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 <memory> |
| 9 |
| 8 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" | 13 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 class WebContents; | 16 class WebContents; |
| 15 } | 17 } |
| 16 | 18 |
| 17 class GURL; | |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 struct ShortcutInfo; | 20 struct ShortcutInfo; |
| 20 | 21 |
| 21 // AddToHomescreenManager is the C++ counterpart of | 22 // AddToHomescreenManager is the C++ counterpart of |
| 22 // org.chromium.chrome.browser's AddToHomescreenManager in Java. The object | 23 // org.chromium.chrome.browser's AddToHomescreenManager in Java. The object |
| 23 // is owned by the Java object. It is created from there via a JNI | 24 // is owned by the Java object. It is created from there via a JNI |
| 24 // (InitializeAndStart) call and MUST BE DESTROYED via Destroy(). | 25 // (InitializeAndStart) call and MUST BE DESTROYED via Destroy(). |
| 25 class AddToHomescreenManager : public AddToHomescreenDataFetcher::Observer { | 26 class AddToHomescreenManager : public AddToHomescreenDataFetcher::Observer { |
| 26 public: | 27 public: |
| 27 AddToHomescreenManager(JNIEnv* env, jobject obj); | 28 AddToHomescreenManager(JNIEnv* env, jobject obj); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 53 const SkBitmap& badge_icon); | 54 const SkBitmap& badge_icon); |
| 54 | 55 |
| 55 void RecordAddToHomescreen(); | 56 void RecordAddToHomescreen(); |
| 56 | 57 |
| 57 // AddToHomescreenDataFetcher::Observer: | 58 // AddToHomescreenDataFetcher::Observer: |
| 58 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override; | 59 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override; |
| 59 void OnUserTitleAvailable(const base::string16& user_title) override; | 60 void OnUserTitleAvailable(const base::string16& user_title) override; |
| 60 void OnDataAvailable(const ShortcutInfo& info, | 61 void OnDataAvailable(const ShortcutInfo& info, |
| 61 const SkBitmap& primary_icon, | 62 const SkBitmap& primary_icon, |
| 62 const SkBitmap& badge_icon) override; | 63 const SkBitmap& badge_icon) override; |
| 63 SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, | |
| 64 const GURL& url, | |
| 65 bool* is_generated) override; | |
| 66 | 64 |
| 67 // Points to the Java object. | 65 // Points to the Java object. |
| 68 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 66 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 69 | 67 |
| 70 // Whether the site is WebAPK-compatible. | 68 // Whether the site is WebAPK-compatible. |
| 71 bool is_webapk_compatible_; | 69 bool is_webapk_compatible_; |
| 72 | 70 |
| 73 // Fetches data required to add a shortcut. | 71 // Fetches data required to add a shortcut. |
| 74 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; | 72 std::unique_ptr<AddToHomescreenDataFetcher> data_fetcher_; |
| 75 | 73 |
| 76 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); | 74 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); |
| 77 }; | 75 }; |
| 78 | 76 |
| 79 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ | 77 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ |
| OLD | NEW |