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

Side by Side Diff: chrome/browser/notifications/extension_welcome_notification.cc

Issue 260533002: Fix Crash Due to Programmatic Dismissal of a Notification. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(&params); 86 chrome::Navigate(&params);
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698