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

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

Issue 1676713002: ash/mash: Add a mus-client that sets up ash to provide the system ui for mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // will be reported as user activity and turn the screen back on; too high 46 // will be reported as user activity and turn the screen back on; too high
47 // and we'll ignore legitimate activity. 47 // and we'll ignore legitimate activity.
48 const int UserActivityDetector::kDisplayPowerChangeIgnoreMouseMs = 1000; 48 const int UserActivityDetector::kDisplayPowerChangeIgnoreMouseMs = 1000;
49 49
50 UserActivityDetector::UserActivityDetector() { 50 UserActivityDetector::UserActivityDetector() {
51 CHECK(!g_instance); 51 CHECK(!g_instance);
52 g_instance = this; 52 g_instance = this;
53 53
54 ui::PlatformEventSource* platform_event_source = 54 ui::PlatformEventSource* platform_event_source =
55 ui::PlatformEventSource::GetInstance(); 55 ui::PlatformEventSource::GetInstance();
56 #if defined(OS_CHROMEOS) || defined(OS_LINUX) 56 // XXX(sad): Need a PES for mus.
sky 2016/02/08 17:42:15 XXX->TODO
sadrul 2016/02/08 18:33:24 Done.
57 CHECK(platform_event_source);
58 #endif
59 if (platform_event_source) 57 if (platform_event_source)
60 platform_event_source->AddPlatformEventObserver(this); 58 platform_event_source->AddPlatformEventObserver(this);
61 } 59 }
62 60
63 UserActivityDetector::~UserActivityDetector() { 61 UserActivityDetector::~UserActivityDetector() {
64 ui::PlatformEventSource* platform_event_source = 62 ui::PlatformEventSource* platform_event_source =
65 ui::PlatformEventSource::GetInstance(); 63 ui::PlatformEventSource::GetInstance();
66 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
67 CHECK(platform_event_source);
68 #endif
69 if (platform_event_source) 64 if (platform_event_source)
70 platform_event_source->RemovePlatformEventObserver(this); 65 platform_event_source->RemovePlatformEventObserver(this);
71 g_instance = nullptr; 66 g_instance = nullptr;
72 } 67 }
73 68
74 // static 69 // static
75 UserActivityDetector* UserActivityDetector::Get() { 70 UserActivityDetector* UserActivityDetector::Get() {
76 return g_instance; 71 return g_instance;
77 } 72 }
78 73
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 (now - last_observer_notification_time_).InMillisecondsF() >= 121 (now - last_observer_notification_time_).InMillisecondsF() >=
127 kNotifyIntervalMs) { 122 kNotifyIntervalMs) {
128 if (VLOG_IS_ON(1)) 123 if (VLOG_IS_ON(1))
129 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); 124 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event);
130 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); 125 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event));
131 last_observer_notification_time_ = now; 126 last_observer_notification_time_ = now;
132 } 127 }
133 } 128 }
134 129
135 } // namespace ui 130 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698