| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BANNERS_APP_BANNER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // base::Bind. This allows a WeakPtrFactory to be housed in this class. | 43 // base::Bind. This allows a WeakPtrFactory to be housed in this class. |
| 44 // | 44 // |
| 45 // The InstallableManager fetches and validate a site's eligibility for banners. | 45 // The InstallableManager fetches and validate a site's eligibility for banners. |
| 46 // The manager is first called to fetch the manifest, so we can verify whether | 46 // The manager is first called to fetch the manifest, so we can verify whether |
| 47 // the site is already installed (and on Android, divert the flow to a | 47 // the site is already installed (and on Android, divert the flow to a |
| 48 // native app banner if requested). The second call completes the checking for a | 48 // native app banner if requested). The second call completes the checking for a |
| 49 // web app banner (checking manifest validity, service worker, and icon). | 49 // web app banner (checking manifest validity, service worker, and icon). |
| 50 class AppBannerManager : public content::WebContentsObserver, | 50 class AppBannerManager : public content::WebContentsObserver, |
| 51 public SiteEngagementObserver { | 51 public SiteEngagementObserver { |
| 52 public: | 52 public: |
| 53 static void DisableSecureSchemeCheckForTesting(); | |
| 54 | |
| 55 // Returns the current time. | 53 // Returns the current time. |
| 56 static base::Time GetCurrentTime(); | 54 static base::Time GetCurrentTime(); |
| 57 | 55 |
| 58 // Fast-forwards the current time for testing. | 56 // Fast-forwards the current time for testing. |
| 59 static void SetTimeDeltaForTesting(int days); | 57 static void SetTimeDeltaForTesting(int days); |
| 60 | 58 |
| 61 // Sets the weights applied to direct and indirect navigations for triggering | 59 // Sets the weights applied to direct and indirect navigations for triggering |
| 62 // the banner. Deprecated and will be removed when app banners fully migrates | 60 // the banner. Deprecated and will be removed when app banners fully migrates |
| 63 // to using site engagement as a trigger. | 61 // to using site engagement as a trigger. |
| 64 static void SetEngagementWeights(double direct_engagement, | 62 static void SetEngagementWeights(double direct_engagement, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // scoped to the WebContents which they are observing. This allows us to use | 264 // scoped to the WebContents which they are observing. This allows us to use |
| 267 // weak pointers for callbacks. | 265 // weak pointers for callbacks. |
| 268 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 266 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
| 269 | 267 |
| 270 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 268 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
| 271 }; | 269 }; |
| 272 | 270 |
| 273 } // namespace banners | 271 } // namespace banners |
| 274 | 272 |
| 275 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 273 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
| OLD | NEW |