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 #include "chrome/browser/extensions/apps_promo.h" | 5 #include "chrome/browser/extensions/apps_promo.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 AppsPromo::UserGroup AppsPromo::GetCurrentUserGroup() const { | 306 AppsPromo::UserGroup AppsPromo::GetCurrentUserGroup() const { |
307 const PrefService::Preference* last_promo_id | 307 const PrefService::Preference* last_promo_id |
308 = prefs_->FindPreference(prefs::kNTPWebStorePromoLastId); | 308 = prefs_->FindPreference(prefs::kNTPWebStorePromoLastId); |
309 CHECK(last_promo_id); | 309 CHECK(last_promo_id); |
310 return last_promo_id->IsDefaultValue() ? USERS_NEW : USERS_EXISTING; | 310 return last_promo_id->IsDefaultValue() ? USERS_NEW : USERS_EXISTING; |
311 } | 311 } |
312 | 312 |
313 AppsPromoLogoFetcher::AppsPromoLogoFetcher( | 313 AppsPromoLogoFetcher::AppsPromoLogoFetcher( |
314 Profile* profile, | 314 Profile* profile, |
315 AppsPromo::PromoData promo_data) | 315 const AppsPromo::PromoData& promo_data) |
316 : profile_(profile), | 316 : profile_(profile), |
317 promo_data_(promo_data) { | 317 promo_data_(promo_data) { |
318 if (SupportsLogoURL()) { | 318 if (SupportsLogoURL()) { |
319 if (HaveCachedLogo()) { | 319 if (HaveCachedLogo()) { |
320 promo_data_.logo = AppsPromo::GetPromo().logo; | 320 promo_data_.logo = AppsPromo::GetPromo().logo; |
321 SavePromo(); | 321 SavePromo(); |
322 } else { | 322 } else { |
323 FetchLogo(); | 323 FetchLogo(); |
324 } | 324 } |
325 } else { | 325 } else { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 content::NotificationService::current()->Notify( | 376 content::NotificationService::current()->Notify( |
377 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, | 377 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, |
378 content::Source<Profile>(profile_), | 378 content::Source<Profile>(profile_), |
379 content::NotificationService::NoDetails()); | 379 content::NotificationService::NoDetails()); |
380 } | 380 } |
381 | 381 |
382 bool AppsPromoLogoFetcher::SupportsLogoURL() { | 382 bool AppsPromoLogoFetcher::SupportsLogoURL() { |
383 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); | 383 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); |
384 return allowed_urls.MatchesURL(promo_data_.logo); | 384 return allowed_urls.MatchesURL(promo_data_.logo); |
385 } | 385 } |
OLD | NEW |