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

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

Issue 6903022: Removed wchar_t from Time::FromString (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fixed the pointed problems. Created 9 years, 8 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
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 } 246 }
247 } 247 }
248 if (!promo_start_string.empty() && 248 if (!promo_start_string.empty() &&
249 promo_start_string.length() > 0 && 249 promo_start_string.length() > 0 &&
250 !promo_end_string.empty() && 250 !promo_end_string.empty() &&
251 promo_end_string.length() > 0) { 251 promo_end_string.length() > 0) {
252 base::Time start_time; 252 base::Time start_time;
253 base::Time end_time; 253 base::Time end_time;
254 if (base::Time::FromString( 254 if (base::Time::FromString(
255 ASCIIToWide(promo_start_string).c_str(), &start_time) && 255 promo_start_string.c_str(), &start_time) &&
256 base::Time::FromString( 256 base::Time::FromString(
257 ASCIIToWide(promo_end_string).c_str(), &end_time)) { 257 promo_end_string.c_str(), &end_time)) {
258 // Add group time slice, adjusted from hours to seconds. 258 // Add group time slice, adjusted from hours to seconds.
259 promo_start = start_time.ToDoubleT() + 259 promo_start = start_time.ToDoubleT() +
260 (prefs_->FindPreference(prefs::kNTPPromoGroup) ? 260 (prefs_->FindPreference(prefs::kNTPPromoGroup) ?
261 prefs_->GetInteger(prefs::kNTPPromoGroup) * 261 prefs_->GetInteger(prefs::kNTPPromoGroup) *
262 time_slice_hrs * 60 * 60 : 0); 262 time_slice_hrs * 60 * 60 : 0);
263 promo_end = end_time.ToDoubleT(); 263 promo_end = end_time.ToDoubleT();
264 } 264 }
265 } 265 }
266 } 266 }
267 } 267 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 382 }
383 } 383 }
384 } 384 }
385 if (!logo_start_string.empty() && 385 if (!logo_start_string.empty() &&
386 logo_start_string.length() > 0 && 386 logo_start_string.length() > 0 &&
387 !logo_end_string.empty() && 387 !logo_end_string.empty() &&
388 logo_end_string.length() > 0) { 388 logo_end_string.length() > 0) {
389 base::Time start_time; 389 base::Time start_time;
390 base::Time end_time; 390 base::Time end_time;
391 if (base::Time::FromString( 391 if (base::Time::FromString(
392 ASCIIToWide(logo_start_string).c_str(), &start_time) && 392 logo_start_string.c_str(), &start_time) &&
393 base::Time::FromString( 393 base::Time::FromString(
394 ASCIIToWide(logo_end_string).c_str(), &end_time)) { 394 logo_end_string.c_str(), &end_time)) {
395 logo_start = start_time.ToDoubleT(); 395 logo_start = start_time.ToDoubleT();
396 logo_end = end_time.ToDoubleT(); 396 logo_end = end_time.ToDoubleT();
397 } 397 }
398 } 398 }
399 } 399 }
400 } 400 }
401 401
402 // If logo start or end times have changed, trigger a new web resource 402 // If logo start or end times have changed, trigger a new web resource
403 // notification, so that the logo on the NTP is updated. This check is 403 // notification, so that the logo on the NTP is updated. This check is
404 // outside the reading of the web resource data, because the absence of 404 // outside the reading of the web resource data, because the absence of
(...skipping 29 matching lines...) Expand all
434 base::ThreadRestrictions::ScopedAllowIO allow_io; 434 base::ThreadRestrictions::ScopedAllowIO allow_io;
435 platform_util::Channel channel = platform_util::GetChannel(); 435 platform_util::Channel channel = platform_util::GetChannel();
436 is_promo_build = PromoResourceService::IsBuildTargeted( 436 is_promo_build = PromoResourceService::IsBuildTargeted(
437 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); 437 channel, prefs->GetInteger(prefs::kNTPPromoBuild));
438 } 438 }
439 439
440 return !promo_closed && !is_synced && is_promo_build; 440 return !promo_closed && !is_synced && is_promo_build;
441 } 441 }
442 442
443 } // namespace PromoResourceServiceUtil 443 } // namespace PromoResourceServiceUtil
OLDNEW
« base/time.cc ('K') | « 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