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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); | 37 static bool URLsAreForTheSamePage(const GURL& first, const GURL& second); |
38 | 38 |
39 explicit AppBannerManager(int icon_size); | 39 explicit AppBannerManager(int icon_size); |
40 ~AppBannerManager() override; | 40 ~AppBannerManager() override; |
41 | 41 |
42 // WebContentsObserver overrides. | 42 // WebContentsObserver overrides. |
43 void DidFinishLoad(content::RenderFrameHost* render_frame_host, | 43 void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
44 const GURL& validated_url) override; | 44 const GURL& validated_url) override; |
45 | 45 |
46 protected: | 46 protected: |
| 47 AppBannerManager(content::WebContents* web_contents, int icon_size); |
| 48 |
47 void ReplaceWebContents(content::WebContents* web_contents); | 49 void ReplaceWebContents(content::WebContents* web_contents); |
48 | 50 |
49 // Creates an AppBannerDataFetcher, which constructs an app banner. | 51 // Creates an AppBannerDataFetcher, which constructs an app banner. |
50 virtual AppBannerDataFetcher* CreateAppBannerDataFetcher( | 52 virtual AppBannerDataFetcher* CreateAppBannerDataFetcher( |
51 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate, | 53 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate, |
52 const int ideal_icon_size); | 54 const int ideal_icon_size) = 0; |
53 | 55 |
54 // Return whether the AppBannerDataFetcher is active. | 56 // Return whether the AppBannerDataFetcher is active. |
55 bool IsFetcherActive(); | 57 bool IsFetcherActive(); |
56 | 58 |
57 scoped_refptr<AppBannerDataFetcher> data_fetcher() { return data_fetcher_; } | 59 scoped_refptr<AppBannerDataFetcher> data_fetcher() { return data_fetcher_; } |
58 int ideal_icon_size() { return ideal_icon_size_; } | 60 int ideal_icon_size() { return ideal_icon_size_; } |
59 | 61 |
60 private: | 62 private: |
61 // AppBannerDataFetcher::Delegate overrides. | 63 // AppBannerDataFetcher::Delegate overrides. |
62 bool HandleNonWebApp(const std::string& platform, | 64 bool HandleNonWebApp(const std::string& platform, |
(...skipping 20 matching lines...) Expand all Loading... |
83 // longer than the lifetime of this banner manager. The banner manager | 85 // longer than the lifetime of this banner manager. The banner manager |
84 // might be gone when calls sent to the ServiceWorkerContext are completed. | 86 // might be gone when calls sent to the ServiceWorkerContext are completed. |
85 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 87 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
86 | 88 |
87 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 89 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
88 }; // class AppBannerManager | 90 }; // class AppBannerManager |
89 | 91 |
90 } // namespace banners | 92 } // namespace banners |
91 | 93 |
92 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ | 94 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ |
OLD | NEW |