open_tabs_ui_delegate.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2013 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_OPEN_TABS_UI_DELEGATE_H_
  5. #define COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/memory/ref_counted.h"
  9. #include "base/memory/ref_counted_memory.h"
  10. #include "components/favicon_base/favicon_types.h"
  11. #include "components/sessions/core/session_id.h"
  12. #include "components/sessions/core/session_types.h"
  13. #include "components/sync_sessions/synced_session.h"
  14. #include "url/gurl.h"
  15. namespace sync_sessions {
  16. class OpenTabsUIDelegate {
  17. public:
  18. // Builds a list of all foreign sessions, ordered from most recent to least
  19. // recent. Caller does NOT own SyncedSession objects.
  20. // Returns true if foreign sessions were found, false otherwise.
  21. virtual bool GetAllForeignSessions(
  22. std::vector<const SyncedSession*>* sessions) = 0;
  23. // Looks up the foreign tab identified by |tab_id| and belonging to foreign
  24. // session |tag|. Caller does NOT own the SessionTab object.
  25. // Returns true if the foreign session and tab were found, false otherwise.
  26. virtual bool GetForeignTab(const std::string& tag,
  27. SessionID tab_id,
  28. const sessions::SessionTab** tab) = 0;
  29. // Delete a foreign session and all its sync data.
  30. virtual void DeleteForeignSession(const std::string& tag) = 0;
  31. // Loads all windows for foreign session with session tag |tag|. Caller does
  32. // NOT own SessionWindow objects.
  33. // Returns true if the foreign session was found, false otherwise.
  34. virtual bool GetForeignSession(
  35. const std::string& tag,
  36. std::vector<const sessions::SessionWindow*>* windows) = 0;
  37. // Loads all tabs for a foreign session, ignoring window grouping, and
  38. // ordering by recency (most recent to least recent). Will automatically
  39. // prune those tabs that are not syncable or are the NTP. Caller does NOT own
  40. // SessionTab objects.
  41. // Returns true if the foreign session was found, false otherwise.
  42. virtual bool GetForeignSessionTabs(
  43. const std::string& tag,
  44. std::vector<const sessions::SessionTab*>* tabs) = 0;
  45. // Sets |*local| to point to the sessions sync representation of the
  46. // local machine.
  47. virtual bool GetLocalSession(const SyncedSession** local) = 0;
  48. protected:
  49. virtual ~OpenTabsUIDelegate();
  50. };
  51. } // namespace sync_sessions
  52. #endif // COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_