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

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

Issue 2129043002: Split ShortcutHelper#addShortcut() into separate functions for each type of shortcut (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl0 Created 4 years, 5 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 "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/android/shortcut_info.h" 12 #include "chrome/browser/android/shortcut_info.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
14 14
15 namespace content { 15 namespace content {
16 class WebContents; 16 class WebContents;
17 } // namespace content 17 } // namespace content
18 18
19 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's 19 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's
20 // ShortcutHelper in Java. 20 // ShortcutHelper in Java.
21 class ShortcutHelper { 21 class ShortcutHelper {
22 public: 22 public:
23 // Registers JNI hooks. 23 // Registers JNI hooks.
24 static bool RegisterShortcutHelper(JNIEnv* env); 24 static bool RegisterShortcutHelper(JNIEnv* env);
25 25
26 // Adds a shortcut to the launcher using a SkBitmap. If the shortcut is for 26 // Adds a shortcut to the launcher using a SkBitmap. The type of shortcut
27 // a standalone-capable site, |splash_image_callback| will be invoked once the 27 // added depends on the properties in |info|. Calls one of
28 // Java-side operation has completed. This is necessary as Java will 28 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap,
29 // asynchronously create and populate a WebappDataStorage object for 29 // or AddShortcutInBackgroundWithSkBitmap.
30 // standalone-capable sites. This must exist before the splash image can be
31 // stored.
32 // Must not be called on the UI thread. 30 // Must not be called on the UI thread.
33 static void AddShortcutInBackgroundWithSkBitmap( 31 static void AddToLauncherInBackgroundWithSkBitmap(
34 const ShortcutInfo& info, 32 const ShortcutInfo& info,
35 const std::string& webapp_id, 33 const std::string& webapp_id,
36 const SkBitmap& icon_bitmap, 34 const SkBitmap& icon_bitmap,
37 const base::Closure& splash_image_callback); 35 const base::Closure& splash_image_callback);
38 36
37 // Installs WebAPK and adds shortcut to the launcher.
38 // Must not be called on the UI thread.
39 static void InstallWebApkInBackgroundWithSkBitmap(
40 const ShortcutInfo& info,
41 const std::string& webapp_id,
42 const SkBitmap& icon_bitmap);
43
44 // Adds a shortcut which opens in a fullscreen window to the launcher.
45 // |splash_image_callback| will be invoked once the Java-side operation has
46 // completed. This is necessary as Java will asynchronously create and
47 // populate a WebappDataStorage object for standalone-capable sites. This must
48 // exist before the splash image can be stored.
49 // Must not be called on the UI thread.
50 static void AddWebappInBackgroundWithSkBitmap(
51 const ShortcutInfo& info,
52 const std::string& webapp_id,
53 const SkBitmap& icon_bitmap,
54 const base::Closure& splash_image_callback);
55
56 // Adds a shortcut which opens in a browser tab to the launcher.
57 // Must not be called on the UI thread.
58 static void AddShortcutInBackgroundWithSkBitmap(
59 const ShortcutInfo& info,
60 const SkBitmap& icon_bitmap);
61
39 // Returns the ideal size for an icon representing a web app. 62 // Returns the ideal size for an icon representing a web app.
40 static int GetIdealHomescreenIconSizeInDp(); 63 static int GetIdealHomescreenIconSizeInDp();
41 64
42 // Returns the minimum size for an icon representing a web app. 65 // Returns the minimum size for an icon representing a web app.
43 static int GetMinimumHomescreenIconSizeInDp(); 66 static int GetMinimumHomescreenIconSizeInDp();
44 67
45 // Returns the ideal size for an image displayed on a web app's splash 68 // Returns the ideal size for an image displayed on a web app's splash
46 // screen. 69 // screen.
47 static int GetIdealSplashImageSizeInDp(); 70 static int GetIdealSplashImageSizeInDp();
48 71
(...skipping 28 matching lines...) Expand all
77 static bool IsWebApkInstalled(const GURL& url); 100 static bool IsWebApkInstalled(const GURL& url);
78 101
79 private: 102 private:
80 ShortcutHelper() = delete; 103 ShortcutHelper() = delete;
81 ~ShortcutHelper() = delete; 104 ~ShortcutHelper() = delete;
82 105
83 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); 106 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper);
84 }; 107 };
85 108
86 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 109 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_infobar_delegate_android.cc ('k') | chrome/browser/android/shortcut_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698