Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/android/shortcut_helper.h

Issue 2729993002: WebAPKs: Pass callback of type WebApkInstallService::FinishCallback to ShortcutHelper (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_installer.h" 17 #include "chrome/browser/android/webapk/webapk_install_service.h"
18 #include "third_party/skia/include/core/SkBitmap.h" 18 #include "third_party/skia/include/core/SkBitmap.h"
19 19
20 namespace content { 20 namespace content {
21 class WebContents; 21 class WebContents;
22 } 22 }
23 23
24 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's 24 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's
25 // ShortcutHelper in Java. 25 // ShortcutHelper in Java.
26 class ShortcutHelper { 26 class ShortcutHelper {
27 public: 27 public:
28 using WebApkInfoCallback = 28 using WebApkInfoCallback =
29 base::Callback<void(const std::vector<WebApkInfo>&)>; 29 base::Callback<void(const std::vector<WebApkInfo>&)>;
30 30
31 // Registers JNI hooks. 31 // Registers JNI hooks.
32 static bool RegisterShortcutHelper(JNIEnv* env); 32 static bool RegisterShortcutHelper(JNIEnv* env);
33 33
34 // Adds a shortcut to the launcher using a SkBitmap. The type of shortcut 34 // Adds a shortcut to the launcher using a SkBitmap. The type of shortcut
35 // added depends on the properties in |info|. Calls one of 35 // added depends on the properties in |info|. Calls one of
36 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap, 36 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap,
37 // or AddShortcutInBackgroundWithSkBitmap. 37 // or AddShortcutInBackgroundWithSkBitmap.
38 static void AddToLauncherWithSkBitmap(content::WebContents* web_contents, 38 static void AddToLauncherWithSkBitmap(content::WebContents* web_contents,
39 const ShortcutInfo& info, 39 const ShortcutInfo& info,
40 const SkBitmap& icon_bitmap); 40 const SkBitmap& icon_bitmap);
41 41
42 // Installs WebAPK and adds shortcut to the launcher. 42 // Installs WebAPK and adds shortcut to the launcher.
43 static void InstallWebApkWithSkBitmap( 43 static void InstallWebApkWithSkBitmap(
44 content::WebContents* web_conetnts, 44 content::WebContents* web_conetnts,
45 const ShortcutInfo& info, 45 const ShortcutInfo& info,
46 const SkBitmap& icon_bitmap, 46 const SkBitmap& icon_bitmap,
47 const WebApkInstaller::FinishCallback& callback); 47 const WebApkInstallService::FinishCallback& callback);
48 48
49 // Shows toast notifying user that a WebAPK install is already in progress 49 // 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. 50 // when user tries to queue a new install for the same WebAPK.
51 static void ShowWebApkInstallInProgressToast(); 51 static void ShowWebApkInstallInProgressToast();
52 52
53 // Returns the ideal size for an icon representing a web app or a WebAPK. 53 // Returns the ideal size for an icon representing a web app or a WebAPK.
54 static int GetIdealHomescreenIconSizeInPx(); 54 static int GetIdealHomescreenIconSizeInPx();
55 55
56 // Returns the minimum size for an icon representing a web app or a WebAPK. 56 // Returns the minimum size for an icon representing a web app or a WebAPK.
57 static int GetMinimumHomescreenIconSizeInPx(); 57 static int GetMinimumHomescreenIconSizeInPx();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // Fetches information on all the WebAPKs installed on the device and returns 107 // Fetches information on all the WebAPKs installed on the device and returns
108 // the info to the |callback|. 108 // the info to the |callback|.
109 static void RetrieveWebApks(const WebApkInfoCallback& callback); 109 static void RetrieveWebApks(const WebApkInfoCallback& callback);
110 110
111 private: 111 private:
112 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper); 112 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper);
113 }; 113 };
114 114
115 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 115 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698