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

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

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Adds an about:webapks page with information about all installed Web APKs on the device Created 3 years, 11 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>
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 typedef base::Callback<void(std::vector<const WebApkInfo>&)>
pkotwicz 2017/01/20 20:33:33 This should be: typedef base::Callback<void(const
dominickn 2017/01/23 00:48:07 Agreed: const std::vector here
gonzalon 2017/01/23 16:58:51 Done.
30 WebApkInfoCallback;
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Returns true if WebAPKs are enabled and there is an installed WebAPK which 114 // Returns true if WebAPKs are enabled and there is an installed WebAPK which
108 // can handle |start_url|, or there is one is being installed. 115 // can handle |start_url|, or there is one is being installed.
109 static bool IsWebApkInstalled(content::BrowserContext* browser_context, 116 static bool IsWebApkInstalled(content::BrowserContext* browser_context,
110 const GURL& start_url, 117 const GURL& start_url,
111 const GURL& manifest_url); 118 const GURL& manifest_url);
112 119
113 // Generates a scope URL based on the passed in |url|. It should be used 120 // Generates a scope URL based on the passed in |url|. It should be used
114 // when the Web Manifest does not specify a scope URL. 121 // when the Web Manifest does not specify a scope URL.
115 static GURL GetScopeFromURL(const GURL& url); 122 static GURL GetScopeFromURL(const GURL& url);
116 123
124 // Fetches information on all the WebAPKs installed on the device and returns
125 // the info to the |callback|.
126 static void ListWebApks(const WebApkInfoCallback& callback);
dominickn 2017/01/23 00:48:07 Call this RetrieveWebApks
gonzalon 2017/01/23 16:58:51 Done.
127
117 private: 128 private:
118 ShortcutHelper() = delete; 129 ShortcutHelper() = delete;
119 ~ShortcutHelper() = delete; 130 ~ShortcutHelper() = delete;
120 131
121 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); 132 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper);
122 }; 133 };
123 134
124 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 135 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698