| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 params.disposition = NEW_FOREGROUND_TAB; | 84 params.disposition = NEW_FOREGROUND_TAB; |
| 85 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 85 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 86 chrome::Navigate(¶ms); | 86 chrome::Navigate(¶ms); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void DisableNotificationProvider() { | 89 void DisableNotificationProvider() { |
| 90 message_center::Notifier notifier(notifier_id_, base::string16(), true); | 90 message_center::Notifier notifier(notifier_id_, base::string16(), true); |
| 91 message_center::MessageCenter* message_center = | 91 message_center::MessageCenter* message_center = |
| 92 delegate_->GetMessageCenter(); | 92 delegate_->GetMessageCenter(); |
| 93 message_center->DisableNotificationsByNotifier(notifier_id_); | 93 message_center->DisableNotificationsByNotifier(notifier_id_); |
| 94 message_center->RemoveNotification(welcome_notification_id_, true); | 94 message_center->RemoveNotification(welcome_notification_id_, false); |
| 95 message_center->GetNotifierSettingsProvider()->SetNotifierEnabled( | 95 message_center->GetNotifierSettingsProvider()->SetNotifierEnabled( |
| 96 notifier, false); | 96 notifier, false); |
| 97 } | 97 } |
| 98 | 98 |
| 99 virtual ~NotificationCallbacks() {} | 99 virtual ~NotificationCallbacks() {} |
| 100 | 100 |
| 101 Profile* const profile_; | 101 Profile* const profile_; |
| 102 | 102 |
| 103 const message_center::NotifierId notifier_id_; | 103 const message_center::NotifierId notifier_id_; |
| 104 | 104 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 prefs::kWelcomeNotificationExpirationTimestamp, | 359 prefs::kWelcomeNotificationExpirationTimestamp, |
| 360 (delegate_->GetCurrentTime() + | 360 (delegate_->GetCurrentTime() + |
| 361 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); | 361 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { | 364 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { |
| 365 const base::Time expiration_timestamp = GetExpirationTimestamp(); | 365 const base::Time expiration_timestamp = GetExpirationTimestamp(); |
| 366 return !expiration_timestamp.is_null() && | 366 return !expiration_timestamp.is_null() && |
| 367 (expiration_timestamp <= delegate_->GetCurrentTime()); | 367 (expiration_timestamp <= delegate_->GetCurrentTime()); |
| 368 } | 368 } |
| OLD | NEW |