| 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/web_resource/promo_resource_service.h" | 5 #include "chrome/browser/web_resource/promo_resource_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 int max_group = GetNextQuestionValue(question, &index, &err); | 289 int max_group = GetNextQuestionValue(question, &index, &err); |
| 290 | 290 |
| 291 if (err || | 291 if (err || |
| 292 promo_build < 0 || | 292 promo_build < 0 || |
| 293 promo_build > ALL_BUILDS || | 293 promo_build > ALL_BUILDS || |
| 294 time_slice < 0 || | 294 time_slice < 0 || |
| 295 time_slice > kMaxTimeSliceHours || | 295 time_slice > kMaxTimeSliceHours || |
| 296 max_group < 0 || | 296 max_group < 0 || |
| 297 max_group >= kNTPPromoGroupSize) { | 297 max_group >= kNTPPromoGroupSize) { |
| 298 // If values are not valid, do not show promo. | 298 // If values are not valid, do not show promo. |
| 299 NOTREACHED() << "Invalid server data, question=" << question << | 299 LOG(ERROR) << "Invalid server data, question=" << question << |
| 300 ", err=" << err << |
| 300 ", build=" << promo_build << | 301 ", build=" << promo_build << |
| 301 ", time_slice=" << time_slice << | 302 ", time_slice=" << time_slice << |
| 302 ", max_group=" << max_group; | 303 ", max_group=" << max_group; |
| 303 promo_build = NO_BUILD; | 304 promo_build = NO_BUILD; |
| 304 time_slice = 0; | 305 time_slice = 0; |
| 305 max_group = 0; | 306 max_group = 0; |
| 306 } | 307 } |
| 307 | 308 |
| 308 prefs_->SetInteger(prefs::kNTPPromoBuild, promo_build); | 309 prefs_->SetInteger(prefs::kNTPPromoBuild, promo_build); |
| 309 prefs_->SetInteger(prefs::kNTPPromoGroupTimeSlice, time_slice); | 310 prefs_->SetInteger(prefs::kNTPPromoGroupTimeSlice, time_slice); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 if (!(old_logo_start == logo_start) || | 578 if (!(old_logo_start == logo_start) || |
| 578 !(old_logo_end == logo_end)) { | 579 !(old_logo_end == logo_end)) { |
| 579 prefs_->SetDouble(prefs::kNTPCustomLogoStart, logo_start); | 580 prefs_->SetDouble(prefs::kNTPCustomLogoStart, logo_start); |
| 580 prefs_->SetDouble(prefs::kNTPCustomLogoEnd, logo_end); | 581 prefs_->SetDouble(prefs::kNTPCustomLogoEnd, logo_end); |
| 581 NotificationService* service = NotificationService::current(); | 582 NotificationService* service = NotificationService::current(); |
| 582 service->Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, | 583 service->Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
| 583 Source<WebResourceService>(this), | 584 Source<WebResourceService>(this), |
| 584 NotificationService::NoDetails()); | 585 NotificationService::NoDetails()); |
| 585 } | 586 } |
| 586 } | 587 } |
| OLD | NEW |