OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 COMPONENTS_SYNC_SESSIONS_SYNCED_TAB_DELEGATE_H__ |
| 6 #define COMPONENTS_SYNC_SESSIONS_SYNCED_TAB_DELEGATE_H__ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "components/sessions/core/serialized_navigation_entry.h" |
| 13 #include "components/sessions/core/session_id.h" |
| 14 #include "ui/base/page_transition_types.h" |
| 15 #include "url/gurl.h" |
| 16 |
| 17 class Profile; |
| 18 |
| 19 namespace sync_sessions { |
| 20 class SyncSessionsClient; |
| 21 } |
| 22 |
| 23 namespace browser_sync { |
| 24 |
| 25 // A SyncedTabDelegate is used to insulate the sync code from depending |
| 26 // directly on WebContents, NavigationController, and the extensions TabHelper. |
| 27 class SyncedTabDelegate { |
| 28 public: |
| 29 virtual ~SyncedTabDelegate(); |
| 30 |
| 31 // Methods from TabContents. |
| 32 virtual SessionID::id_type GetWindowId() const = 0; |
| 33 virtual SessionID::id_type GetSessionId() const = 0; |
| 34 virtual bool IsBeingDestroyed() const = 0; |
| 35 |
| 36 // Method derived from extensions TabHelper. |
| 37 virtual std::string GetExtensionAppId() const = 0; |
| 38 |
| 39 // Methods from NavigationController. |
| 40 virtual bool IsInitialBlankNavigation() const = 0; |
| 41 virtual int GetCurrentEntryIndex() const = 0; |
| 42 virtual int GetEntryCount() const = 0; |
| 43 virtual GURL GetVirtualURLAtIndex(int i) const = 0; |
| 44 virtual GURL GetFaviconURLAtIndex(int i) const = 0; |
| 45 virtual ui::PageTransition GetTransitionAtIndex(int i) const = 0; |
| 46 virtual void GetSerializedNavigationAtIndex( |
| 47 int i, |
| 48 sessions::SerializedNavigationEntry* serialized_entry) const = 0; |
| 49 |
| 50 // Supervised user related methods. |
| 51 virtual bool ProfileIsSupervised() const = 0; |
| 52 virtual const std::vector<const sessions::SerializedNavigationEntry*>* |
| 53 GetBlockedNavigations() const = 0; |
| 54 |
| 55 // Session sync related methods. |
| 56 virtual int GetSyncId() const = 0; |
| 57 virtual void SetSyncId(int sync_id) = 0; |
| 58 virtual bool ShouldSync( |
| 59 sync_sessions::SyncSessionsClient* sessions_client) = 0; |
| 60 |
| 61 // Whether this tab is a placeholder tab. On some platforms, tabs can be |
| 62 // restored without bringing all their state into memory, and are just |
| 63 // restored as a placeholder. In that case, the previous synced data from that |
| 64 // tab should be preserved. |
| 65 virtual bool IsPlaceholderTab() const = 0; |
| 66 |
| 67 protected: |
| 68 SyncedTabDelegate(); |
| 69 }; |
| 70 |
| 71 } // namespace browser_sync |
| 72 |
| 73 #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_TAB_DELEGATE_H__ |
OLD | NEW |