| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DIALOG_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_weak_ref.h" | 9 #include "base/android/jni_weak_ref.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Registers JNI hooks. | 39 // Registers JNI hooks. |
| 40 static bool RegisterAddToHomescreenDialogHelper(JNIEnv* env); | 40 static bool RegisterAddToHomescreenDialogHelper(JNIEnv* env); |
| 41 | 41 |
| 42 // Adds a shortcut to the current URL to the Android home screen. | 42 // Adds a shortcut to the current URL to the Android home screen. |
| 43 void AddShortcut(JNIEnv* env, jobject obj, jstring title); | 43 void AddShortcut(JNIEnv* env, jobject obj, jstring title); |
| 44 | 44 |
| 45 // AddToHomescreenDataFetcher::Observer | 45 // AddToHomescreenDataFetcher::Observer |
| 46 void OnUserTitleAvailable(const base::string16& user_title) override; | 46 void OnUserTitleAvailable(const base::string16& user_title) override; |
| 47 void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override; | 47 void OnDataAvailable(const ShortcutInfo& info, const SkBitmap& icon) override; |
| 48 SkBitmap FinalizeLauncherIcon(const SkBitmap& icon, const GURL& url) override; | 48 SkBitmap FinalizeLauncherIcon(const SkBitmap& icon, |
| 49 const GURL& url, |
| 50 bool* is_generated) override; |
| 49 | 51 |
| 50 private: | 52 private: |
| 51 virtual ~AddToHomescreenDialogHelper(); | 53 virtual ~AddToHomescreenDialogHelper(); |
| 52 | 54 |
| 53 // Called only when the AddToHomescreenDataFetcher has retrieved all of the | 55 // Called only when the AddToHomescreenDataFetcher has retrieved all of the |
| 54 // data needed to add the shortcut. | 56 // data needed to add the shortcut. |
| 55 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); | 57 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); |
| 56 | 58 |
| 57 void RecordAddToHomescreen(); | 59 void RecordAddToHomescreen(); |
| 58 | 60 |
| 59 // Points to the Java object. | 61 // Points to the Java object. |
| 60 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 62 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 61 | 63 |
| 62 // Whether the user has requested that a shortcut be added while a fetch was | 64 // Whether the user has requested that a shortcut be added while a fetch was |
| 63 // in progress. | 65 // in progress. |
| 64 bool add_shortcut_pending_; | 66 bool add_shortcut_pending_; |
| 65 | 67 |
| 66 // Fetches data required to add a shortcut. | 68 // Fetches data required to add a shortcut. |
| 67 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; | 69 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDialogHelper); | 71 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDialogHelper); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_ | 74 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DIALOG_HELPER_H_ |
| OLD | NEW |