| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/notifications/extension_welcome_notification.h" | 5 #include "chrome/browser/notifications/extension_welcome_notification.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 // static | 215 // static |
| 216 void ExtensionWelcomeNotification::RegisterProfilePrefs( | 216 void ExtensionWelcomeNotification::RegisterProfilePrefs( |
| 217 user_prefs::PrefRegistrySyncable* prefs) { | 217 user_prefs::PrefRegistrySyncable* prefs) { |
| 218 prefs->RegisterBooleanPref(prefs::kWelcomeNotificationDismissed, | 218 prefs->RegisterBooleanPref(prefs::kWelcomeNotificationDismissed, |
| 219 false, | 219 false, |
| 220 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 220 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 221 prefs->RegisterBooleanPref(prefs::kWelcomeNotificationDismissedLocal, | 221 prefs->RegisterBooleanPref(prefs::kWelcomeNotificationDismissedLocal, false); |
| 222 false, | |
| 223 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 224 prefs->RegisterBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp, | 222 prefs->RegisterBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp, |
| 225 false, | 223 false); |
| 226 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 224 prefs->RegisterInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp, 0); |
| 227 prefs->RegisterInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp, | |
| 228 0, | |
| 229 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 230 } | 225 } |
| 231 | 226 |
| 232 message_center::MessageCenter* | 227 message_center::MessageCenter* |
| 233 ExtensionWelcomeNotification::GetMessageCenter() const { | 228 ExtensionWelcomeNotification::GetMessageCenter() const { |
| 234 return delegate_->GetMessageCenter(); | 229 return delegate_->GetMessageCenter(); |
| 235 } | 230 } |
| 236 | 231 |
| 237 void ExtensionWelcomeNotification::ShowWelcomeNotification( | 232 void ExtensionWelcomeNotification::ShowWelcomeNotification( |
| 238 const base::string16& display_source, | 233 const base::string16& display_source, |
| 239 const PopUpRequest pop_up_request) { | 234 const PopUpRequest pop_up_request) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 prefs::kWelcomeNotificationExpirationTimestamp, | 346 prefs::kWelcomeNotificationExpirationTimestamp, |
| 352 (delegate_->GetCurrentTime() + | 347 (delegate_->GetCurrentTime() + |
| 353 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); | 348 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); |
| 354 } | 349 } |
| 355 | 350 |
| 356 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { | 351 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { |
| 357 const base::Time expiration_timestamp = GetExpirationTimestamp(); | 352 const base::Time expiration_timestamp = GetExpirationTimestamp(); |
| 358 return !expiration_timestamp.is_null() && | 353 return !expiration_timestamp.is_null() && |
| 359 (expiration_timestamp <= delegate_->GetCurrentTime()); | 354 (expiration_timestamp <= delegate_->GetCurrentTime()); |
| 360 } | 355 } |
| OLD | NEW |