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

Side by Side Diff: ui/base/user_activity/user_activity_detector.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 "ui/base/user_activity/user_activity_detector.h" 5 #include "ui/base/user_activity/user_activity_detector.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 observers_.RemoveObserver(observer); 84 observers_.RemoveObserver(observer);
85 } 85 }
86 86
87 void UserActivityDetector::OnDisplayPowerChanging() { 87 void UserActivityDetector::OnDisplayPowerChanging() {
88 honor_mouse_events_time_ = GetCurrentTime() + 88 honor_mouse_events_time_ = GetCurrentTime() +
89 base::TimeDelta::FromMilliseconds(kDisplayPowerChangeIgnoreMouseMs); 89 base::TimeDelta::FromMilliseconds(kDisplayPowerChangeIgnoreMouseMs);
90 } 90 }
91 91
92 void UserActivityDetector::DidProcessEvent( 92 void UserActivityDetector::DidProcessEvent(
93 const PlatformEvent& platform_event) { 93 const PlatformEvent& platform_event) {
94 scoped_ptr<ui::Event> event(ui::EventFromNative(platform_event)); 94 std::unique_ptr<ui::Event> event(ui::EventFromNative(platform_event));
95 ProcessReceivedEvent(event.get()); 95 ProcessReceivedEvent(event.get());
96 } 96 }
97 97
98 base::TimeTicks UserActivityDetector::GetCurrentTime() const { 98 base::TimeTicks UserActivityDetector::GetCurrentTime() const {
99 return !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); 99 return !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now();
100 } 100 }
101 101
102 void UserActivityDetector::ProcessReceivedEvent(const ui::Event* event) { 102 void UserActivityDetector::ProcessReceivedEvent(const ui::Event* event) {
103 if (!event) 103 if (!event)
104 return; 104 return;
(...skipping 16 matching lines...) Expand all
121 (now - last_observer_notification_time_).InMillisecondsF() >= 121 (now - last_observer_notification_time_).InMillisecondsF() >=
122 kNotifyIntervalMs) { 122 kNotifyIntervalMs) {
123 if (VLOG_IS_ON(1)) 123 if (VLOG_IS_ON(1))
124 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); 124 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event);
125 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); 125 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event));
126 last_observer_notification_time_ = now; 126 last_observer_notification_time_ = now;
127 } 127 }
128 } 128 }
129 129
130 } // namespace ui 130 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/test/scoped_preferred_scroller_style_mac.h ('k') | ui/base/user_activity/user_activity_detector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698