browser_observer.h 1007 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef WEBLAYER_PUBLIC_BROWSER_OBSERVER_H_
  5. #define WEBLAYER_PUBLIC_BROWSER_OBSERVER_H_
  6. #include "base/observer_list_types.h"
  7. namespace weblayer {
  8. class Tab;
  9. class BrowserObserver : public base::CheckedObserver {
  10. public:
  11. // A Tab has been been added to the Browser.
  12. virtual void OnTabAdded(Tab* tab) {}
  13. // A Tab has been removed from the Browser. |active_tab_changed| indicates
  14. // if the active tab changed as a result. If the active tab changed,
  15. // OnActiveTabChanged() is also called.
  16. virtual void OnTabRemoved(Tab* tab, bool active_tab_changed) {}
  17. // The tab the user is interacting with has changed. |tab| may be null if no
  18. // tabs are active.
  19. virtual void OnActiveTabChanged(Tab* tab) {}
  20. protected:
  21. ~BrowserObserver() override {}
  22. };
  23. } // namespace weblayer
  24. #endif // WEBLAYER_PUBLIC_BROWSER_OBSERVER_H_