diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-21 19:37:06 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-21 19:37:06 +0000 |
commit | a9f56629c59ad46837dc2b83444ac4578280ffa8 (patch) | |
tree | d27d41c5327cc38ab90094614f97afee9b892460 /chrome/browser/ui/webui | |
parent | 72ca2f71ab6843b124383ab7b81f4da4bd702c03 (diff) | |
download | chromium_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/ui/webui')
-rw-r--r-- | chrome/browser/ui/webui/favicon_source.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/android/promo_handler.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/foreign_session_handler.cc | 30 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/foreign_session_handler.h | 4 |
4 files changed, 28 insertions, 28 deletions
diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index d5744ac..765b804 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -11,7 +11,7 @@ #include "chrome/browser/history/top_sites.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search/instant_io_context.h" -#include "chrome/browser/sync/glue/session_model_associator.h" +#include "chrome/browser/sync/open_tabs_ui_delegate.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/common/favicon/favicon_url_parser.h" @@ -143,13 +143,13 @@ bool FaviconSource::HandleMissingResource(const IconRequest& request) { // If the favicon is not available, try to use the synced favicon. ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); - browser_sync::SessionModelAssociator* associator = sync_service ? - sync_service->GetSessionModelAssociator() : NULL; + browser_sync::OpenTabsUIDelegate* open_tabs = sync_service ? + sync_service->GetOpenTabsUIDelegate() : NULL; scoped_refptr<base::RefCountedMemory> response; - if (associator && - associator->GetSyncedFaviconForPageURL(request.request_path.spec(), - &response)) { + if (open_tabs && + open_tabs->GetSyncedFaviconForPageURL(request.request_path.spec(), + &response)) { request.callback.Run(response.get()); return true; } diff --git a/chrome/browser/ui/webui/ntp/android/promo_handler.cc b/chrome/browser/ui/webui/ntp/android/promo_handler.cc index 4c8ba25c..d5a0bfd 100644 --- a/chrome/browser/ui/webui/ntp/android/promo_handler.cc +++ b/chrome/browser/ui/webui/ntp/android/promo_handler.cc @@ -16,8 +16,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/signin_manager.h" -#include "chrome/browser/sync/glue/session_model_associator.h" #include "chrome/browser/sync/glue/synced_session.h" +#include "chrome/browser/sync/open_tabs_ui_delegate.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/web_resource/notification_promo.h" @@ -312,15 +312,15 @@ void PromoHandler::CheckDesktopSessions() { return; // Check if the sync has any open sessions. - browser_sync::SessionModelAssociator* associator = - service->GetSessionModelAssociator(); - if (!associator) + browser_sync::OpenTabsUIDelegate* open_tabs = + service->GetOpenTabsUIDelegate(); + if (!open_tabs) return; // Let's see if there are no desktop sessions. std::vector<const browser_sync::SyncedSession*> sessions; ListValue session_list; - if (!associator->GetAllForeignSessions(&sessions)) + if (!open_tabs->GetAllForeignSessions(&sessions)) return; for (size_t i = 0; i < sessions.size(); ++i) { diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc index 2167292..9b151ed 100644 --- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc +++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc @@ -71,14 +71,14 @@ void ForeignSessionHandler::OpenForeignSessionTab( SessionID::id_type window_num, SessionID::id_type tab_id, const WindowOpenDisposition& disposition) { - SessionModelAssociator* associator = GetModelAssociator(web_ui); - if (!associator) + OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui); + if (!open_tabs) return; // We don't actually care about |window_num|, this is just a sanity check. DCHECK_LT(kInvalidId, window_num); const SessionTab* tab; - if (!associator->GetForeignTab(session_string_value, tab_id, &tab)) { + if (!open_tabs->GetForeignTab(session_string_value, tab_id, &tab)) { LOG(ERROR) << "Failed to load foreign tab."; return; } @@ -95,15 +95,15 @@ void ForeignSessionHandler::OpenForeignSessionWindows( content::WebUI* web_ui, const std::string& session_string_value, SessionID::id_type window_num) { - SessionModelAssociator* associator = GetModelAssociator(web_ui); - if (!associator) + OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui); + if (!open_tabs) return; std::vector<const SessionWindow*> windows; // Note: we don't own the ForeignSessions themselves. - if (!associator->GetForeignSession(session_string_value, &windows)) { + if (!open_tabs->GetForeignSession(session_string_value, &windows)) { LOG(ERROR) << "ForeignSessionHandler failed to get session data from" - "SessionModelAssociator."; + "OpenTabsUIDelegate."; return; } std::vector<const SessionWindow*>::const_iterator iter_begin = @@ -147,15 +147,15 @@ bool ForeignSessionHandler::SessionTabToValue( } // static -SessionModelAssociator* ForeignSessionHandler::GetModelAssociator( +OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate( content::WebUI* web_ui) { Profile* profile = Profile::FromWebUI(web_ui); ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); - // Only return the associator if it exists and it is done syncing sessions. + // Only return the delegate if it exists and it is done syncing sessions. if (service && service->ShouldPushChanges()) - return service->GetSessionModelAssociator(); + return service->GetOpenTabsUIDelegate(); return NULL; } @@ -226,11 +226,11 @@ string16 ForeignSessionHandler::FormatSessionTime(const base::Time& time) { } void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) { - SessionModelAssociator* associator = GetModelAssociator(web_ui()); + OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui()); std::vector<const SyncedSession*> sessions; ListValue session_list; - if (associator && associator->GetAllForeignSessions(&sessions)) { + if (open_tabs && open_tabs->GetAllForeignSessions(&sessions)) { // Sort sessions from most recent to least recent. std::sort(sessions.begin(), sessions.end(), SortSessionsByRecency); @@ -339,9 +339,9 @@ void ForeignSessionHandler::HandleDeleteForeignSession(const ListValue* args) { return; } - SessionModelAssociator* associator = GetModelAssociator(web_ui()); - if (associator) - associator->DeleteForeignSession(session_tag); + OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui()); + if (open_tabs) + open_tabs->DeleteForeignSession(session_tag); } void ForeignSessionHandler::HandleSetForeignSessionCollapsed( diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.h b/chrome/browser/ui/webui/ntp/foreign_session_handler.h index 25fb14e..443f124 100644 --- a/chrome/browser/ui/webui/ntp/foreign_session_handler.h +++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.h @@ -9,7 +9,7 @@ #include "base/time/time.h" #include "chrome/browser/sessions/session_service.h" -#include "chrome/browser/sync/glue/session_model_associator.h" +#include "chrome/browser/sync/open_tabs_ui_delegate.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_ui.h" @@ -50,7 +50,7 @@ class ForeignSessionHandler : public content::WebUIMessageHandler, DictionaryValue* dictionary); // Returns a pointer to the current session model associator or NULL. - static SessionModelAssociator* GetModelAssociator(content::WebUI* web_ui); + static OpenTabsUIDelegate* GetOpenTabsUIDelegate(content::WebUI* web_ui); private: // Used to register ForeignSessionHandler for notifications. |