| 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" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" | 13 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "content/common/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/common/url_constants.h" | 19 #include "content/public/common/url_constants.h" |
| 20 #include "net/base/load_flags.h" | 20 #include "net/base/load_flags.h" |
| 21 #include "net/url_request/url_request_status.h" | 21 #include "net/url_request/url_request_status.h" |
| 22 | 22 |
| 23 const int AppsPromo::kDefaultAppsCounterMax = 10; | 23 const int AppsPromo::kDefaultAppsCounterMax = 10; |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // The default logo for the promo. | 27 // The default logo for the promo. |
| 28 const char kDefaultLogo[] = "chrome://theme/IDR_WEBSTORE_ICON"; | 28 const char kDefaultLogo[] = "chrome://theme/IDR_WEBSTORE_ICON"; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 url_fetcher_->Start(); | 381 url_fetcher_->Start(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 bool AppsPromoLogoFetcher::HaveCachedLogo() { | 384 bool AppsPromoLogoFetcher::HaveCachedLogo() { |
| 385 return promo_data_.logo == AppsPromo::GetSourcePromoLogoURL(); | 385 return promo_data_.logo == AppsPromo::GetSourcePromoLogoURL(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void AppsPromoLogoFetcher::SavePromo() { | 388 void AppsPromoLogoFetcher::SavePromo() { |
| 389 AppsPromo::SetPromo(promo_data_); | 389 AppsPromo::SetPromo(promo_data_); |
| 390 | 390 |
| 391 NotificationService::current()->Notify( | 391 content::NotificationService::current()->Notify( |
| 392 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, | 392 chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, |
| 393 content::Source<Profile>(profile_), | 393 content::Source<Profile>(profile_), |
| 394 NotificationService::NoDetails()); | 394 content::NotificationService::NoDetails()); |
| 395 } | 395 } |
| 396 | 396 |
| 397 bool AppsPromoLogoFetcher::SupportsLogoURL() { | 397 bool AppsPromoLogoFetcher::SupportsLogoURL() { |
| 398 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); | 398 URLPattern allowed_urls(URLPattern::SCHEME_HTTPS, kValidLogoPattern); |
| 399 return allowed_urls.MatchesURL(promo_data_.logo); | 399 return allowed_urls.MatchesURL(promo_data_.logo); |
| 400 } | 400 } |
| OLD | NEW |