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

Unified Diff: chrome/browser/web_resource/promo_resource_service.cc

Issue 7820003: Add support to download web store promo logos over https. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix sync failures Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/web_resource/promo_resource_service.cc
diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc
index 09b0aee48784886e7b45ad9a3182c98a054dc5d2..1336fd092b0952fd04c0dd3a6eb2e6168c3e8328 100644
--- a/chrome/browser/web_resource/promo_resource_service.cc
+++ b/chrome/browser/web_resource/promo_resource_service.cc
@@ -316,13 +316,9 @@ void PromoResourceService::UnpackWebStoreSignal(
bool is_webstore_active = false;
bool signal_found = false;
- std::string promo_id = "";
- std::string promo_header = "";
- std::string promo_button = "";
+ AppsPromo::PromoData promo_data;
std::string promo_link = "";
- std::string promo_expire = "";
std::string promo_logo = "";
- int maximize_setting = 0;
int target_builds = 0;
if (!parsed_json.GetDictionary("topic", &topic_dict) ||
@@ -362,24 +358,26 @@ void PromoResourceService::UnpackWebStoreSignal(
name = name.substr(split+1);
split = name.find(':');
if (split == std::string::npos ||
- !base::StringToInt(name.substr(0, split), &maximize_setting))
+ !base::StringToInt(name.substr(0, split), &promo_data.user_group))
continue;
// (4) optional text that specifies a URL of a logo image
promo_logo = name.substr(split+1);
- if (!a_dic->GetString(kAnswerIdProperty, &promo_id) ||
- !a_dic->GetString(kWebStoreHeaderProperty, &promo_header) ||
- !a_dic->GetString(kWebStoreButtonProperty, &promo_button) ||
+ if (!a_dic->GetString(kAnswerIdProperty, &promo_data.id) ||
+ !a_dic->GetString(kWebStoreHeaderProperty, &promo_data.header) ||
+ !a_dic->GetString(kWebStoreButtonProperty, &promo_data.button) ||
!a_dic->GetString(kWebStoreLinkProperty, &promo_link) ||
- !a_dic->GetString(kWebStoreExpireProperty, &promo_expire))
+ !a_dic->GetString(kWebStoreExpireProperty, &promo_data.expire))
continue;
if (IsThisBuildTargeted(target_builds)) {
- // Store the first web store promo that targets the current build.
- AppsPromo::SetPromo(promo_id, promo_header, promo_button,
- GURL(promo_link), promo_expire, GURL(promo_logo),
- maximize_setting);
+ // The downloader will set the promo prefs and send the
+ // NOTIFICATION_WEB_STORE_PROMO_LOADED notification.
+ promo_data.link = GURL(promo_link);
+ promo_data.logo = GURL(promo_logo);
+ apps_promo_logo_fetcher_.reset(
+ new AppsPromoLogoFetcher(profile_, promo_data));
signal_found = true;
break;
}
@@ -392,11 +390,6 @@ void PromoResourceService::UnpackWebStoreSignal(
AppsPromo::SetWebStoreSupportedForLocale(is_webstore_active);
- NotificationService::current()->Notify(
- chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED,
- Source<Profile>(profile_),
- NotificationService::NoDetails());
-
return;
}
« no previous file with comments | « chrome/browser/web_resource/promo_resource_service.h ('k') | chrome/browser/web_resource/promo_resource_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698