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