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

Side by Side Diff: chrome/browser/web_resource/promo_resource_service.cc

Issue 7520021: Revert 94426 - Removed wchat_t from Time::FromString. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/time_unittest.cc ('k') | chrome/common/metrics_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 a_dic->GetString("inproduct", &promo_end_string); 261 a_dic->GetString("inproduct", &promo_end_string);
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(promo_start_string.c_str(), &start_time) && 271 if (base::Time::FromString(
272 base::Time::FromString(promo_end_string.c_str(), &end_time)) { 272 ASCIIToWide(promo_start_string).c_str(), &start_time) &&
273 base::Time::FromString(
274 ASCIIToWide(promo_end_string).c_str(), &end_time)) {
273 // Add group time slice, adjusted from hours to seconds. 275 // Add group time slice, adjusted from hours to seconds.
274 promo_start = start_time.ToDoubleT() + 276 promo_start = start_time.ToDoubleT() +
275 (prefs_->FindPreference(prefs::kNTPPromoGroup) ? 277 (prefs_->FindPreference(prefs::kNTPPromoGroup) ?
276 prefs_->GetInteger(prefs::kNTPPromoGroup) * 278 prefs_->GetInteger(prefs::kNTPPromoGroup) *
277 time_slice_hrs * 60 * 60 : 0); 279 time_slice_hrs * 60 * 60 : 0);
278 promo_end = end_time.ToDoubleT(); 280 promo_end = end_time.ToDoubleT();
279 } 281 }
280 } 282 }
281 } 283 }
282 } 284 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 a_dic->GetString("inproduct", &logo_end_string); 423 a_dic->GetString("inproduct", &logo_end_string);
422 } 424 }
423 } 425 }
424 } 426 }
425 if (!logo_start_string.empty() && 427 if (!logo_start_string.empty() &&
426 logo_start_string.length() > 0 && 428 logo_start_string.length() > 0 &&
427 !logo_end_string.empty() && 429 !logo_end_string.empty() &&
428 logo_end_string.length() > 0) { 430 logo_end_string.length() > 0) {
429 base::Time start_time; 431 base::Time start_time;
430 base::Time end_time; 432 base::Time end_time;
431 if (base::Time::FromString(logo_start_string.c_str(), &start_time) && 433 if (base::Time::FromString(
432 base::Time::FromString(logo_end_string.c_str(), &end_time)) { 434 ASCIIToWide(logo_start_string).c_str(), &start_time) &&
435 base::Time::FromString(
436 ASCIIToWide(logo_end_string).c_str(), &end_time)) {
433 logo_start = start_time.ToDoubleT(); 437 logo_start = start_time.ToDoubleT();
434 logo_end = end_time.ToDoubleT(); 438 logo_end = end_time.ToDoubleT();
435 } 439 }
436 } 440 }
437 } 441 }
438 } 442 }
439 443
440 // 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
441 // 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
442 // 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
472 base::ThreadRestrictions::ScopedAllowIO allow_io; 476 base::ThreadRestrictions::ScopedAllowIO allow_io;
473 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 477 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
474 is_promo_build = PromoResourceService::IsBuildTargeted( 478 is_promo_build = PromoResourceService::IsBuildTargeted(
475 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); 479 channel, prefs->GetInteger(prefs::kNTPPromoBuild));
476 } 480 }
477 481
478 return !promo_closed && !is_synced && is_promo_build; 482 return !promo_closed && !is_synced && is_promo_build;
479 } 483 }
480 484
481 } // namespace PromoResourceServiceUtil 485 } // namespace PromoResourceServiceUtil
OLDNEW
« no previous file with comments | « base/time_unittest.cc ('k') | chrome/common/metrics_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698