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
5#ifndef CHROME_BROWSER_SYNC_OPEN_TABS_UI_DELEGATE_H_
6#define CHROME_BROWSER_SYNC_OPEN_TABS_UI_DELEGATE_H_
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"
14#include "chrome/browser/sessions/session_types.h"
15#include "chrome/browser/sync/glue/synced_session.h"
16#include "components/sessions/session_id.h"
17
18namespace browser_sync {
19
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
28  // Builds a list of all foreign sessions. Caller does NOT own SyncedSession
29  // objects.
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,
39                             const SessionTab** tab) = 0;
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
45  // NOT own SyncedSession objects.
46  // Returns true if the foreign session was found, false otherwise.
47  virtual bool GetForeignSession(
48      const std::string& tag,
49      std::vector<const SessionWindow*>* windows) = 0;
50
51  // Sets |*local| to point to the sessions sync representation of the
52  // local machine.
53  virtual bool GetLocalSession(const SyncedSession** local) = 0;
54
55 protected:
56  virtual ~OpenTabsUIDelegate();
57};
58
59}  // namespace browser_sync
60
61#endif  // CHROME_BROWSER_SYNC_OPEN_TABS_UI_DELEGATE_H_
62