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

Side by Side Diff: chrome/browser/android/webapk/chrome_webapk_host.h

Issue 2675803004: Fall back to shortcut A2HS when Phonesky is out of date or unavailable. (Closed)
Patch Set: Update add_to_homescreen_data_fetcher_unittest.cc. 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_WEBAPK_CHROME_WEBAPK_HOST_H_ 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_CHROME_WEBAPK_HOST_H_
6 #define CHROME_BROWSER_ANDROID_WEBAPK_CHROME_WEBAPK_HOST_H_ 6 #define CHROME_BROWSER_ANDROID_WEBAPK_CHROME_WEBAPK_HOST_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h"
11 #include "base/callback.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 13
14
12 // ChromeWebApkHost is the C++ counterpart of org.chromium.chrome.browser's 15 // ChromeWebApkHost is the C++ counterpart of org.chromium.chrome.browser's
13 // ChromeWebApkHost in Java. 16 // ChromeWebApkHost in Java.
14 class ChromeWebApkHost { 17 class ChromeWebApkHost {
15 public: 18 public:
19 using CanUseGooglePlayInstallApiCallback = base::Callback<void(bool)>;
20
21 ChromeWebApkHost();
22
16 // Registers JNI hooks. 23 // Registers JNI hooks.
17 static bool Register(JNIEnv* env); 24 static bool Register(JNIEnv* env);
18 25
19 // Returns whether the "enalbe-webapk" is turned on. 26 // Returns whether the "enalbe-webapk" is turned on.
20 static bool AreWebApkEnabled(); 27 static bool AreWebApkEnabled();
21 28
29 // Returns whether the Google Play Install is allowed.
30 static bool CanUseGooglePlayToInstallWebApk();
31
32 // Checks whether Google Play Install API is available.
pkotwicz 2017/02/03 18:56:32 Nit: Document that the callback can be called sync
Xi Han 2017/02/03 22:16:21 Done.
33 void CanUseGooglePlayInstallApi(
34 const CanUseGooglePlayInstallApiCallback& Callback);
35
36 // Called when the check of whether the Google Play Install API is available
37 // is done.
38 void OnCanUseGooglePlayInstallApi(
39 JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj,
41 jboolean is_available);
42
22 private: 43 private:
23 DISALLOW_IMPLICIT_CONSTRUCTORS(ChromeWebApkHost); 44 ~ChromeWebApkHost();
45
46 // Create the Java object.
47 void CreateJavaRef();
48
49 // Points to the Java Object.
50 base::android::ScopedJavaGlobalRef<jobject> java_ref_;
51
52 CanUseGooglePlayInstallApiCallback callback_;
53
54 DISALLOW_COPY_AND_ASSIGN(ChromeWebApkHost);
24 }; 55 };
25 56
26 #endif // CHROME_BROWSER_ANDROID_WEBAPK_CHROME_WEBAPK_HOST_H_ 57 #endif // CHROME_BROWSER_ANDROID_WEBAPK_CHROME_WEBAPK_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698