Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1062)

Unified Diff: components/sync_sessions/synced_tab_delegate.h

Issue 1408643002: [Sync] Componentize synced_tab_delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN, self review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync_sessions/synced_tab_delegate.h
diff --git a/chrome/browser/sync/glue/synced_tab_delegate.h b/components/sync_sessions/synced_tab_delegate.h
similarity index 52%
rename from chrome/browser/sync/glue/synced_tab_delegate.h
rename to components/sync_sessions/synced_tab_delegate.h
index b026c53727c4ff0b934a7d93a3f2cd5db8d3a6ae..ba6768fa58790c6080888f6c7b7d9200b2f07f59 100644
--- a/chrome/browser/sync/glue/synced_tab_delegate.h
+++ b/components/sync_sessions/synced_tab_delegate.h
@@ -2,21 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__
-#define CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__
+#ifndef COMPONENTS_SYNC_SESSIONS_SYNCED_TAB_DELEGATE_H__
+#define COMPONENTS_SYNC_SESSIONS_SYNCED_TAB_DELEGATE_H__
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
+#include "components/sessions/core/serialized_navigation_entry.h"
#include "components/sessions/core/session_id.h"
#include "components/sync_driver/sessions/synced_window_delegates_getter.h"
+#include "ui/base/page_transition_types.h"
skym 2015/10/16 16:55:47 Errr, what? I thought ui/ dependencies in componen
Nicolas Zea 2015/10/20 23:14:42 We can include ui/, just not content/ or chrome/
+#include "url/gurl.h"
class Profile;
-namespace content {
-class NavigationEntry;
-class WebContents;
+namespace sync_sessions {
+class SyncSessionsClient;
}
namespace browser_sync {
@@ -29,63 +31,47 @@ class SyncedTabDelegate {
virtual ~SyncedTabDelegate();
// Methods from TabContents.
-
virtual SessionID::id_type GetWindowId() const = 0;
virtual SessionID::id_type GetSessionId() const = 0;
virtual bool IsBeingDestroyed() const = 0;
- virtual Profile* profile() const = 0;
// Method derived from extensions TabHelper.
-
virtual std::string GetExtensionAppId() const = 0;
// Methods from NavigationController.
virtual bool IsInitialBlankNavigation() const = 0;
virtual int GetCurrentEntryIndex() const = 0;
virtual int GetEntryCount() const = 0;
- virtual int GetPendingEntryIndex() const = 0;
- virtual content::NavigationEntry* GetPendingEntry() const = 0;
- virtual content::NavigationEntry* GetEntryAtIndex(int i) const = 0;
- virtual content::NavigationEntry* GetActiveEntry() const = 0;
-
- // The idea here is that GetEntryAtIndex may not always return the pending
- // entry when asked for the entry at the pending index. These convinience
- // methods will check for this case and then call the correct entry accessor.
- content::NavigationEntry* GetCurrentEntryMaybePending() const;
- content::NavigationEntry* GetEntryAtIndexMaybePending(int i) const;
+ virtual GURL GetVirtualURLAtIndex(int i) const = 0;
+ virtual GURL GetFaviconURLAtIndex(int i) const = 0;
+ virtual ui::PageTransition GetTransitionAtIndex(int i) const = 0;
+ virtual void GetSerializedNavigationAtIndex(
+ int i,
+ sessions::SerializedNavigationEntry* serialized_entry) const = 0;
// Supervised user related methods.
-
virtual bool ProfileIsSupervised() const = 0;
- virtual const std::vector<const content::NavigationEntry*>*
- GetBlockedNavigations() const = 0;
+ virtual const std::vector<const sessions::SerializedNavigationEntry*>*
+ GetBlockedNavigations() const = 0;
virtual bool IsPinned() const = 0;
virtual bool HasWebContents() const = 0;
blundell 2015/10/16 10:41:26 drive-by nit: This method should be renamed, assum
Nicolas Zea 2015/10/20 23:14:42 It is in fact still used (although this made me re
- virtual content::WebContents* GetWebContents() const = 0;
// Session sync related methods.
virtual int GetSyncId() const = 0;
virtual void SetSyncId(int sync_id) = 0;
- // Returns true if this tab should be synchronized.
- bool ShouldSync() const;
-
// Sets the window getter. This must be called before any of the sync or
- // supervised user methods on this class are called. It is currently set when
- // the SyncTabDelegate is retrieved from WebContents via ImplFromWebContents.
+ // supervised user methods on this class are called. It must be set when
+ // the SyncTabDelegate implementation is accessed from Sync.
void SetSyncedWindowGetter(scoped_ptr<SyncedWindowDelegatesGetter> getter);
- // Returns the SyncedTabDelegate associated with WebContents.
- static SyncedTabDelegate* ImplFromWebContents(
- content::WebContents* web_contents);
+ // Get the synced window delegate for this tab.
+ const SyncedWindowDelegate* GetSyncedWindowDelegate() const;
protected:
SyncedTabDelegate();
- // Overridden by the tests to avoid interaction with static state.
- virtual const SyncedWindowDelegate* GetSyncedWindowDelegate() const;
-
private:
// A getter for accessing the associated SyncedWindowDelegate.
scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_;
@@ -93,4 +79,4 @@ class SyncedTabDelegate {
} // namespace browser_sync
-#endif // CHROME_BROWSER_SYNC_GLUE_SYNCED_TAB_DELEGATE_H__
+#endif // COMPONENTS_SYNC_SESSIONS_SYNCED_TAB_DELEGATE_H__

Powered by Google App Engine
This is Rietveld 408576698