OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSIONS_APPS_PROMO_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 }; | 147 }; |
148 | 148 |
149 // Fetches logos over HTTPS, making sure we don't send cookies and that we | 149 // Fetches logos over HTTPS, making sure we don't send cookies and that we |
150 // cache the image until its source URL changes. | 150 // cache the image until its source URL changes. |
151 class AppsPromoLogoFetcher : public content::URLFetcherDelegate { | 151 class AppsPromoLogoFetcher : public content::URLFetcherDelegate { |
152 public: | 152 public: |
153 AppsPromoLogoFetcher(Profile* profile, | 153 AppsPromoLogoFetcher(Profile* profile, |
154 AppsPromo::PromoData promo_data); | 154 AppsPromo::PromoData promo_data); |
155 virtual ~AppsPromoLogoFetcher(); | 155 virtual ~AppsPromoLogoFetcher(); |
156 | 156 |
157 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 157 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
158 | 158 |
159 private: | 159 private: |
160 // Fetches the logo and stores the result as a data URL. | 160 // Fetches the logo and stores the result as a data URL. |
161 void FetchLogo(); | 161 void FetchLogo(); |
162 | 162 |
163 // Checks if the logo was downloaded previously. | 163 // Checks if the logo was downloaded previously. |
164 bool HaveCachedLogo(); | 164 bool HaveCachedLogo(); |
165 | 165 |
166 // Sets the apps promo based on the current data and then issues the | 166 // Sets the apps promo based on the current data and then issues the |
167 // WEB_STORE_PROMO_LOADED notification so open NTPs can inject the promo. | 167 // WEB_STORE_PROMO_LOADED notification so open NTPs can inject the promo. |
168 void SavePromo(); | 168 void SavePromo(); |
169 | 169 |
170 // Checks if the promo logo matches https://*.google.com/*.png. | 170 // Checks if the promo logo matches https://*.google.com/*.png. |
171 bool SupportsLogoURL(); | 171 bool SupportsLogoURL(); |
172 | 172 |
173 Profile* profile_; | 173 Profile* profile_; |
174 AppsPromo::PromoData promo_data_; | 174 AppsPromo::PromoData promo_data_; |
175 scoped_ptr<URLFetcher> url_fetcher_; | 175 scoped_ptr<content::URLFetcher> url_fetcher_; |
176 }; | 176 }; |
177 | 177 |
178 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ | 178 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ |
OLD | NEW |