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

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

Issue 10690096: Extracted inner class doing process dispatch. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: FIxing initialization bug. Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 profile_(profile), 82 profile_(profile),
83 ALLOW_THIS_IN_INITIALIZER_LIST( 83 ALLOW_THIS_IN_INITIALIZER_LIST(
84 weak_ptr_factory_(this)), 84 weak_ptr_factory_(this)),
85 web_resource_update_scheduled_(false) { 85 web_resource_update_scheduled_(false) {
86 ScheduleNotificationOnInit(); 86 ScheduleNotificationOnInit();
87 } 87 }
88 88
89 PromoResourceService::~PromoResourceService() { 89 PromoResourceService::~PromoResourceService() {
90 } 90 }
91 91
92 void PromoResourceService::OnUnpackFinished(
93 const DictionaryValue& parsed_json) {
94 Unpack(parsed_json);
95 WebResourceService::OnUnpackFinished(parsed_json);
Miranda Callahan 2012/07/09 14:24:30 see comment in web_resource.cc; I think we should
96 }
97
98 void PromoResourceService::OnUnpackError(const std::string& error_message) {
99 LOG(ERROR) << error_message;
100 WebResourceService::OnUnpackError(error_message);
101 }
102
92 void PromoResourceService::ScheduleNotification(double promo_start, 103 void PromoResourceService::ScheduleNotification(double promo_start,
93 double promo_end) { 104 double promo_end) {
94 if (promo_start > 0 && promo_end > 0) { 105 if (promo_start > 0 && promo_end > 0) {
95 const int64 ms_until_start = 106 const int64 ms_until_start =
96 static_cast<int64>((base::Time::FromDoubleT( 107 static_cast<int64>((base::Time::FromDoubleT(
97 promo_start) - base::Time::Now()).InMilliseconds()); 108 promo_start) - base::Time::Now()).InMilliseconds());
98 const int64 ms_until_end = 109 const int64 ms_until_end =
99 static_cast<int64>((base::Time::FromDoubleT( 110 static_cast<int64>((base::Time::FromDoubleT(
100 promo_end) - base::Time::Now()).InMilliseconds()); 111 promo_end) - base::Time::Now()).InMilliseconds());
101 if (ms_until_start > 0) { 112 if (ms_until_start > 0) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 ScheduleNotification(notification_promo.StartTimeForGroup(), 190 ScheduleNotification(notification_promo.StartTimeForGroup(),
180 notification_promo.EndTime()); 191 notification_promo.EndTime());
181 } 192 }
182 } 193 }
183 194
184 bool PromoResourceService::CanShowNotificationPromo(Profile* profile) { 195 bool PromoResourceService::CanShowNotificationPromo(Profile* profile) {
185 NotificationPromo notification_promo(profile); 196 NotificationPromo notification_promo(profile);
186 notification_promo.InitFromPrefs(); 197 notification_promo.InitFromPrefs();
187 return notification_promo.CanShow(); 198 return notification_promo.CanShow();
188 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698