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/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 if (!promo_start_string.empty() && | 265 if (!promo_start_string.empty() && |
266 promo_start_string.length() > 0 && | 266 promo_start_string.length() > 0 && |
267 !promo_end_string.empty() && | 267 !promo_end_string.empty() && |
268 promo_end_string.length() > 0) { | 268 promo_end_string.length() > 0) { |
269 base::Time start_time; | 269 base::Time start_time; |
270 base::Time end_time; | 270 base::Time end_time; |
271 if (base::Time::FromString( | 271 if (base::Time::FromString( |
272 ASCIIToWide(promo_start_string).c_str(), &start_time) && | 272 promo_start_string.c_str(), &start_time) && |
273 base::Time::FromString( | 273 base::Time::FromString( |
274 ASCIIToWide(promo_end_string).c_str(), &end_time)) { | 274 promo_end_string.c_str(), &end_time)) { |
275 // Add group time slice, adjusted from hours to seconds. | 275 // Add group time slice, adjusted from hours to seconds. |
276 promo_start = start_time.ToDoubleT() + | 276 promo_start = start_time.ToDoubleT() + |
277 (prefs_->FindPreference(prefs::kNTPPromoGroup) ? | 277 (prefs_->FindPreference(prefs::kNTPPromoGroup) ? |
278 prefs_->GetInteger(prefs::kNTPPromoGroup) * | 278 prefs_->GetInteger(prefs::kNTPPromoGroup) * |
279 time_slice_hrs * 60 * 60 : 0); | 279 time_slice_hrs * 60 * 60 : 0); |
280 promo_end = end_time.ToDoubleT(); | 280 promo_end = end_time.ToDoubleT(); |
281 } | 281 } |
282 } | 282 } |
283 } | 283 } |
284 } | 284 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 } | 424 } |
425 } | 425 } |
426 } | 426 } |
427 if (!logo_start_string.empty() && | 427 if (!logo_start_string.empty() && |
428 logo_start_string.length() > 0 && | 428 logo_start_string.length() > 0 && |
429 !logo_end_string.empty() && | 429 !logo_end_string.empty() && |
430 logo_end_string.length() > 0) { | 430 logo_end_string.length() > 0) { |
431 base::Time start_time; | 431 base::Time start_time; |
432 base::Time end_time; | 432 base::Time end_time; |
433 if (base::Time::FromString( | 433 if (base::Time::FromString( |
434 ASCIIToWide(logo_start_string).c_str(), &start_time) && | 434 logo_start_string.c_str(), &start_time) && |
435 base::Time::FromString( | 435 base::Time::FromString( |
436 ASCIIToWide(logo_end_string).c_str(), &end_time)) { | 436 logo_end_string.c_str(), &end_time)) { |
wtc
2011/07/13 17:01:31
The arguments to the four base::Time::FromString c
shinyak (Google)
2011/07/13 23:28:33
Done.
| |
437 logo_start = start_time.ToDoubleT(); | 437 logo_start = start_time.ToDoubleT(); |
438 logo_end = end_time.ToDoubleT(); | 438 logo_end = end_time.ToDoubleT(); |
439 } | 439 } |
440 } | 440 } |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 // If logo start or end times have changed, trigger a new web resource | 444 // If logo start or end times have changed, trigger a new web resource |
445 // notification, so that the logo on the NTP is updated. This check is | 445 // notification, so that the logo on the NTP is updated. This check is |
446 // outside the reading of the web resource data, because the absence of | 446 // outside the reading of the web resource data, because the absence of |
(...skipping 29 matching lines...) Expand all Loading... | |
476 base::ThreadRestrictions::ScopedAllowIO allow_io; | 476 base::ThreadRestrictions::ScopedAllowIO allow_io; |
477 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 477 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
478 is_promo_build = PromoResourceService::IsBuildTargeted( | 478 is_promo_build = PromoResourceService::IsBuildTargeted( |
479 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); | 479 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); |
480 } | 480 } |
481 | 481 |
482 return !promo_closed && !is_synced && is_promo_build; | 482 return !promo_closed && !is_synced && is_promo_build; |
483 } | 483 } |
484 | 484 |
485 } // namespace PromoResourceServiceUtil | 485 } // namespace PromoResourceServiceUtil |
OLD | NEW |