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

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

Issue 1305213009: Componentize PrefSyncableService and support classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_service_syncable
Patch Set: Add missing dependency on //sync:test_support_sync_api for unit tests with gn Created 5 years, 3 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"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/notifications/notification.h" 15 #include "chrome/browser/notifications/notification.h"
16 #include "chrome/browser/prefs/pref_service_syncable.h"
17 #include "chrome/browser/prefs/pref_service_syncable_util.h" 16 #include "chrome/browser/prefs/pref_service_syncable_util.h"
18 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser_navigator.h" 18 #include "chrome/browser/ui/browser_navigator.h"
20 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
22 #include "chrome/grit/generated_resources.h" 21 #include "chrome/grit/generated_resources.h"
23 #include "components/pref_registry/pref_registry_syncable.h" 22 #include "components/pref_registry/pref_registry_syncable.h"
23 #include "components/syncable_prefs/pref_service_syncable.h"
24 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/message_center/message_center.h" 27 #include "ui/message_center/message_center.h"
28 #include "ui/message_center/notification.h" 28 #include "ui/message_center/notification.h"
29 #include "ui/message_center/notification_delegate.h" 29 #include "ui/message_center/notification_delegate.h"
30 #include "ui/message_center/notification_types.h" 30 #include "ui/message_center/notification_types.h"
31 31
32 const int ExtensionWelcomeNotification::kRequestedShowTimeDays = 14; 32 const int ExtensionWelcomeNotification::kRequestedShowTimeDays = 14;
33 const char ExtensionWelcomeNotification::kChromeNowExtensionID[] = 33 const char ExtensionWelcomeNotification::kChromeNowExtensionID[] =
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 prefs::kWelcomeNotificationExpirationTimestamp, 347 prefs::kWelcomeNotificationExpirationTimestamp,
348 (delegate_->GetCurrentTime() + 348 (delegate_->GetCurrentTime() +
349 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); 349 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue());
350 } 350 }
351 351
352 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { 352 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const {
353 const base::Time expiration_timestamp = GetExpirationTimestamp(); 353 const base::Time expiration_timestamp = GetExpirationTimestamp();
354 return !expiration_timestamp.is_null() && 354 return !expiration_timestamp.is_null() &&
355 (expiration_timestamp <= delegate_->GetCurrentTime()); 355 (expiration_timestamp <= delegate_->GetCurrentTime());
356 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698