| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 public AppBannerDataFetcher::Delegate { | 32 public AppBannerDataFetcher::Delegate { |
| 33 public: | 33 public: |
| 34 static void DisableSecureSchemeCheckForTesting(); | 34 static void DisableSecureSchemeCheckForTesting(); |
| 35 | 35 |
| 36 static void SetEngagementWeights(double direct_engagement, | 36 static void SetEngagementWeights(double direct_engagement, |
| 37 double indirect_engagement); | 37 double indirect_engagement); |
| 38 | 38 |
| 39 // Returns whether or not the URLs match for everything except for the ref. | 39 // Returns whether or not the URLs match for everything except for the ref. |
| 40 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); | 40 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); |
| 41 | 41 |
| 42 void TriggerAppBannerFetch(content::RenderFrameHost* render_frame_host, |
| 43 const GURL& validated_url, |
| 44 bool is_debug_mode); |
| 45 |
| 42 AppBannerManager(); | 46 AppBannerManager(); |
| 43 ~AppBannerManager() override; | 47 ~AppBannerManager() override; |
| 44 | 48 |
| 45 protected: | 49 protected: |
| 46 explicit AppBannerManager(content::WebContents* web_contents); | 50 explicit AppBannerManager(content::WebContents* web_contents); |
| 47 | 51 |
| 48 void ReplaceWebContents(content::WebContents* web_contents); | 52 void ReplaceWebContents(content::WebContents* web_contents); |
| 49 | 53 |
| 50 // Creates an AppBannerDataFetcher, which constructs an app banner. | 54 // Creates an AppBannerDataFetcher, which constructs an app banner. |
| 51 virtual AppBannerDataFetcher* CreateAppBannerDataFetcher( | 55 virtual AppBannerDataFetcher* CreateAppBannerDataFetcher( |
| 52 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate) = 0; | 56 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate, |
| 57 bool is_debug_mode) = 0; |
| 53 | 58 |
| 54 // Return whether the AppBannerDataFetcher is active. | 59 // Return whether the AppBannerDataFetcher is active. |
| 55 bool IsFetcherActive(); | 60 bool IsFetcherActive(); |
| 56 | 61 |
| 57 scoped_refptr<AppBannerDataFetcher> data_fetcher() { return data_fetcher_; } | 62 scoped_refptr<AppBannerDataFetcher> data_fetcher() { return data_fetcher_; } |
| 58 | 63 |
| 59 private: | 64 private: |
| 60 // WebContentsObserver overrides. | 65 // WebContentsObserver overrides. |
| 61 void DidNavigateMainFrame( | 66 void DidNavigateMainFrame( |
| 62 const content::LoadCommittedDetails& details, | 67 const content::LoadCommittedDetails& details, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 83 // longer than the lifetime of this banner manager. The banner manager | 88 // longer than the lifetime of this banner manager. The banner manager |
| 84 // might be gone when calls sent to the ServiceWorkerContext are completed. | 89 // might be gone when calls sent to the ServiceWorkerContext are completed. |
| 85 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 90 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
| 86 | 91 |
| 87 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 92 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
| 88 }; // class AppBannerManager | 93 }; // class AppBannerManager |
| 89 | 94 |
| 90 } // namespace banners | 95 } // namespace banners |
| 91 | 96 |
| 92 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 97 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
| OLD | NEW |