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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 using WebApkInfoCallback = | 29 using WebApkInfoCallback = |
| 30 base::Callback<void(const std::vector<WebApkInfo>&)>; | 30 base::Callback<void(const std::vector<WebApkInfo>&)>; |
| 31 | 31 |
| 32 // Registers JNI hooks. | 32 // Registers JNI hooks. |
| 33 static bool RegisterShortcutHelper(JNIEnv* env); | 33 static bool RegisterShortcutHelper(JNIEnv* env); |
| 34 | 34 |
| 35 // Adds a shortcut to the launcher using a SkBitmap. The type of shortcut | 35 // Adds a shortcut to the launcher using a SkBitmap. The type of shortcut |
| 36 // added depends on the properties in |info|. Calls one of | 36 // added depends on the properties in |info|. Calls one of |
| 37 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap, | 37 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap, |
| 38 // or AddShortcutInBackgroundWithSkBitmap. | 38 // or AddShortcutInBackgroundWithSkBitmap. |
| 39 static void AddToLauncherWithSkBitmap( | 39 static void AddToLauncherWithSkBitmap(content::WebContents* web_contents, |
| 40 content::BrowserContext* browser_context, | 40 const ShortcutInfo& info, |
| 41 const ShortcutInfo& info, | 41 const SkBitmap& icon_bitmap); |
| 42 const std::string& webapp_id, | |
| 43 const SkBitmap& icon_bitmap, | |
| 44 const base::Closure& splash_image_callback); | |
| 45 | 42 |
| 46 // Installs WebAPK and adds shortcut to the launcher. | 43 // Installs WebAPK and adds shortcut to the launcher. |
| 47 static void InstallWebApkWithSkBitmap( | 44 static void InstallWebApkWithSkBitmap( |
| 48 content::BrowserContext* browser_context, | 45 content::BrowserContext* browser_context, |
|
dominickn
2017/03/01 02:29:39
Nit: ideally this method should just take a WebCon
| |
| 49 const ShortcutInfo& info, | 46 const ShortcutInfo& info, |
| 50 const SkBitmap& icon_bitmap, | 47 const SkBitmap& icon_bitmap, |
| 51 const WebApkInstaller::FinishCallback& callback); | 48 const WebApkInstaller::FinishCallback& callback); |
| 52 | 49 |
| 53 // Shows toast notifying user that a WebAPK install is already in progress | 50 // Shows toast notifying user that a WebAPK install is already in progress |
| 54 // when user tries to queue a new install for the same WebAPK. | 51 // when user tries to queue a new install for the same WebAPK. |
| 55 static void ShowWebApkInstallInProgressToast(); | 52 static void ShowWebApkInstallInProgressToast(); |
| 56 | 53 |
| 57 // Returns the ideal size for an icon representing a web app or a WebAPK. | 54 // Returns the ideal size for an icon representing a web app or a WebAPK. |
| 58 static int GetIdealHomescreenIconSizeInPx(); | 55 static int GetIdealHomescreenIconSizeInPx(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 107 |
| 111 // Fetches information on all the WebAPKs installed on the device and returns | 108 // Fetches information on all the WebAPKs installed on the device and returns |
| 112 // the info to the |callback|. | 109 // the info to the |callback|. |
| 113 static void RetrieveWebApks(const WebApkInfoCallback& callback); | 110 static void RetrieveWebApks(const WebApkInfoCallback& callback); |
| 114 | 111 |
| 115 private: | 112 private: |
| 116 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper); | 113 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper); |
| 117 }; | 114 }; |
| 118 | 115 |
| 119 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 116 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
| OLD | NEW |