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

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

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style nit Created 5 years, 4 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
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/location.h" 9 #include "base/location.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 if (!welcome_notification_id_.empty()) { 254 if (!welcome_notification_id_.empty()) {
255 scoped_ptr<message_center::Notification> message_center_notification( 255 scoped_ptr<message_center::Notification> message_center_notification(
256 new message_center::Notification( 256 new message_center::Notification(
257 message_center::NOTIFICATION_TYPE_BASE_FORMAT, 257 message_center::NOTIFICATION_TYPE_BASE_FORMAT,
258 welcome_notification_id_, 258 welcome_notification_id_,
259 l10n_util::GetStringUTF16(IDS_NOTIFICATION_WELCOME_TITLE), 259 l10n_util::GetStringUTF16(IDS_NOTIFICATION_WELCOME_TITLE),
260 l10n_util::GetStringUTF16(IDS_NOTIFICATION_WELCOME_BODY), 260 l10n_util::GetStringUTF16(IDS_NOTIFICATION_WELCOME_BODY),
261 ui::ResourceBundle::GetSharedInstance().GetImageNamed( 261 ui::ResourceBundle::GetSharedInstance().GetImageNamed(
262 IDR_NOTIFICATION_WELCOME_ICON), 262 IDR_NOTIFICATION_WELCOME_ICON),
263 display_source, 263 display_source, GURL(), notifier_id_, rich_notification_data,
264 notifier_id_, 264 new NotificationCallbacks(profile_, notifier_id_,
265 rich_notification_data, 265 welcome_notification_id_,
266 new NotificationCallbacks( 266 delegate_.get())));
267 profile_, notifier_id_, welcome_notification_id_,
268 delegate_.get())));
269 267
270 if (pop_up_request == POP_UP_HIDDEN) 268 if (pop_up_request == POP_UP_HIDDEN)
271 message_center_notification->set_shown_as_popup(true); 269 message_center_notification->set_shown_as_popup(true);
272 270
273 GetMessageCenter()->AddNotification(message_center_notification.Pass()); 271 GetMessageCenter()->AddNotification(message_center_notification.Pass());
274 StartExpirationTimer(); 272 StartExpirationTimer();
275 } 273 }
276 } 274 }
277 275
278 void ExtensionWelcomeNotification::HideWelcomeNotification() { 276 void ExtensionWelcomeNotification::HideWelcomeNotification() {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 prefs::kWelcomeNotificationExpirationTimestamp, 346 prefs::kWelcomeNotificationExpirationTimestamp,
349 (delegate_->GetCurrentTime() + 347 (delegate_->GetCurrentTime() +
350 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); 348 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue());
351 } 349 }
352 350
353 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { 351 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const {
354 const base::Time expiration_timestamp = GetExpirationTimestamp(); 352 const base::Time expiration_timestamp = GetExpirationTimestamp();
355 return !expiration_timestamp.is_null() && 353 return !expiration_timestamp.is_null() &&
356 (expiration_timestamp <= delegate_->GetCurrentTime()); 354 (expiration_timestamp <= delegate_->GetCurrentTime());
357 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698