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

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

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Removes strings from i18n file 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<WebApkInfo>)> WebApkInfoCallback;
pkotwicz 2017/01/19 19:37:17 Nit: The argument should be a const reference bas
gonzalon 2017/01/19 23:50:16 Done.
pkotwicz 2017/01/20 16:57:17 Sorry for the incorrect advice. The argument shou
gonzalon 2017/01/20 19:27:01 Done.
30
25 // Registers JNI hooks. 31 // Registers JNI hooks.
26 static bool RegisterShortcutHelper(JNIEnv* env); 32 static bool RegisterShortcutHelper(JNIEnv* env);
27 33
28 // 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
29 // added depends on the properties in |info|. Calls one of 35 // added depends on the properties in |info|. Calls one of
30 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap, 36 // InstallWebApkInBackgroundWithSkBitmap, AddWebappInBackgroundWithSkBitmap,
31 // or AddShortcutInBackgroundWithSkBitmap. 37 // or AddShortcutInBackgroundWithSkBitmap.
32 static void AddToLauncherWithSkBitmap( 38 static void AddToLauncherWithSkBitmap(
33 content::BrowserContext* browser_context, 39 content::BrowserContext* browser_context,
34 const ShortcutInfo& info, 40 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 113 // 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. 114 // can handle |start_url|, or there is one is being installed.
109 static bool IsWebApkInstalled(content::BrowserContext* browser_context, 115 static bool IsWebApkInstalled(content::BrowserContext* browser_context,
110 const GURL& start_url, 116 const GURL& start_url,
111 const GURL& manifest_url); 117 const GURL& manifest_url);
112 118
113 // Generates a scope URL based on the passed in |url|. It should be used 119 // 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. 120 // when the Web Manifest does not specify a scope URL.
115 static GURL GetScopeFromURL(const GURL& url); 121 static GURL GetScopeFromURL(const GURL& url);
116 122
123 // Fetches information on all the WebAPKs installed on the device and returns
124 // the info to the |callback|.
125 static void ListWebApks(const WebApkInfoCallback& callback);
126
117 private: 127 private:
118 ShortcutHelper() = delete; 128 ShortcutHelper() = delete;
119 ~ShortcutHelper() = delete; 129 ~ShortcutHelper() = delete;
120 130
121 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); 131 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper);
122 }; 132 };
123 133
124 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ 134 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698