Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / sync_driver / open_tabs_ui_delegate.h
blobf153eb62f3c0f0641b7d45c8be59cf9a01f00af5
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.
5 #ifndef COMPONENTS_SYNC_DRIVER_OPEN_TABS_UI_DELEGATE_H_
6 #define COMPONENTS_SYNC_DRIVER_OPEN_TABS_UI_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/ref_counted_memory.h"
14 #include "components/sessions/session_id.h"
15 #include "components/sessions/session_types.h"
16 #include "components/sync_driver/glue/synced_session.h"
18 namespace sync_driver {
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;
28 // Builds a list of all foreign sessions, ordered from most recent to least
29 // recent. Caller does NOT own SyncedSession objects.
30 // Returns true if foreign sessions were found, false otherwise.
31 virtual bool GetAllForeignSessions(
32 std::vector<const SyncedSession*>* sessions) = 0;
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 sessions::SessionTab** tab) = 0;
41 // Delete a foreign session and all its sync data.
42 virtual void DeleteForeignSession(const std::string& tag) = 0;
44 // Loads all windows for foreign session with session tag |tag|. Caller does
45 // NOT own SessionWindow 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 sessions::SessionWindow*>* windows) = 0;
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;
60 // Sets |*local| to point to the sessions sync representation of the
61 // local machine.
62 virtual bool GetLocalSession(const SyncedSession** local) = 0;
64 protected:
65 virtual ~OpenTabsUIDelegate();
68 } // namespace sync_driver
70 #endif // COMPONENTS_SYNC_DRIVER_OPEN_TABS_UI_DELEGATE_H_