| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 ExtensionIdSet old_default_app_ids_; | 139 ExtensionIdSet old_default_app_ids_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(AppsPromo); | 141 DISALLOW_COPY_AND_ASSIGN(AppsPromo); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 // Fetches logos over HTTPS, making sure we don't send cookies and that we | 144 // Fetches logos over HTTPS, making sure we don't send cookies and that we |
| 145 // cache the image until its source URL changes. | 145 // cache the image until its source URL changes. |
| 146 class AppsPromoLogoFetcher : public content::URLFetcherDelegate { | 146 class AppsPromoLogoFetcher : public content::URLFetcherDelegate { |
| 147 public: | 147 public: |
| 148 AppsPromoLogoFetcher(Profile* profile, | 148 AppsPromoLogoFetcher(Profile* profile, |
| 149 AppsPromo::PromoData promo_data); | 149 const AppsPromo::PromoData& promo_data); |
| 150 virtual ~AppsPromoLogoFetcher(); | 150 virtual ~AppsPromoLogoFetcher(); |
| 151 | 151 |
| 152 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; | 152 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 // Fetches the logo and stores the result as a data URL. | 155 // Fetches the logo and stores the result as a data URL. |
| 156 void FetchLogo(); | 156 void FetchLogo(); |
| 157 | 157 |
| 158 // Checks if the logo was downloaded previously. | 158 // Checks if the logo was downloaded previously. |
| 159 bool HaveCachedLogo(); | 159 bool HaveCachedLogo(); |
| 160 | 160 |
| 161 // Sets the apps promo based on the current data and then issues the | 161 // Sets the apps promo based on the current data and then issues the |
| 162 // WEB_STORE_PROMO_LOADED notification so open NTPs can inject the promo. | 162 // WEB_STORE_PROMO_LOADED notification so open NTPs can inject the promo. |
| 163 void SavePromo(); | 163 void SavePromo(); |
| 164 | 164 |
| 165 // Checks if the promo logo matches https://*.google.com/*.png. | 165 // Checks if the promo logo matches https://*.google.com/*.png. |
| 166 bool SupportsLogoURL(); | 166 bool SupportsLogoURL(); |
| 167 | 167 |
| 168 Profile* profile_; | 168 Profile* profile_; |
| 169 AppsPromo::PromoData promo_data_; | 169 AppsPromo::PromoData promo_data_; |
| 170 scoped_ptr<content::URLFetcher> url_fetcher_; | 170 scoped_ptr<content::URLFetcher> url_fetcher_; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ | 173 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ |
| OLD | NEW |