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

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: Removed unnecessary blankline. 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( 271 if (base::Time::FromString(promo_start_string.c_str(), &start_time) &&
272 ASCIIToWide(promo_start_string).c_str(), &start_time) && 272 base::Time::FromString(promo_end_string.c_str(), &end_time)) {
273 base::Time::FromString(
274 ASCIIToWide(promo_end_string).c_str(), &end_time)) {
275 // Add group time slice, adjusted from hours to seconds. 273 // Add group time slice, adjusted from hours to seconds.
276 promo_start = start_time.ToDoubleT() + 274 promo_start = start_time.ToDoubleT() +
277 (prefs_->FindPreference(prefs::kNTPPromoGroup) ? 275 (prefs_->FindPreference(prefs::kNTPPromoGroup) ?
278 prefs_->GetInteger(prefs::kNTPPromoGroup) * 276 prefs_->GetInteger(prefs::kNTPPromoGroup) *
279 time_slice_hrs * 60 * 60 : 0); 277 time_slice_hrs * 60 * 60 : 0);
280 promo_end = end_time.ToDoubleT(); 278 promo_end = end_time.ToDoubleT();
281 } 279 }
282 } 280 }
283 } 281 }
284 } 282 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 a_dic->GetString("inproduct", &logo_end_string); 421 a_dic->GetString("inproduct", &logo_end_string);
424 } 422 }
425 } 423 }
426 } 424 }
427 if (!logo_start_string.empty() && 425 if (!logo_start_string.empty() &&
428 logo_start_string.length() > 0 && 426 logo_start_string.length() > 0 &&
429 !logo_end_string.empty() && 427 !logo_end_string.empty() &&
430 logo_end_string.length() > 0) { 428 logo_end_string.length() > 0) {
431 base::Time start_time; 429 base::Time start_time;
432 base::Time end_time; 430 base::Time end_time;
433 if (base::Time::FromString( 431 if (base::Time::FromString(logo_start_string.c_str(), &start_time) &&
434 ASCIIToWide(logo_start_string).c_str(), &start_time) && 432 base::Time::FromString(logo_end_string.c_str(), &end_time)) {
435 base::Time::FromString(
436 ASCIIToWide(logo_end_string).c_str(), &end_time)) {
437 logo_start = start_time.ToDoubleT(); 433 logo_start = start_time.ToDoubleT();
438 logo_end = end_time.ToDoubleT(); 434 logo_end = end_time.ToDoubleT();
439 } 435 }
440 } 436 }
441 } 437 }
442 } 438 }
443 439
444 // If logo start or end times have changed, trigger a new web resource 440 // 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 441 // 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 442 // outside the reading of the web resource data, because the absence of
(...skipping 29 matching lines...) Expand all
476 base::ThreadRestrictions::ScopedAllowIO allow_io; 472 base::ThreadRestrictions::ScopedAllowIO allow_io;
477 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 473 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
478 is_promo_build = PromoResourceService::IsBuildTargeted( 474 is_promo_build = PromoResourceService::IsBuildTargeted(
479 channel, prefs->GetInteger(prefs::kNTPPromoBuild)); 475 channel, prefs->GetInteger(prefs::kNTPPromoBuild));
480 } 476 }
481 477
482 return !promo_closed && !is_synced && is_promo_build; 478 return !promo_closed && !is_synced && is_promo_build;
483 } 479 }
484 480
485 } // namespace PromoResourceServiceUtil 481 } // 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