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

Unified Diff: chrome/browser/chromeos/customization_document.cc

Issue 7778043: [cros] Support global carrier config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup 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/chromeos/customization_document.cc
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index bd47d4a5eaf66fb562f27edba2c27b153f119083..08ae6f2f4bd3e335f9de1e639680834805909a19 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -44,16 +44,6 @@ const char kAcceptedManifestVersion[] = "1.0";
const char kHardwareClass[] = "hardware_class";
-// Carrier deals attributes.
-const char kCarrierDealsAttr[] = "carrier_deals";
-const char kDealLocaleAttr[] = "deal_locale";
-const char kInfoURLAttr[] = "info_url";
-const char kTopUpURLAttr[] = "top_up_url";
-const char kNotificationCountAttr[] = "notification_count";
-const char kDealExpireDateAttr[] = "expire_date";
-const char kLocalizedContentAttr[] = "localized_content";
-const char kNotificationTextAttr[] = "notification_text";
-
// Path to OEM partner startup customization manifest.
const char kStartupCustomizationManifestPath[] =
"/opt/oem/etc/startup_manifest.json";
@@ -226,49 +216,12 @@ std::string StartupCustomizationDocument::GetEULAPage(
// ServicesCustomizationDocument implementation. -------------------------------
-ServicesCustomizationDocument::CarrierDeal::CarrierDeal(
- DictionaryValue* deal_dict)
- : notification_count_(0),
- localized_strings_(NULL) {
- deal_dict->GetString(kDealLocaleAttr, &deal_locale_);
- deal_dict->GetString(kInfoURLAttr, &info_url_);
- deal_dict->GetString(kTopUpURLAttr, &top_up_url_);
- deal_dict->GetInteger(kNotificationCountAttr, &notification_count_);
- std::string date_string;
- if (deal_dict->GetString(kDealExpireDateAttr, &date_string)) {
- if (!base::Time::FromString(date_string.c_str(), &expire_date_))
- LOG(ERROR) << "Error parsing deal_expire_date: " << date_string;
- }
- deal_dict->GetDictionary(kLocalizedContentAttr, &localized_strings_);
-}
-
-ServicesCustomizationDocument::CarrierDeal::~CarrierDeal() {
-}
-
-std::string ServicesCustomizationDocument::CarrierDeal::GetLocalizedString(
- const std::string& locale, const std::string& id) const {
- std::string result;
- if (localized_strings_) {
- DictionaryValue* locale_dict = NULL;
- if (localized_strings_->GetDictionary(locale, &locale_dict) &&
- locale_dict->GetString(id, &result)) {
- return result;
- } else if (localized_strings_->GetDictionary(kDefaultAttr, &locale_dict) &&
- locale_dict->GetString(id, &result)) {
- return result;
- }
- }
- return result;
-}
-
ServicesCustomizationDocument::ServicesCustomizationDocument()
- : url_(kServicesCustomizationManifestUrl),
- initial_locale_(WizardController::GetInitialLocale()) {
+ : url_(kServicesCustomizationManifestUrl) {
}
ServicesCustomizationDocument::ServicesCustomizationDocument(
- const std::string& manifest, const std::string& initial_locale)
- : initial_locale_(initial_locale) {
+ const std::string& manifest) {
LoadManifestFromString(manifest);
}
@@ -375,45 +328,4 @@ std::string ServicesCustomizationDocument::GetSupportPage(
locale, kAppContentAttr, kSupportPageAttr);
}
-const ServicesCustomizationDocument::CarrierDeal*
-ServicesCustomizationDocument::GetCarrierDeal(const std::string& carrier_id,
- bool check_restrictions) const {
- CarrierDeals::const_iterator iter = carrier_deals_.find(carrier_id);
- if (iter != carrier_deals_.end()) {
- CarrierDeal* deal = iter->second;
- if (check_restrictions) {
- // Deal locale has to match initial_locale (= launch country).
- if (initial_locale_ != deal->deal_locale())
- return NULL;
- // Make sure that deal is still active,
- // i.e. if deal expire date is defined, check it.
- if (!deal->expire_date().is_null() &&
- deal->expire_date() <= base::Time::Now()) {
- return NULL;
- }
- }
- return deal;
- } else {
- return NULL;
- }
-}
-
-bool ServicesCustomizationDocument::LoadManifestFromString(
- const std::string& manifest) {
- if (!CustomizationDocument::LoadManifestFromString(manifest))
- return false;
-
- DictionaryValue* carriers = NULL;
- if (root_.get() && root_->GetDictionary(kCarrierDealsAttr, &carriers)) {
- for (DictionaryValue::key_iterator iter = carriers->begin_keys();
- iter != carriers->end_keys(); ++iter) {
- DictionaryValue* carrier_deal = NULL;
- if (carriers->GetDictionary(*iter, &carrier_deal)) {
- carrier_deals_[*iter] = new CarrierDeal(carrier_deal);
- }
- }
- }
- return true;
-}
-
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698