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

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

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Add a chrome://webapks page. Created 3 years, 10 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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/android/shortcut_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
9 #include <vector>
10
8 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
9 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
10 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
11 #include "base/macros.h" 14 #include "base/macros.h"
12 #include "chrome/browser/android/shortcut_info.h" 15 #include "chrome/browser/android/shortcut_info.h"
16 #include "chrome/browser/android/webapk/webapk_info.h"
13 #include "chrome/browser/android/webapk/webapk_installer.h" 17 #include "chrome/browser/android/webapk/webapk_installer.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 18 #include "third_party/skia/include/core/SkBitmap.h"
15 19
16 namespace content { 20 namespace content {
17 class BrowserContext; 21 class BrowserContext;
18 class WebContents; 22 class WebContents;
19 } // namespace content 23 } // namespace content
20 24
21 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's 25 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's
22 // ShortcutHelper in Java. 26 // ShortcutHelper in Java.
23 class ShortcutHelper { 27 class ShortcutHelper {
24 public: 28 public:
29 using WebApkInfoCallback =
30 base::Callback<void(const std::vector<WebApkInfo>&)>;
31
25 // Registers JNI hooks. 32 // Registers JNI hooks.
26 static bool RegisterShortcutHelper(JNIEnv* env); 33 static bool RegisterShortcutHelper(JNIEnv* env);
27 34
28 // 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
29 // added depends on the properties in |info|. Calls one of 36 // added depends on the properties in |info|. Calls one of
30 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap, 37 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap,
31 // or AddShortcutInBackgroundWithSkBitmap. 38 // or AddShortcutInBackgroundWithSkBitmap.
32 static void AddToLauncherWithSkBitmap( 39 static void AddToLauncherWithSkBitmap(
33 content::BrowserContext* browser_context, 40 content::BrowserContext* browser_context,
34 const ShortcutInfo& info, 41 const ShortcutInfo& info,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Returns true if WebAPKs are enabled and there is an installed WebAPK which 117 // Returns true if WebAPKs are enabled and there is an installed WebAPK which
111 // can handle |start_url|, or there is one is being installed. 118 // can handle |start_url|, or there is one is being installed.
112 static bool IsWebApkInstalled(content::BrowserContext* browser_context, 119 static bool IsWebApkInstalled(content::BrowserContext* browser_context,
113 const GURL& start_url, 120 const GURL& start_url,
114 const GURL& manifest_url); 121 const GURL& manifest_url);
115 122
116 // Generates a scope URL based on the passed in |url|. It should be used 123 // Generates a scope URL based on the passed in |url|. It should be used
117 // when the Web Manifest does not specify a scope URL. 124 // when the Web Manifest does not specify a scope URL.
118 static GURL GetScopeFromURL(const GURL& url); 125 static GURL GetScopeFromURL(const GURL& url);
119 126
127 // Fetches information on all the WebAPKs installed on the device and returns
128 // the info to the |callback|.
129 static void RetrieveWebApks(const WebApkInfoCallback& callback);
130
120 private: 131 private:
121 ShortcutHelper() = delete; 132 ShortcutHelper() = delete;
122 ~ShortcutHelper() = delete; 133 ~ShortcutHelper() = delete;
123 134
124 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); 135 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper);
125 }; 136 };
126 137
127 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 138 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/android/shortcut_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698