Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHORTCUT_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_SHORTCUT_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 "chrome/browser/android/shortcut_info.h" | 10 #include "chrome/browser/android/shortcut_info.h" |
| 11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 | 12 |
| 13 namespace content { | |
| 14 class WebContents; | |
| 15 } // namespace content | |
| 16 | |
| 13 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's | 17 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's |
| 14 // ShortcutHelper in Java. The object is owned by the Java object. It is created | 18 // ShortcutHelper in Java. The object is owned by the Java object. It is created |
|
gone
2015/08/26 21:39:25
Nothing owns the native ShortcutHelper -- you don'
Lalit Maganti
2015/08/26 22:55:00
This is fixed by a rebase. I hadn't based this off
| |
| 15 // from there via a JNI (Initialize) call and MUST BE DESTROYED via Destroy(). | 19 // from there via a JNI (Initialize) call and MUST BE DESTROYED via Destroy(). |
| 16 class ShortcutHelper { | 20 class ShortcutHelper final { |
| 17 public: | 21 public: |
| 18 // Registers JNI hooks. | 22 // Registers JNI hooks. |
| 19 static bool RegisterShortcutHelper(JNIEnv* env); | 23 static bool RegisterShortcutHelper(JNIEnv* env); |
| 20 | 24 |
| 21 // Adds a shortcut to the launcher using a SkBitmap. | 25 // Adds a shortcut to the launcher using a SkBitmap. |
| 22 // Must be called on the IO thread. | 26 // Must be called on the IO thread. |
| 23 static void AddShortcutInBackgroundWithSkBitmap(const ShortcutInfo& info, | 27 static void AddShortcutInBackgroundWithSkBitmap(const ShortcutInfo& info, |
| 28 const std::string& webapp_id, | |
| 24 const SkBitmap& icon_bitmap); | 29 const SkBitmap& icon_bitmap); |
| 30 | |
| 31 // Fetches the splashscreen image and stores it inside the WebappDataStorage | |
| 32 // of the webapp. | |
| 33 static void FetchSplashscreenImage(content::WebContents* web_contents, | |
| 34 const GURL& image_url, | |
| 35 const int ideal_splash_image_size_in_dp, | |
| 36 const std::string& webapp_id); | |
| 37 | |
| 38 // Stores the data of the webapp which is not placed inside the shortcut. | |
| 39 static void StoreWebappData(const std::string& webapp_id, | |
| 40 const SkBitmap& splash_image); | |
| 41 | |
| 25 private: | 42 private: |
| 26 ShortcutHelper(); | 43 ShortcutHelper() = delete; |
| 44 ~ShortcutHelper() = delete; | |
| 27 | 45 |
| 28 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); | 46 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); |
| 29 }; | 47 }; |
| 30 | 48 |
| 31 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 49 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
| OLD | NEW |