[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 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 | |
maxbogue | 8ef2508 | 2015-11-16 19:09:58 | [diff] [blame] | 5 | #ifndef COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_ |
| 6 | #define COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_ |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 11 | #include "base/memory/ref_counted.h" |
| 12 | #include "base/memory/ref_counted_memory.h" |
blundell | 47c6d8a | 2015-09-24 11:06:40 | [diff] [blame] | 13 | #include "components/sessions/core/session_id.h" |
| 14 | #include "components/sessions/core/session_types.h" |
maxbogue | 8ef2508 | 2015-11-16 19:09:58 | [diff] [blame] | 15 | #include "components/sync_sessions/synced_session.h" |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 16 | |
maxbogue | a79d99b7 | 2016-09-15 15:59:16 | [diff] [blame] | 17 | namespace sync_sessions { |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 18 | |
| 19 | class 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 | |
zea | e8f0c131d | 2015-08-04 23:20:27 | [diff] [blame] | 27 | // Builds a list of all foreign sessions, ordered from most recent to least |
| 28 | // recent. Caller does NOT own SyncedSession objects. |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 29 | // 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 Astiz | e023c57 | 2018-03-28 07:56:56 | [diff] [blame] | 37 | SessionID tab_id, |
skuhne | b7409dcf | 2014-11-14 04:06:55 | [diff] [blame] | 38 | const sessions::SessionTab** tab) = 0; |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 39 | |
| 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 |
zea | e8f0c131d | 2015-08-04 23:20:27 | [diff] [blame] | 44 | // NOT own SessionWindow objects. |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 45 | // Returns true if the foreign session was found, false otherwise. |
| 46 | virtual bool GetForeignSession( |
| 47 | const std::string& tag, |
skuhne | b7409dcf | 2014-11-14 04:06:55 | [diff] [blame] | 48 | std::vector<const sessions::SessionWindow*>* windows) = 0; |
[email protected] | 85622cd | 2013-12-18 17:32:27 | [diff] [blame] | 49 | |
zea | e8f0c131d | 2015-08-04 23:20:27 | [diff] [blame] | 50 | // 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] | 85622cd | 2013-12-18 17:32:27 | [diff] [blame] | 59 | // 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] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 63 | protected: |
| 64 | virtual ~OpenTabsUIDelegate(); |
| 65 | }; |
| 66 | |
maxbogue | a79d99b7 | 2016-09-15 15:59:16 | [diff] [blame] | 67 | } // namespace sync_sessions |
[email protected] | a9f5662 | 2013-11-21 19:37:06 | [diff] [blame] | 68 | |
maxbogue | 8ef2508 | 2015-11-16 19:09:58 | [diff] [blame] | 69 | #endif // COMPONENTS_SYNC_SESSIONS_OPEN_TABS_UI_DELEGATE_H_ |