| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/metrics/desktop_engagement/audible_contents_tracker.h" | 5 #include "chrome/browser/metrics/desktop_session_duration/audible_contents_track
er.h" |
| 6 | 6 |
| 7 #include "chrome/browser/metrics/desktop_engagement/desktop_engagement_service.h
" | 7 #include "chrome/browser/metrics/desktop_session_duration/desktop_session_durati
on_tracker.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 | 11 |
| 12 namespace metrics { | 12 namespace metrics { |
| 13 | 13 |
| 14 AudibleContentsTracker::AudibleContentsTracker(Observer* observer) | 14 AudibleContentsTracker::AudibleContentsTracker(Observer* observer) |
| 15 : observer_(observer) { | 15 : observer_(observer) { |
| 16 BrowserList* browser_list = BrowserList::GetInstance(); | 16 BrowserList* browser_list = BrowserList::GetInstance(); |
| 17 for (Browser* browser : *browser_list) | 17 for (Browser* browser : *browser_list) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void AudibleContentsTracker::RemoveAudibleWebContents( | 71 void AudibleContentsTracker::RemoveAudibleWebContents( |
| 72 content::WebContents* web_contents) { | 72 content::WebContents* web_contents) { |
| 73 // If the web content was previously audible and there are no other audible | 73 // If the web content was previously audible and there are no other audible |
| 74 // web contents then notify that audio ended. | 74 // web contents then notify that audio ended. |
| 75 bool removed = (audible_contents_.erase(web_contents) == 1); | 75 bool removed = (audible_contents_.erase(web_contents) == 1); |
| 76 if (removed && audible_contents_.empty()) | 76 if (removed && audible_contents_.empty()) |
| 77 observer_->OnAudioEnd(); | 77 observer_->OnAudioEnd(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace metrics | 80 } // namespace metrics |
| OLD | NEW |