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

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

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 8 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/common/url_fetcher_delegate.h" 14 #include "net/url_request/url_fetcher_delegate.h"
15 15
16 class PrefService; 16 class PrefService;
17 class Profile; 17 class Profile;
18 18
19 namespace net {
20 class URLFetcher;
21 } // namespace net
22
19 // This encapsulates business logic for: 23 // This encapsulates business logic for:
20 // - Whether to show the apps promo in the launcher 24 // - Whether to show the apps promo in the launcher
21 // - Whether to expire existing default apps 25 // - Whether to expire existing default apps
22 class AppsPromo { 26 class AppsPromo {
23 public: 27 public:
24 // Groups users by whether they have seen a web store promo before. This is 28 // Groups users by whether they have seen a web store promo before. This is
25 // used for deciding to maximize the promo and apps section on the NTP. 29 // used for deciding to maximize the promo and apps section on the NTP.
26 enum UserGroup { 30 enum UserGroup {
27 // Matches no users. 31 // Matches no users.
28 USERS_NONE = 0, 32 USERS_NONE = 0,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 140
137 // The set of default extensions. Initialized to a static list in the 141 // The set of default extensions. Initialized to a static list in the
138 // constructor. 142 // constructor.
139 extensions::ExtensionIdSet old_default_app_ids_; 143 extensions::ExtensionIdSet old_default_app_ids_;
140 144
141 DISALLOW_COPY_AND_ASSIGN(AppsPromo); 145 DISALLOW_COPY_AND_ASSIGN(AppsPromo);
142 }; 146 };
143 147
144 // Fetches logos over HTTPS, making sure we don't send cookies and that we 148 // Fetches logos over HTTPS, making sure we don't send cookies and that we
145 // cache the image until its source URL changes. 149 // cache the image until its source URL changes.
146 class AppsPromoLogoFetcher : public content::URLFetcherDelegate { 150 class AppsPromoLogoFetcher : public net::URLFetcherDelegate {
147 public: 151 public:
148 AppsPromoLogoFetcher(Profile* profile, 152 AppsPromoLogoFetcher(Profile* profile,
149 const AppsPromo::PromoData& promo_data); 153 const AppsPromo::PromoData& promo_data);
150 virtual ~AppsPromoLogoFetcher(); 154 virtual ~AppsPromoLogoFetcher();
151 155
152 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 156 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
153 157
154 private: 158 private:
155 // Fetches the logo and stores the result as a data URL. 159 // Fetches the logo and stores the result as a data URL.
156 void FetchLogo(); 160 void FetchLogo();
157 161
158 // Checks if the logo was downloaded previously. 162 // Checks if the logo was downloaded previously.
159 bool HaveCachedLogo(); 163 bool HaveCachedLogo();
160 164
161 // Sets the apps promo based on the current data and then issues the 165 // 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. 166 // WEB_STORE_PROMO_LOADED notification so open NTPs can inject the promo.
163 void SavePromo(); 167 void SavePromo();
164 168
165 // Checks if the promo logo matches https://*.google.com/*.png. 169 // Checks if the promo logo matches https://*.google.com/*.png.
166 bool SupportsLogoURL(); 170 bool SupportsLogoURL();
167 171
168 Profile* profile_; 172 Profile* profile_;
169 AppsPromo::PromoData promo_data_; 173 AppsPromo::PromoData promo_data_;
170 scoped_ptr<content::URLFetcher> url_fetcher_; 174 scoped_ptr<net::URLFetcher> url_fetcher_;
171 }; 175 };
172 176
173 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_ 177 #endif // CHROME_BROWSER_EXTENSIONS_APPS_PROMO_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_notify_channel_setup.h ('k') | chrome/browser/extensions/updater/extension_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698