chromium/chrome/browser/ui/tabs/saved_tab_groups/session_service_tab_group_sync_observer.h

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

#ifndef CHROME_BROWSER_UI_TABS_SAVED_TAB_GROUPS_SESSION_SERVICE_TAB_GROUP_SYNC_OBSERVER_H_
#define CHROME_BROWSER_UI_TABS_SAVED_TAB_GROUPS_SESSION_SERVICE_TAB_GROUP_SYNC_OBSERVER_H_

#include <optional>
#include <string>

#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "components/saved_tab_groups/saved_tab_group.h"
#include "components/saved_tab_groups/saved_tab_group_model.h"
#include "components/saved_tab_groups/saved_tab_group_model_observer.h"
#include "components/saved_tab_groups/tab_group_sync_service.h"
#include "components/saved_tab_groups/types.h"
#include "components/sessions/core/session_id.h"
#include "components/tab_groups/tab_group_id.h"

class Profile;
class TabStripModel;

namespace tab_groups {

// This class listens and is notified by the the SavedTabGroupModel /
// TabGroupSyncService::Observer. When notified, we check if the TabStripModel
// contains the affected tabs / groups. If not we disregard the changes.
// Otherwise, we will write the changes to disk using the session service. This
// is done to preserve the saved state of SavedTabGroups across sessions.
class SessionServiceTabGroupSyncObserver
    : public SavedTabGroupModelObserver,
      public TabGroupSyncService::Observer {};

}  // namespace tab_groups
#endif  // CHROME_BROWSER_UI_TABS_SAVED_TAB_GROUPS_SESSION_SERVICE_TAB_GROUP_SYNC_OBSERVER_H_