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_DATA_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ |
6 #define CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ | 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Shows a banner for the app, if the given |icon| is valid. | 131 // Shows a banner for the app, if the given |icon| is valid. |
132 virtual void ShowBanner(const SkBitmap* icon); | 132 virtual void ShowBanner(const SkBitmap* icon); |
133 | 133 |
134 // Record that the banner could be shown at this point, if the triggering | 134 // Record that the banner could be shown at this point, if the triggering |
135 // heuristic allowed. | 135 // heuristic allowed. |
136 void RecordCouldShowBanner(); | 136 void RecordCouldShowBanner(); |
137 | 137 |
138 // Returns whether the banner should be shown. | 138 // Returns whether the banner should be shown. |
139 bool CheckIfShouldShowBanner(); | 139 bool CheckIfShouldShowBanner(); |
140 | 140 |
| 141 // Returns whether the fetcher is active and web contents have not been |
| 142 // closed. |
| 143 bool CheckFetcherIsStillAlive(content::WebContents* web_contents); |
| 144 |
141 // Returns whether the given Manifest is following the requirements to show | 145 // Returns whether the given Manifest is following the requirements to show |
142 // a web app banner. | 146 // a web app banner. |
143 static bool IsManifestValidForWebApp(const content::Manifest& manifest); | 147 static bool IsManifestValidForWebApp(const content::Manifest& manifest, |
| 148 content::WebContents* web_contents); |
144 | 149 |
145 const int ideal_icon_size_; | 150 const int ideal_icon_size_; |
146 const base::WeakPtr<Delegate> weak_delegate_; | 151 const base::WeakPtr<Delegate> weak_delegate_; |
147 ObserverList<Observer> observer_list_; | 152 ObserverList<Observer> observer_list_; |
148 bool is_active_; | 153 bool is_active_; |
149 int event_request_id_; | 154 int event_request_id_; |
150 scoped_ptr<chrome::BitmapFetcher> bitmap_fetcher_; | 155 scoped_ptr<chrome::BitmapFetcher> bitmap_fetcher_; |
151 scoped_ptr<SkBitmap> app_icon_; | 156 scoped_ptr<SkBitmap> app_icon_; |
152 | 157 |
153 GURL validated_url_; | 158 GURL validated_url_; |
154 base::string16 app_title_; | 159 base::string16 app_title_; |
155 content::Manifest web_app_data_; | 160 content::Manifest web_app_data_; |
156 | 161 |
157 friend class AppBannerDataFetcherUnitTest; | 162 friend class AppBannerDataFetcherUnitTest; |
158 friend class base::RefCounted<AppBannerDataFetcher>; | 163 friend class base::RefCounted<AppBannerDataFetcher>; |
159 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher); | 164 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcher); |
160 }; | 165 }; |
161 | 166 |
162 } // namespace banners | 167 } // namespace banners |
163 | 168 |
164 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ | 169 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ |
OLD | NEW |