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