Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: chrome/browser/extensions/apps_promo.h

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "content/common/net/url_fetcher.h" 14 #include "content/public/common/url_fetcher_delegate.h"
15 15
16 class PrefService; 16 class PrefService;
17 class Profile; 17 class Profile;
18 18
19 // This encapsulates business logic for: 19 // This encapsulates business logic for:
20 // - Whether to show the apps promo in the launcher 20 // - Whether to show the apps promo in the launcher
21 // - Whether to expire existing default apps 21 // - Whether to expire existing default apps
22 class AppsPromo { 22 class AppsPromo {
23 public: 23 public:
24 // Groups users by whether they have seen a web store promo before. This is 24 // Groups users by whether they have seen a web store promo before. This is
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 // The set of default extensions. Initialized to a static list in the 142 // The set of default extensions. Initialized to a static list in the
143 // constructor. 143 // constructor.
144 ExtensionIdSet old_default_app_ids_; 144 ExtensionIdSet old_default_app_ids_;
145 145
146 DISALLOW_COPY_AND_ASSIGN(AppsPromo); 146 DISALLOW_COPY_AND_ASSIGN(AppsPromo);
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 URLFetcher::Delegate { 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 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<URLFetcher> url_fetcher_;
176 }; 176 };
177 177
178 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ 178 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698