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

Side by Side Diff: chrome/browser/android/webapps/add_to_homescreen_manager.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_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_
6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_
7 7
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/android/webapk/chrome_webapk_host.h"
11 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" 13 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h"
12 14
13 namespace content { 15 namespace content {
14 class WebContents; 16 class WebContents;
15 } 17 }
16 18
17 class GURL; 19 class GURL;
18 class SkBitmap; 20 class SkBitmap;
19 struct ShortcutInfo; 21 struct ShortcutInfo;
20 22
(...skipping 15 matching lines...) Expand all
36 void AddShortcut(JNIEnv* env, 38 void AddShortcut(JNIEnv* env,
37 const base::android::JavaParamRef<jobject>& obj, 39 const base::android::JavaParamRef<jobject>& obj,
38 const base::android::JavaParamRef<jstring>& title); 40 const base::android::JavaParamRef<jstring>& title);
39 41
40 // Starts the add-to-homescreen process. 42 // Starts the add-to-homescreen process.
41 void Start(content::WebContents* web_contents); 43 void Start(content::WebContents* web_contents);
42 44
43 private: 45 private:
44 ~AddToHomescreenManager() override; 46 ~AddToHomescreenManager() override;
45 47
48 // Called by |Start()| which may check whether the WebAPK Install API is
49 // availabel asynchrously.
50 void StartImpl(content::WebContents* web_contents,
51 bool check_webapk_compatible,
52 bool can_use_webapk_install_flow);
53
54 // Checks whether the Google Play Install API is available when the Google
55 // Play install is allowed.
56 void CanUseGooglePlayInstallApi(
57 const ChromeWebApkHost::CanUseGooglePlayInstallApiCallback& callback);
58
59 // Called when the check of whether the Google Play Install API is available
60 // is done.
61 void OnCanUseGooglePlayInstallApi(content::WebContents* web_contents,
62 bool check_webapk_compatible,
63 bool isAvailable);
64
46 // Shows alert to prompt user for name of home screen shortcut. 65 // Shows alert to prompt user for name of home screen shortcut.
47 void ShowDialog(); 66 void ShowDialog();
48 67
49 // Called only when the AddToHomescreenDataFetcher has retrieved all of the 68 // Called only when the AddToHomescreenDataFetcher has retrieved all of the
50 // data needed to add the shortcut. 69 // data needed to add the shortcut.
51 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon); 70 void AddShortcut(const ShortcutInfo& info, const SkBitmap& icon);
52 71
53 // Called only when the AddToHomescreenDataFetcher has retrieved all of the 72 // Called only when the AddToHomescreenDataFetcher has retrieved all of the
54 // data needed to install a WebAPK. 73 // data needed to install a WebAPK.
55 void CreateInfoBarForWebApk(const ShortcutInfo& info, const SkBitmap& icon); 74 void CreateInfoBarForWebApk(const ShortcutInfo& info, const SkBitmap& icon);
(...skipping 16 matching lines...) Expand all
72 // Whether the user has requested that a shortcut be added while a fetch was 91 // Whether the user has requested that a shortcut be added while a fetch was
73 // in progress. 92 // in progress.
74 bool add_shortcut_pending_; 93 bool add_shortcut_pending_;
75 94
76 // Whether the site is WebAPK-compatible. 95 // Whether the site is WebAPK-compatible.
77 bool is_webapk_compatible_; 96 bool is_webapk_compatible_;
78 97
79 // Fetches data required to add a shortcut. 98 // Fetches data required to add a shortcut.
80 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_; 99 scoped_refptr<AddToHomescreenDataFetcher> data_fetcher_;
81 100
101 base::WeakPtrFactory<AddToHomescreenManager> weak_ptr_factory_;
102
82 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager); 103 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenManager);
83 }; 104 };
84 105
85 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_ 106 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698