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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
8 #include "base/android/jni_android.h"
9 #include "base/android/jni_weak_ref.h"
10 #include "chrome/browser/android/shortcut_info.h"
11 #include "third_party/skia/include/core/SkBitmap.h"
15 } // namespace content
17 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's
18 // ShortcutHelper in Java.
19 class ShortcutHelper
{
21 // Registers JNI hooks.
22 static bool RegisterShortcutHelper(JNIEnv
* env
);
24 // Adds a shortcut to the launcher using a SkBitmap.
25 // Must be called on the IO thread.
26 static void AddShortcutInBackgroundWithSkBitmap(const ShortcutInfo
& info
,
27 const std::string
& webapp_id
,
28 const SkBitmap
& icon_bitmap
);
30 // Returns the ideal size for an icon representing a web app.
31 static int GetIdealHomescreenIconSizeInDp();
33 // Returns the minimum size for an icon representing a web app.
34 static int GetMinimumHomescreenIconSizeInDp();
36 // Returns the ideal size for an image displayed on a web app's splash
38 static int GetIdealSplashImageSizeInDp();
40 // Returns the minimum size for an image displayed on a web app's splash
42 static int GetMinimumSplashImageSizeInDp();
44 // Fetches the splash screen image and stores it inside the WebappDataStorage
46 static void FetchSplashScreenImage(content::WebContents
* web_contents
,
47 const GURL
& image_url
,
48 const int ideal_splash_image_size_in_dp
,
49 const int minimum_splash_image_size_in_dp
,
50 const std::string
& webapp_id
);
52 // Stores the data of the webapp which is not placed inside the shortcut.
53 static void StoreWebappData(const std::string
& webapp_id
,
54 const SkBitmap
& splash_image
);
57 ShortcutHelper() = delete;
58 ~ShortcutHelper() = delete;
60 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper
);
63 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_