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

Side by Side Diff: ui/message_center/popup_timer.cc

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller 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
« no previous file with comments | « ui/message_center/popup_timer.h ('k') | ui/message_center/views/message_popup_collection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "ui/message_center/popup_timer.h" 5 #include "ui/message_center/popup_timer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/message_center/message_center_style.h" 9 #include "ui/message_center/message_center_style.h"
10 #include "ui/message_center/message_center_types.h" 10 #include "ui/message_center/message_center_types.h"
(...skipping 17 matching lines...) Expand all
28 28
29 //////////////////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////////////////
30 // PopupTimer 30 // PopupTimer
31 31
32 PopupTimer::PopupTimer(const std::string& id, 32 PopupTimer::PopupTimer(const std::string& id,
33 base::TimeDelta timeout, 33 base::TimeDelta timeout,
34 base::WeakPtr<PopupTimersController> controller) 34 base::WeakPtr<PopupTimersController> controller)
35 : id_(id), 35 : id_(id),
36 timeout_(timeout), 36 timeout_(timeout),
37 timer_controller_(controller), 37 timer_controller_(controller),
38 timer_(new base::OneShotTimer<PopupTimersController>) {} 38 timer_(new base::OneShotTimer) {}
39 39
40 PopupTimer::~PopupTimer() { 40 PopupTimer::~PopupTimer() {
41 if (!timer_) 41 if (!timer_)
42 return; 42 return;
43 43
44 if (timer_->IsRunning()) 44 if (timer_->IsRunning())
45 timer_->Stop(); 45 timer_->Stop();
46 } 46 }
47 47
48 void PopupTimer::Start() { 48 void PopupTimer::Start() {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (popup_timers_.find(id) == popup_timers_.end()) 167 if (popup_timers_.find(id) == popup_timers_.end())
168 StartTimer(id, GetTimeoutForPriority((*iter)->priority())); 168 StartTimer(id, GetTimeoutForPriority((*iter)->priority()));
169 } 169 }
170 170
171 void PopupTimersController::OnNotificationRemoved(const std::string& id, 171 void PopupTimersController::OnNotificationRemoved(const std::string& id,
172 bool by_user) { 172 bool by_user) {
173 CancelTimer(id); 173 CancelTimer(id);
174 } 174 }
175 175
176 } // namespace message_center 176 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/popup_timer.h ('k') | ui/message_center/views/message_popup_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698