summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-21 19:37:06 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-21 19:37:06 +0000
commita9f56629c59ad46837dc2b83444ac4578280ffa8 (patch)
treed27d41c5327cc38ab90094614f97afee9b892460 /chrome/browser/sync/glue
parent72ca2f71ab6843b124383ab7b81f4da4bd702c03 (diff)
downloadchromium_src-a9f56629c59ad46837dc2b83444ac4578280ffa8.zip
chromium_src-a9f56629c59ad46837dc2b83444ac4578280ffa8.tar.gz
chromium_src-a9f56629c59ad46837dc2b83444ac4578280ffa8.tar.bz2
sync: Add --enable-sync-sessions-v2 and necessary plumbing to use SessionsSyncManager.
Not a fully working solution as SSM doesn't listen to session changes after the initial association, but does work across restarts. Adds OpenTabsUIDelegate to a) reduce SessionModelAssociator proliferation and b) allow swapping in a SessionsSyncManager if the command line flag is passed. The changes in non sync/ files are basically s/SessionModelAssociator/OpenTabsUIDelegate. There are a few places I didn't make that change yet (such as OnSyncCycleComplete in ProfileSyncService), which I'll have to do in a follow up as SSM supports more of the bells-and-whistles in session sync. BUG=98892 R=pkasting@chromium.org, rlarocque@chromium.org, yfriedman@chromium.org TBR=tburkard@chromium.org, asargent@chromium.org, yfriedman@chromium.org, dbeam@chromium.org, pkasting@chromium.org for chrome/browser/prerender for chrome/browser/extensions/api for chrome/browser/android and chrome/browser/ui/webui/ntp/android for chrome/browser/ui/webui/ntp for remainder of chrome/browser/ui Review URL: https://codereview.chromium.org/74653002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue')
-rw-r--r--chrome/browser/sync/glue/session_model_associator.h39
1 files changed, 14 insertions, 25 deletions
diff --git a/chrome/browser/sync/glue/session_model_associator.h b/chrome/browser/sync/glue/session_model_associator.h
index 54561ce..a4d500b 100644
--- a/chrome/browser/sync/glue/session_model_associator.h
+++ b/chrome/browser/sync/glue/session_model_associator.h
@@ -24,6 +24,7 @@
#include "chrome/browser/sync/glue/model_associator.h"
#include "chrome/browser/sync/glue/synced_session_tracker.h"
#include "chrome/browser/sync/glue/tab_node_pool.h"
+#include "chrome/browser/sync/open_tabs_ui_delegate.h"
#include "sync/internal_api/public/base/model_type.h"
class PrefServiceSyncable;
@@ -54,6 +55,7 @@ class SyncedWindowDelegate;
// the sync sessions model.
class SessionModelAssociator
: public AssociatorInterface,
+ public OpenTabsUIDelegate,
public base::SupportsWeakPtr<SessionModelAssociator>,
public base::NonThreadSafe {
public:
@@ -147,24 +149,6 @@ class SessionModelAssociator
// local machine. Used primarily for testing.
bool GetLocalSession(const SyncedSession* * local_session);
- // Builds a list of all foreign sessions. Caller does NOT own SyncedSession
- // objects.
- // Returns true if foreign sessions were found, false otherwise.
- bool GetAllForeignSessions(std::vector<const SyncedSession*>* sessions);
-
- // Loads all windows for foreign session with session tag |tag|. Caller does
- // NOT own SyncedSession objects.
- // Returns true if the foreign session was found, false otherwise.
- bool GetForeignSession(const std::string& tag,
- std::vector<const SessionWindow*>* windows);
-
- // Looks up the foreign tab identified by |tab_id| and belonging to foreign
- // session |tag|. Caller does NOT own the SessionTab object.
- // Returns true if the foreign session and tab were found, false otherwise.
- bool GetForeignTab(const std::string& tag,
- const SessionID::id_type tab_id,
- const SessionTab** tab);
-
// Triggers garbage collection of stale sessions (as defined by
// |stale_session_threshold_days_|). This is called automatically every
// time we start up (via AssociateModels).
@@ -174,9 +158,6 @@ class SessionModelAssociator
// stale.
void SetStaleSessionThreshold(size_t stale_session_threshold_days);
- // Delete a foreign session and all its sync data.
- void DeleteForeignSession(const std::string& tag);
-
// Control which local tabs we're interested in syncing.
// Ensures the profile matches sync's profile and that the tab has valid
// entries.
@@ -194,11 +175,19 @@ class SessionModelAssociator
// first.
void BlockUntilLocalChangeForTest(base::TimeDelta timeout);
- // If a valid favicon for the page at |url| is found, fills |favicon_png| with
- // the png-encoded image and returns true. Else, returns false.
- bool GetSyncedFaviconForPageURL(
+ // OpenTabsUIDelegate implementation.
+ virtual bool GetSyncedFaviconForPageURL(
const std::string& pageurl,
- scoped_refptr<base::RefCountedMemory>* favicon_png) const;
+ scoped_refptr<base::RefCountedMemory>* favicon_png) const OVERRIDE;
+ virtual bool GetAllForeignSessions(
+ std::vector<const SyncedSession*>* sessions) OVERRIDE;
+ virtual bool GetForeignSession(
+ const std::string& tag,
+ std::vector<const SessionWindow*>* windows) OVERRIDE;
+ virtual bool GetForeignTab(const std::string& tag,
+ const SessionID::id_type tab_id,
+ const SessionTab** tab) OVERRIDE;
+ virtual void DeleteForeignSession(const std::string& tag) OVERRIDE;
void SetCurrentMachineTagForTesting(const std::string& machine_tag) {
current_machine_tag_ = machine_tag;