| 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 |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/jni_weak_ref.h" | 12 #include "base/android/jni_weak_ref.h" |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "chrome/browser/android/shortcut_info.h" | 15 #include "chrome/browser/android/shortcut_info.h" |
| 16 #include "chrome/browser/android/webapk/webapk_info.h" | 16 #include "chrome/browser/android/webapk/webapk_info.h" |
| 17 #include "chrome/browser/android/webapk/webapk_install_service.h" |
| 17 #include "chrome/browser/android/webapk/webapk_installer.h" | 18 #include "chrome/browser/android/webapk/webapk_installer.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class WebContents; | 22 class WebContents; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's | 25 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's |
| 25 // ShortcutHelper in Java. | 26 // ShortcutHelper in Java. |
| 26 class ShortcutHelper { | 27 class ShortcutHelper { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 // or AddShortcutInBackgroundWithSkBitmap. | 38 // or AddShortcutInBackgroundWithSkBitmap. |
| 38 static void AddToLauncherWithSkBitmap(content::WebContents* web_contents, | 39 static void AddToLauncherWithSkBitmap(content::WebContents* web_contents, |
| 39 const ShortcutInfo& info, | 40 const ShortcutInfo& info, |
| 40 const SkBitmap& icon_bitmap); | 41 const SkBitmap& icon_bitmap); |
| 41 | 42 |
| 42 // Installs WebAPK and adds shortcut to the launcher. | 43 // Installs WebAPK and adds shortcut to the launcher. |
| 43 static void InstallWebApkWithSkBitmap( | 44 static void InstallWebApkWithSkBitmap( |
| 44 content::WebContents* web_conetnts, | 45 content::WebContents* web_conetnts, |
| 45 const ShortcutInfo& info, | 46 const ShortcutInfo& info, |
| 46 const SkBitmap& icon_bitmap, | 47 const SkBitmap& icon_bitmap, |
| 47 const WebApkInstaller::FinishCallback& callback); | 48 const WebApkInstallService::FinishCallback& callback); |
| 48 | 49 |
| 49 // 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 |
| 50 // 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. |
| 51 static void ShowWebApkInstallInProgressToast(); | 52 static void ShowWebApkInstallInProgressToast(); |
| 52 | 53 |
| 53 // 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. |
| 54 static int GetIdealHomescreenIconSizeInPx(); | 55 static int GetIdealHomescreenIconSizeInPx(); |
| 55 | 56 |
| 56 // Returns the minimum size for an icon representing a web app or a WebAPK. | 57 // Returns the minimum size for an icon representing a web app or a WebAPK. |
| 57 static int GetMinimumHomescreenIconSizeInPx(); | 58 static int GetMinimumHomescreenIconSizeInPx(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 107 |
| 107 // 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 |
| 108 // the info to the |callback|. | 109 // the info to the |callback|. |
| 109 static void RetrieveWebApks(const WebApkInfoCallback& callback); | 110 static void RetrieveWebApks(const WebApkInfoCallback& callback); |
| 110 | 111 |
| 111 private: | 112 private: |
| 112 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper); | 113 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 116 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
| OLD | NEW |