| OLD | NEW |
| 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 "ash/wm/video_detector.h" | 5 #include "ash/wm/video_detector.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Number of video-sized updates that we've seen in the second starting at | 46 // Number of video-sized updates that we've seen in the second starting at |
| 47 // |second_start_time_|. (Keeping a rolling window is overkill here.) | 47 // |second_start_time_|. (Keeping a rolling window is overkill here.) |
| 48 int num_video_updates_in_second_; | 48 int num_video_updates_in_second_; |
| 49 | 49 |
| 50 base::TimeTicks second_start_time_; | 50 base::TimeTicks second_start_time_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(WindowInfo); | 52 DISALLOW_COPY_AND_ASSIGN(WindowInfo); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 VideoDetector::VideoDetector() | 55 VideoDetector::VideoDetector() |
| 56 : ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)), | 56 : observer_manager_(this), |
| 57 is_shutting_down_(false) { | 57 is_shutting_down_(false) { |
| 58 aura::Env::GetInstance()->AddObserver(this); | 58 aura::Env::GetInstance()->AddObserver(this); |
| 59 Shell::GetInstance()->AddShellObserver(this); | 59 Shell::GetInstance()->AddShellObserver(this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 VideoDetector::~VideoDetector() { | 62 VideoDetector::~VideoDetector() { |
| 63 Shell::GetInstance()->RemoveShellObserver(this); | 63 Shell::GetInstance()->RemoveShellObserver(this); |
| 64 aura::Env::GetInstance()->RemoveObserver(this); | 64 aura::Env::GetInstance()->RemoveObserver(this); |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 bool is_fullscreen = | 119 bool is_fullscreen = |
| 120 toplevel_window ? wm::IsWindowFullscreen(toplevel_window) : false; | 120 toplevel_window ? wm::IsWindowFullscreen(toplevel_window) : false; |
| 121 | 121 |
| 122 FOR_EACH_OBSERVER(VideoDetectorObserver, | 122 FOR_EACH_OBSERVER(VideoDetectorObserver, |
| 123 observers_, | 123 observers_, |
| 124 OnVideoDetected(is_fullscreen)); | 124 OnVideoDetected(is_fullscreen)); |
| 125 last_observer_notification_time_ = now; | 125 last_observer_notification_time_ = now; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace ash | 128 } // namespace ash |
| OLD | NEW |