blob: 4b887c0fd5375a020bfc7820f1517cb5f556e6e8 [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
11#include "base/basictypes.h"
12#include "base/memory/ref_counted.h"
13#include "base/memory/ref_counted_memory.h"
blundell47c6d8a2015-09-24 11:06:4014#include "components/sessions/core/session_id.h"
15#include "components/sessions/core/session_types.h"
maxbogue8ef25082015-11-16 19:09:5816#include "components/sync_sessions/synced_session.h"
[email protected]a9f56622013-11-21 19:37:0617
droger6a118632015-06-23 17:59:4518namespace sync_driver {
[email protected]a9f56622013-11-21 19:37:0619
20class OpenTabsUIDelegate {
21 public:
22 // If a valid favicon for the page at |url| is found, fills |favicon_png| with
23 // the png-encoded image and returns true. Else, returns false.
24 virtual bool GetSyncedFaviconForPageURL(
25 const std::string& pageurl,
26 scoped_refptr<base::RefCountedMemory>* favicon_png) const = 0;
27
zeae8f0c131d2015-08-04 23:20:2728 // Builds a list of all foreign sessions, ordered from most recent to least
29 // recent. Caller does NOT own SyncedSession objects.
[email protected]a9f56622013-11-21 19:37:0630 // Returns true if foreign sessions were found, false otherwise.
31 virtual bool GetAllForeignSessions(
32 std::vector<const SyncedSession*>* sessions) = 0;
33
34 // Looks up the foreign tab identified by |tab_id| and belonging to foreign
35 // session |tag|. Caller does NOT own the SessionTab object.
36 // Returns true if the foreign session and tab were found, false otherwise.
37 virtual bool GetForeignTab(const std::string& tag,
38 const SessionID::id_type tab_id,
skuhneb7409dcf2014-11-14 04:06:5539 const sessions::SessionTab** tab) = 0;
[email protected]a9f56622013-11-21 19:37:0640
41 // Delete a foreign session and all its sync data.
42 virtual void DeleteForeignSession(const std::string& tag) = 0;
43
44 // Loads all windows for foreign session with session tag |tag|. Caller does
zeae8f0c131d2015-08-04 23:20:2745 // NOT own SessionWindow objects.
[email protected]a9f56622013-11-21 19:37:0646 // Returns true if the foreign session was found, false otherwise.
47 virtual bool GetForeignSession(
48 const std::string& tag,
skuhneb7409dcf2014-11-14 04:06:5549 std::vector<const sessions::SessionWindow*>* windows) = 0;
[email protected]85622cd2013-12-18 17:32:2750
zeae8f0c131d2015-08-04 23:20:2751 // Loads all tabs for a foreign session, ignoring window grouping, and
52 // ordering by recency (most recent to least recent). Will automatically
53 // prune those tabs that are not syncable or are the NTP. Caller does NOT own
54 // SessionTab objects.
55 // Returns true if the foreign session was found, false otherwise.
56 virtual bool GetForeignSessionTabs(
57 const std::string& tag,
58 std::vector<const sessions::SessionTab*>* tabs) = 0;
59
[email protected]85622cd2013-12-18 17:32:2760 // Sets |*local| to point to the sessions sync representation of the
61 // local machine.
62 virtual bool GetLocalSession(const SyncedSession** local) = 0;
63
[email protected]a9f56622013-11-21 19:37:0664 protected:
65 virtual ~OpenTabsUIDelegate();
66};
67
droger6a118632015-06-23 17:59:4568} // namespace sync_driver
[email protected]a9f56622013-11-21 19:37:0669
maxbogue8ef25082015-11-16 19:09:5870#endif // COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_