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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 private: | 73 private: |
74 void MarkAsDismissed() { | 74 void MarkAsDismissed() { |
75 profile_->GetPrefs()->SetBoolean(prefs::kWelcomeNotificationDismissedLocal, | 75 profile_->GetPrefs()->SetBoolean(prefs::kWelcomeNotificationDismissedLocal, |
76 true); | 76 true); |
77 } | 77 } |
78 | 78 |
79 void OpenNotificationLearnMoreTab() { | 79 void OpenNotificationLearnMoreTab() { |
80 chrome::NavigateParams params( | 80 chrome::NavigateParams params( |
81 profile_, | 81 profile_, |
82 GURL(chrome::kNotificationWelcomeLearnMoreURL), | 82 GURL(chrome::kNotificationWelcomeLearnMoreURL), |
83 content::PAGE_TRANSITION_LINK); | 83 ui::PAGE_TRANSITION_LINK); |
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_); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 prefs::kWelcomeNotificationExpirationTimestamp, | 360 prefs::kWelcomeNotificationExpirationTimestamp, |
361 (delegate_->GetCurrentTime() + | 361 (delegate_->GetCurrentTime() + |
362 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); | 362 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); |
363 } | 363 } |
364 | 364 |
365 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { | 365 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { |
366 const base::Time expiration_timestamp = GetExpirationTimestamp(); | 366 const base::Time expiration_timestamp = GetExpirationTimestamp(); |
367 return !expiration_timestamp.is_null() && | 367 return !expiration_timestamp.is_null() && |
368 (expiration_timestamp <= delegate_->GetCurrentTime()); | 368 (expiration_timestamp <= delegate_->GetCurrentTime()); |
369 } | 369 } |
OLD | NEW |