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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void MarkAsDismissed() { | 81 void MarkAsDismissed() { |
82 profile_->GetPrefs()->SetBoolean(prefs::kWelcomeNotificationDismissedLocal, | 82 profile_->GetPrefs()->SetBoolean(prefs::kWelcomeNotificationDismissedLocal, |
83 true); | 83 true); |
84 } | 84 } |
85 | 85 |
86 void OpenNotificationLearnMoreTab() { | 86 void OpenNotificationLearnMoreTab() { |
87 chrome::NavigateParams params( | 87 chrome::NavigateParams params( |
88 profile_, | 88 profile_, |
89 GURL(chrome::kNotificationWelcomeLearnMoreURL), | 89 GURL(chrome::kNotificationWelcomeLearnMoreURL), |
90 ui::PAGE_TRANSITION_LINK); | 90 ui::PAGE_TRANSITION_LINK); |
91 params.disposition = NEW_FOREGROUND_TAB; | 91 params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
92 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 92 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
93 chrome::Navigate(¶ms); | 93 chrome::Navigate(¶ms); |
94 } | 94 } |
95 | 95 |
96 void DisableNotificationProvider() { | 96 void DisableNotificationProvider() { |
97 message_center::Notifier notifier(notifier_id_, base::string16(), true); | 97 message_center::Notifier notifier(notifier_id_, base::string16(), true); |
98 message_center::MessageCenter* message_center = | 98 message_center::MessageCenter* message_center = |
99 delegate_->GetMessageCenter(); | 99 delegate_->GetMessageCenter(); |
100 message_center->DisableNotificationsByNotifier(notifier_id_); | 100 message_center->DisableNotificationsByNotifier(notifier_id_); |
101 message_center->RemoveNotification(welcome_notification_id_, false); | 101 message_center->RemoveNotification(welcome_notification_id_, false); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 prefs::kWelcomeNotificationExpirationTimestamp, | 352 prefs::kWelcomeNotificationExpirationTimestamp, |
353 (delegate_->GetCurrentTime() + | 353 (delegate_->GetCurrentTime() + |
354 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); | 354 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); |
355 } | 355 } |
356 | 356 |
357 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { | 357 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { |
358 const base::Time expiration_timestamp = GetExpirationTimestamp(); | 358 const base::Time expiration_timestamp = GetExpirationTimestamp(); |
359 return !expiration_timestamp.is_null() && | 359 return !expiration_timestamp.is_null() && |
360 (expiration_timestamp <= delegate_->GetCurrentTime()); | 360 (expiration_timestamp <= delegate_->GetCurrentTime()); |
361 } | 361 } |
OLD | NEW |