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

Unified Diff: ash/wm/video_detector.cc

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/video_detector.h ('k') | chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/video_detector.cc
diff --git a/ash/wm/video_detector.cc b/ash/wm/video_detector.cc
index b1ccbc076c118e60a330f4e1535c1772c34f9676..18d9704e9da432f898bc8c2e6c4c51168995ab98 100644
--- a/ash/wm/video_detector.cc
+++ b/ash/wm/video_detector.cc
@@ -82,7 +82,6 @@ VideoDetector::VideoDetector()
: state_(State::NOT_PLAYING),
video_is_playing_(false),
window_observer_manager_(this),
- wm_window_observer_manager_(this),
is_shutting_down_(false) {
aura::Env::GetInstance()->AddObserver(this);
WmShell::Get()->AddShellObserver(this);
@@ -129,6 +128,14 @@ void VideoDetector::OnDelegatedFrameDamage(
HandleVideoActivity(window, now);
}
+void VideoDetector::OnWindowDestroying(aura::Window* window) {
+ if (fullscreen_root_windows_.count(window)) {
+ window_observer_manager_.Remove(window);
+ fullscreen_root_windows_.erase(window);
+ UpdateState();
+ }
+}
+
void VideoDetector::OnWindowDestroyed(aura::Window* window) {
window_infos_.erase(window);
window_observer_manager_.Remove(window);
@@ -142,21 +149,15 @@ void VideoDetector::OnAppTerminating() {
void VideoDetector::OnFullscreenStateChanged(bool is_fullscreen,
WmWindow* root_window) {
- if (is_fullscreen && !fullscreen_root_windows_.count(root_window)) {
- fullscreen_root_windows_.insert(root_window);
- wm_window_observer_manager_.Add(root_window);
+ aura::Window* aura_window = root_window->aura_window();
+ if (is_fullscreen && !fullscreen_root_windows_.count(aura_window)) {
+ fullscreen_root_windows_.insert(aura_window);
+ if (!window_observer_manager_.IsObserving(aura_window))
+ window_observer_manager_.Add(aura_window);
UpdateState();
- } else if (!is_fullscreen && fullscreen_root_windows_.count(root_window)) {
- fullscreen_root_windows_.erase(root_window);
- wm_window_observer_manager_.Remove(root_window);
- UpdateState();
- }
-}
-
-void VideoDetector::OnWindowDestroying(WmWindow* window) {
- if (fullscreen_root_windows_.count(window)) {
- wm_window_observer_manager_.Remove(window);
- fullscreen_root_windows_.erase(window);
+ } else if (!is_fullscreen && fullscreen_root_windows_.count(aura_window)) {
+ fullscreen_root_windows_.erase(aura_window);
+ window_observer_manager_.Remove(aura_window);
UpdateState();
}
}
« no previous file with comments | « ash/wm/video_detector.h ('k') | chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698