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

Side by Side Diff: chrome/browser/chromeos/power/video_activity_notifier.cc

Issue 10905026: Add is_fullscreen to video updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/power/video_activity_notifier.h" 5 #include "chrome/browser/chromeos/power/video_activity_notifier.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "chromeos/dbus/dbus_thread_manager.h" 8 #include "chromeos/dbus/dbus_thread_manager.h"
9 #include "chromeos/dbus/power_manager_client.h" 9 #include "chromeos/dbus/power_manager_client.h"
10 10
11 namespace { 11 namespace {
12 12
13 // Minimum number of seconds between notifications. 13 // Minimum number of seconds between notifications.
14 const int kNotifyIntervalSec = 5; 14 const int kNotifyIntervalSec = 5;
Daniel Erat 2012/08/30 20:33:59 you should delete this if you're not using it, but
15 15
16 } // namespace 16 } // namespace
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 VideoActivityNotifier::VideoActivityNotifier() { 20 VideoActivityNotifier::VideoActivityNotifier() {
21 ash::Shell::GetInstance()->video_detector()->AddObserver(this); 21 ash::Shell::GetInstance()->video_detector()->AddObserver(this);
22 } 22 }
23 23
24 VideoActivityNotifier::~VideoActivityNotifier() { 24 VideoActivityNotifier::~VideoActivityNotifier() {
25 ash::Shell::GetInstance()->video_detector()->RemoveObserver(this); 25 ash::Shell::GetInstance()->video_detector()->RemoveObserver(this);
26 } 26 }
27 27
28 void VideoActivityNotifier::OnVideoDetected() { 28 void VideoActivityNotifier::OnVideoDetected(bool is_fullscreen) {
29 base::TimeTicks now = base::TimeTicks::Now(); 29 base::TimeTicks now = base::TimeTicks::Now();
30 // InSeconds() truncates rather than rounding, so it's fine for this 30 DBusThreadManager::Get()->GetPowerManagerClient()->
Daniel Erat 2012/08/30 20:33:59 the presence of two rate limits was intentional (w
rharrison 2012/08/31 18:57:13 I have reverted this removal.
31 // comparison. 31 NotifyVideoActivity(now, is_fullscreen);
32 if (last_notify_time_.is_null() || 32 last_notify_time_ = now;
33 (now - last_notify_time_).InSeconds() >= kNotifyIntervalSec) {
34 DBusThreadManager::Get()->GetPowerManagerClient()->NotifyVideoActivity(now);
35 last_notify_time_ = now;
36 }
37 } 33 }
38 34
39 } // namespace chromeos 35 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698