blob: de915e1a8ac89879fed5ab6bdbb39904d9f0773d [file] [log] [blame]
[email protected]a9f56622013-11-21 19:37:061// 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
maxbogue8ef25082015-11-16 19:09:585#ifndef COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_
6#define COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_
[email protected]a9f56622013-11-21 19:37:067
8#include <string>
9#include <vector>
10
[email protected]a9f56622013-11-21 19:37:0611#include "base/memory/ref_counted.h"
12#include "base/memory/ref_counted_memory.h"
blundell47c6d8a2015-09-24 11:06:4013#include "components/sessions/core/session_id.h"
14#include "components/sessions/core/session_types.h"
maxbogue8ef25082015-11-16 19:09:5815#include "components/sync_sessions/synced_session.h"
[email protected]a9f56622013-11-21 19:37:0616
maxboguea79d99b72016-09-15 15:59:1617namespace sync_sessions {
[email protected]a9f56622013-11-21 19:37:0618
19class OpenTabsUIDelegate {
20 public:
21 // If a valid favicon for the page at |url| is found, fills |favicon_png| with
22 // the png-encoded image and returns true. Else, returns false.
23 virtual bool GetSyncedFaviconForPageURL(
24 const std::string& pageurl,
25 scoped_refptr<base::RefCountedMemory>* favicon_png) const = 0;
26
zeae8f0c131d2015-08-04 23:20:2727 // Builds a list of all foreign sessions, ordered from most recent to least
28 // recent. Caller does NOT own SyncedSession objects.
[email protected]a9f56622013-11-21 19:37:0629 // Returns true if foreign sessions were found, false otherwise.
30 virtual bool GetAllForeignSessions(
31 std::vector<const SyncedSession*>* sessions) = 0;
32
33 // Looks up the foreign tab identified by |tab_id| and belonging to foreign
34 // session |tag|. Caller does NOT own the SessionTab object.
35 // Returns true if the foreign session and tab were found, false otherwise.
36 virtual bool GetForeignTab(const std::string& tag,
Mikel Astize023c572018-03-28 07:56:5637 SessionID tab_id,
skuhneb7409dcf2014-11-14 04:06:5538 const sessions::SessionTab** tab) = 0;
[email protected]a9f56622013-11-21 19:37:0639
40 // Delete a foreign session and all its sync data.
41 virtual void DeleteForeignSession(const std::string& tag) = 0;
42
43 // Loads all windows for foreign session with session tag |tag|. Caller does
zeae8f0c131d2015-08-04 23:20:2744 // NOT own SessionWindow objects.
[email protected]a9f56622013-11-21 19:37:0645 // Returns true if the foreign session was found, false otherwise.
46 virtual bool GetForeignSession(
47 const std::string& tag,
skuhneb7409dcf2014-11-14 04:06:5548 std::vector<const sessions::SessionWindow*>* windows) = 0;
[email protected]85622cd2013-12-18 17:32:2749
zeae8f0c131d2015-08-04 23:20:2750 // Loads all tabs for a foreign session, ignoring window grouping, and
51 // ordering by recency (most recent to least recent). Will automatically
52 // prune those tabs that are not syncable or are the NTP. Caller does NOT own
53 // SessionTab objects.
54 // Returns true if the foreign session was found, false otherwise.
55 virtual bool GetForeignSessionTabs(
56 const std::string& tag,
57 std::vector<const sessions::SessionTab*>* tabs) = 0;
58
[email protected]85622cd2013-12-18 17:32:2759 // Sets |*local| to point to the sessions sync representation of the
60 // local machine.
61 virtual bool GetLocalSession(const SyncedSession** local) = 0;
62
[email protected]a9f56622013-11-21 19:37:0663 protected:
64 virtual ~OpenTabsUIDelegate();
65};
66
maxboguea79d99b72016-09-15 15:59:1667} // namespace sync_sessions
[email protected]a9f56622013-11-21 19:37:0668
maxbogue8ef25082015-11-16 19:09:5869#endif // COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_