| 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 { | 13 namespace content { |
| 14 class WebContents; | 14 class WebContents; |
| 15 } // namespace content | 15 } // namespace content |
| 16 | 16 |
| 17 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's | 17 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's |
| 18 // ShortcutHelper in Java. | 18 // ShortcutHelper in Java. |
| 19 class ShortcutHelper { | 19 class ShortcutHelper { |
| 20 public: | 20 public: |
| 21 // Registers JNI hooks. | 21 // Registers JNI hooks. |
| 22 static bool RegisterShortcutHelper(JNIEnv* env); | 22 static bool RegisterShortcutHelper(JNIEnv* env); |
| 23 | 23 |
| 24 // Adds a shortcut to the launcher using a SkBitmap. | 24 // Adds a shortcut to the launcher using a SkBitmap. |
| 25 // Must be called on the IO thread. | 25 // Must be called on the IO thread. |
| 26 static void AddShortcutInBackgroundWithSkBitmap(const ShortcutInfo& info, | 26 static void AddShortcutInBackgroundWithSkBitmap(const ShortcutInfo& info, |
| 27 const std::string& webapp_id, | 27 const std::string& webapp_id, |
| 28 const SkBitmap& icon_bitmap); | 28 const SkBitmap& icon_bitmap); |
| 29 | 29 |
| 30 // Gets the ideal size that the image displayed on the splash screen |
| 31 // should be. |
| 32 static int GetIdealIconSizeInDp(); |
| 33 |
| 34 // Gets the minimum size that the image displayed on the splash screen |
| 35 // should be. |
| 36 static int GetMinimumIconSizeInDp(); |
| 37 |
| 38 // Gets the ideal size that the image displayed on the splash screen |
| 39 // should be. |
| 40 static int GetIdealSplashImageSizeInDp(); |
| 41 |
| 42 // Gets the minimum size that the image displayed on the splash screen |
| 43 // should be. |
| 44 static int GetMinimumSplashImageSizeInDp(); |
| 45 |
| 30 // Fetches the splash screen image and stores it inside the WebappDataStorage | 46 // Fetches the splash screen image and stores it inside the WebappDataStorage |
| 31 // of the webapp. | 47 // of the webapp. |
| 32 static void FetchSplashScreenImage(content::WebContents* web_contents, | 48 static void FetchSplashScreenImage(content::WebContents* web_contents, |
| 33 const GURL& image_url, | 49 const GURL& image_url, |
| 34 const int ideal_splash_image_size_in_dp, | 50 const int ideal_splash_image_size_in_dp, |
| 51 const int minimum_splash_image_size_in_dp, |
| 35 const std::string& webapp_id); | 52 const std::string& webapp_id); |
| 36 | 53 |
| 37 // Stores the data of the webapp which is not placed inside the shortcut. | 54 // Stores the data of the webapp which is not placed inside the shortcut. |
| 38 static void StoreWebappData(const std::string& webapp_id, | 55 static void StoreWebappData(const std::string& webapp_id, |
| 39 const SkBitmap& splash_image); | 56 const SkBitmap& splash_image); |
| 40 | 57 |
| 41 private: | 58 private: |
| 42 ShortcutHelper() = delete; | 59 ShortcutHelper() = delete; |
| 43 ~ShortcutHelper() = delete; | 60 ~ShortcutHelper() = delete; |
| 44 | 61 |
| 45 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); | 62 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); |
| 46 }; | 63 }; |
| 47 | 64 |
| 48 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 65 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
| OLD | NEW |