chromium/chrome/browser/performance_manager/decorators/helpers/page_live_state_decorator_helper.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/performance_manager/decorators/helpers/page_live_state_decorator_helper.h"

#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "components/performance_manager/public/decorators/page_live_state_decorator.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/permissions/permissions_client.h"
#include "content/public/browser/web_contents_observer.h"

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#endif  // !BUILDFLAG(IS_ANDROID)

namespace performance_manager {
namespace {

#if !BUILDFLAG(IS_ANDROID)
// Encapsulates all of the "Active tab" tracking logic, which uses `BrowserList`
// and is therefore not available on Android. This class keeps track of existing
// Browsers and their tab strips, and updates PageLiveState data with whether
// each tab is currently active or not.
class ActiveTabObserver : public TabStripModelObserver,
                          public BrowserListObserver {};
#endif  // !BUILDFLAG(IS_ANDROID)

}  // namespace
// Listens to content::WebContentsObserver notifications for a given WebContents
// and updates the PageLiveStateDecorator accordingly. Destroys itself when the
// WebContents it observes is destroyed.
class PageLiveStateDecoratorHelper::WebContentsObserver
    : public content::WebContentsObserver {};

PageLiveStateDecoratorHelper::PageLiveStateDecoratorHelper() {}

PageLiveStateDecoratorHelper::~PageLiveStateDecoratorHelper() {}

void PageLiveStateDecoratorHelper::OnIsCapturingVideoChanged(
    content::WebContents* contents,
    bool is_capturing_video) {}

void PageLiveStateDecoratorHelper::OnIsCapturingAudioChanged(
    content::WebContents* contents,
    bool is_capturing_audio) {}

void PageLiveStateDecoratorHelper::OnIsBeingMirroredChanged(
    content::WebContents* contents,
    bool is_being_mirrored) {}

void PageLiveStateDecoratorHelper::OnIsCapturingWindowChanged(
    content::WebContents* contents,
    bool is_capturing_window) {}

void PageLiveStateDecoratorHelper::OnIsCapturingDisplayChanged(
    content::WebContents* contents,
    bool is_capturing_display) {}

void PageLiveStateDecoratorHelper::DevToolsAgentHostAttached(
    content::DevToolsAgentHost* agent_host) {}

void PageLiveStateDecoratorHelper::DevToolsAgentHostDetached(
    content::DevToolsAgentHost* agent_host) {}

void PageLiveStateDecoratorHelper::OnPageNodeCreatedForWebContents(
    content::WebContents* web_contents) {}

}  // namespace performance_manager