synced_window_delegate.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2012 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 COMPONENTS_SYNC_SESSIONS_SYNCED_WINDOW_DELEGATE_H_
  5. #define COMPONENTS_SYNC_SESSIONS_SYNCED_WINDOW_DELEGATE_H_
  6. #include "components/sessions/core/session_id.h"
  7. namespace sync_sessions {
  8. class SyncedTabDelegate;
  9. // A SyncedWindowDelegate is used to insulate the sync code from depending
  10. // directly on Browser and BrowserList.
  11. class SyncedWindowDelegate {
  12. public:
  13. // Methods originating from Browser.
  14. // Returns true iff this browser has a visible window representation
  15. // associated with it. Sometimes, if a window is being created/removed the
  16. // model object may exist without its UI counterpart.
  17. virtual bool HasWindow() const = 0;
  18. // see Browser::session_id
  19. virtual SessionID GetSessionId() const = 0;
  20. // see Browser::tab_count
  21. virtual int GetTabCount() const = 0;
  22. // see Browser::active_index
  23. virtual int GetActiveIndex() const = 0;
  24. // see Browser::is_type_normal
  25. virtual bool IsTypeNormal() const = 0;
  26. // see Browser::is_type_popup
  27. virtual bool IsTypePopup() const = 0;
  28. // Methods derivated from Browser
  29. // Returns true iff the provided tab is currently "pinned" in the tab strip.
  30. virtual bool IsTabPinned(const SyncedTabDelegate* tab) const = 0;
  31. // see TabStripModel::GetWebContentsAt
  32. virtual SyncedTabDelegate* GetTabAt(int index) const = 0;
  33. // Return the tab id for the tab at |index|.
  34. virtual SessionID GetTabIdAt(int index) const = 0;
  35. // Return true if we are currently restoring sessions asynchronously.
  36. virtual bool IsSessionRestoreInProgress() const = 0;
  37. // Helper methods.
  38. // Return true if this window should be considered for syncing.
  39. virtual bool ShouldSync() const = 0;
  40. protected:
  41. virtual ~SyncedWindowDelegate() {}
  42. };
  43. } // namespace sync_sessions
  44. #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_WINDOW_DELEGATE_H_