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

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

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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/message_loop/message_loop.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/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/thread_task_runner_handle.h"
12 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/notifications/notification.h" 15 #include "chrome/browser/notifications/notification.h"
14 #include "chrome/browser/prefs/pref_service_syncable.h" 16 #include "chrome/browser/prefs/pref_service_syncable.h"
15 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser_navigator.h" 18 #include "chrome/browser/ui/browser_navigator.h"
17 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
18 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
19 #include "chrome/grit/generated_resources.h" 21 #include "chrome/grit/generated_resources.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 22 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 DefaultDelegate() {} 115 DefaultDelegate() {}
114 116
115 message_center::MessageCenter* GetMessageCenter() override { 117 message_center::MessageCenter* GetMessageCenter() override {
116 return g_browser_process->message_center(); 118 return g_browser_process->message_center();
117 } 119 }
118 120
119 base::Time GetCurrentTime() override { return base::Time::Now(); } 121 base::Time GetCurrentTime() override { return base::Time::Now(); }
120 122
121 void PostTask(const tracked_objects::Location& from_here, 123 void PostTask(const tracked_objects::Location& from_here,
122 const base::Closure& task) override { 124 const base::Closure& task) override {
123 base::MessageLoop::current()->PostTask(from_here, task); 125 base::ThreadTaskRunnerHandle::Get()->PostTask(from_here, task);
124 } 126 }
125 127
126 private: 128 private:
127 DISALLOW_COPY_AND_ASSIGN(DefaultDelegate); 129 DISALLOW_COPY_AND_ASSIGN(DefaultDelegate);
128 }; 130 };
129 131
130 } // namespace 132 } // namespace
131 133
132 ExtensionWelcomeNotification::ExtensionWelcomeNotification( 134 ExtensionWelcomeNotification::ExtensionWelcomeNotification(
133 Profile* const profile, 135 Profile* const profile,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 prefs::kWelcomeNotificationExpirationTimestamp, 348 prefs::kWelcomeNotificationExpirationTimestamp,
347 (delegate_->GetCurrentTime() + 349 (delegate_->GetCurrentTime() +
348 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue()); 350 base::TimeDelta::FromDays(kRequestedShowTimeDays)).ToInternalValue());
349 } 351 }
350 352
351 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const { 353 bool ExtensionWelcomeNotification::IsWelcomeNotificationExpired() const {
352 const base::Time expiration_timestamp = GetExpirationTimestamp(); 354 const base::Time expiration_timestamp = GetExpirationTimestamp();
353 return !expiration_timestamp.is_null() && 355 return !expiration_timestamp.is_null() &&
354 (expiration_timestamp <= delegate_->GetCurrentTime()); 356 (expiration_timestamp <= delegate_->GetCurrentTime());
355 } 357 }
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | chrome/browser/password_manager/native_backend_gnome_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698