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

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

Issue 2724723002: [WebAPKs]: Reduce the parameters of ShortcutHelper::AddToLauncherWithSkBitmap() (Closed)
Patch Set: Merge branch 'master' into refactor_shortcut_helper2 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_installer.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 BrowserContext;
22 class WebContents; 21 class WebContents;
23 } // namespace content 22 }
24 23
25 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's 24 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's
26 // ShortcutHelper in Java. 25 // ShortcutHelper in Java.
27 class ShortcutHelper { 26 class ShortcutHelper {
28 public: 27 public:
29 using WebApkInfoCallback = 28 using WebApkInfoCallback =
30 base::Callback<void(const std::vector<WebApkInfo>&)>; 29 base::Callback<void(const std::vector<WebApkInfo>&)>;
31 30
32 // Registers JNI hooks. 31 // Registers JNI hooks.
33 static bool RegisterShortcutHelper(JNIEnv* env); 32 static bool RegisterShortcutHelper(JNIEnv* env);
34 33
35 // 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
36 // added depends on the properties in |info|. Calls one of 35 // added depends on the properties in |info|. Calls one of
37 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap, 36 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap,
38 // or AddShortcutInBackgroundWithSkBitmap. 37 // or AddShortcutInBackgroundWithSkBitmap.
39 static void AddToLauncherWithSkBitmap( 38 static void AddToLauncherWithSkBitmap(content::WebContents* web_contents,
40 content::BrowserContext* browser_context, 39 const ShortcutInfo& info,
41 const ShortcutInfo& info, 40 const SkBitmap& icon_bitmap);
42 const std::string& webapp_id,
43 const SkBitmap& icon_bitmap,
44 const base::Closure& splash_image_callback);
45 41
46 // Installs WebAPK and adds shortcut to the launcher. 42 // Installs WebAPK and adds shortcut to the launcher.
47 static void InstallWebApkWithSkBitmap( 43 static void InstallWebApkWithSkBitmap(
48 content::BrowserContext* browser_context, 44 content::WebContents* web_conetnts,
49 const ShortcutInfo& info, 45 const ShortcutInfo& info,
50 const SkBitmap& icon_bitmap, 46 const SkBitmap& icon_bitmap,
51 const WebApkInstaller::FinishCallback& callback); 47 const WebApkInstaller::FinishCallback& callback);
52 48
53 // 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
54 // 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.
55 static void ShowWebApkInstallInProgressToast(); 51 static void ShowWebApkInstallInProgressToast();
56 52
57 // 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.
58 static int GetIdealHomescreenIconSizeInPx(); 54 static int GetIdealHomescreenIconSizeInPx();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 106
111 // 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
112 // the info to the |callback|. 108 // the info to the |callback|.
113 static void RetrieveWebApks(const WebApkInfoCallback& callback); 109 static void RetrieveWebApks(const WebApkInfoCallback& callback);
114 110
115 private: 111 private:
116 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper); 112 DISALLOW_IMPLICIT_CONSTRUCTORS(ShortcutHelper);
117 }; 113 };
118 114
119 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 115 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_manager_android.cc ('k') | chrome/browser/android/shortcut_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698