diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 02:20:50 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 02:20:50 +0000 |
commit | 26fc8b6caa7275e6ffc123391c06dbe0e6a56fb8 (patch) | |
tree | 6c93b80215b70749681239f47c1ebad6abc97b85 | |
parent | 3d182b8904f69705f28aa1d8922a91eb1df411c9 (diff) | |
download | chromium_src-26fc8b6caa7275e6ffc123391c06dbe0e6a56fb8.zip chromium_src-26fc8b6caa7275e6ffc123391c06dbe0e6a56fb8.tar.gz chromium_src-26fc8b6caa7275e6ffc123391c06dbe0e6a56fb8.tar.bz2 |
[Sync] Remove support for legacy tab sync favicons
Tab favicons have been around long enough to remove the need for the legacy
favicon support.
BUG=none
Review URL: https://chromiumcodereview.appspot.com/18867005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210721 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/glue/favicon_cache.cc | 13 | ||||
-rw-r--r-- | chrome/browser/sync/glue/favicon_cache.h | 17 | ||||
-rw-r--r-- | chrome/browser/sync/glue/session_model_associator.cc | 52 | ||||
-rw-r--r-- | chrome/browser/sync/glue/session_model_associator.h | 5 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 |
6 files changed, 0 insertions, 91 deletions
diff --git a/chrome/browser/sync/glue/favicon_cache.cc b/chrome/browser/sync/glue/favicon_cache.cc index 58416fc..92b7917 100644 --- a/chrome/browser/sync/glue/favicon_cache.cc +++ b/chrome/browser/sync/glue/favicon_cache.cc @@ -215,12 +215,9 @@ bool FaviconInfoHasTracking(const SyncedFaviconInfo& favicon_info) { } // namespace -FaviconCacheObserver::~FaviconCacheObserver() {} - FaviconCache::FaviconCache(Profile* profile, int max_sync_favicon_limit) : profile_(profile), weak_ptr_factory_(this), - legacy_delegate_(NULL), max_sync_favicon_limit_(max_sync_favicon_limit) { notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, @@ -581,14 +578,6 @@ void FaviconCache::OnReceivedSyncFaviconImpl( syncer::SyncChange::ACTION_UPDATE)); } -void FaviconCache::SetLegacyDelegate(FaviconCacheObserver* observer) { - legacy_delegate_ = observer; -} - -void FaviconCache::RemoveLegacyDelegate() { - legacy_delegate_ = NULL; -} - void FaviconCache::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { @@ -695,8 +684,6 @@ void FaviconCache::OnFaviconDataAvailable( if (iter->second.new_tracking) tracking_change = syncer::SyncChange::ACTION_ADD; UpdateSyncState(favicon_url, image_change, tracking_change); - if (legacy_delegate_) - legacy_delegate_->OnFaviconUpdated(page_url, favicon_url); // TODO(zea): support multiple favicon urls per page. page_favicon_map_[page_url] = favicon_url; diff --git a/chrome/browser/sync/glue/favicon_cache.h b/chrome/browser/sync/glue/favicon_cache.h index a273aa0..b78cd4c 100644 --- a/chrome/browser/sync/glue/favicon_cache.h +++ b/chrome/browser/sync/glue/favicon_cache.h @@ -43,15 +43,6 @@ enum IconSize { struct SyncedFaviconInfo; -// Observer interface. -class FaviconCacheObserver { - public: - virtual void OnFaviconUpdated(const GURL& page_url, const GURL& icon_url) = 0; - - protected: - virtual ~FaviconCacheObserver(); -}; - // Encapsulates the logic for loading and storing synced favicons. // TODO(zea): make this a BrowserContextKeyedService. class FaviconCache : public syncer::SyncableService, @@ -106,10 +97,6 @@ class FaviconCache : public syncer::SyncableService, const std::string& icon_bytes, int64 visit_time_ms); - // Support for syncing favicons using the legacy format (within tab sync). - void SetLegacyDelegate(FaviconCacheObserver* observer); - void RemoveLegacyDelegate(); - // NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, @@ -232,10 +219,6 @@ class FaviconCache : public syncer::SyncableService, // Weak pointer factory for favicon loads. base::WeakPtrFactory<FaviconCache> weak_ptr_factory_; - // Delegate for legacy favicon sync support. - // TODO(zea): Remove this eventually. - FaviconCacheObserver* legacy_delegate_; - scoped_ptr<syncer::SyncChangeProcessor> favicon_images_sync_processor_; scoped_ptr<syncer::SyncChangeProcessor> favicon_tracking_sync_processor_; diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 8b6dc4e..7204928 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -9,7 +9,6 @@ #include <utility> #include "base/bind.h" -#include "base/command_line.h" #include "base/location.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" @@ -111,9 +110,6 @@ SessionModelAssociator::SessionModelAssociator( DCHECK(CalledOnValidThread()); DCHECK(sync_service_); DCHECK(profile_); - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - if (command_line.HasSwitch(switches::kSyncTabFavicons)) - favicon_cache_.SetLegacyDelegate(this); } SessionModelAssociator::SessionModelAssociator(ProfileSyncService* sync_service, @@ -498,53 +494,6 @@ void SessionModelAssociator::FaviconsUpdated( } } -void SessionModelAssociator::OnFaviconUpdated( - const GURL& page_url, - const GURL& icon_url) { - TabLink* tab_link = NULL; - for (TabLinksMap::const_iterator iter = tab_map_.begin(); - iter != tab_map_.end(); ++iter) { - if (iter->second->url() == page_url) { - tab_link = iter->second.get(); - if (tab_link->sync_id() == syncer::kInvalidId) - continue; - - scoped_refptr<base::RefCountedMemory> favicon_png; - if (!favicon_cache_.GetSyncedFaviconForPageURL(page_url, &favicon_png)) { - LOG(ERROR) << "Unable to look up favicon for page url after " - << "notification"; - } - - // Load the sync tab node and update the favicon data. - syncer::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); - syncer::WriteNode tab_node(&trans); - if (tab_node.InitByIdLookup(tab_link->sync_id()) != - syncer::BaseNode::INIT_OK) { - LOG(WARNING) << "Failed to load sync tab node for url " - << tab_link->url().spec(); - return; - } - sync_pb::SessionSpecifics session_specifics = - tab_node.GetSessionSpecifics(); - DCHECK(session_specifics.has_tab()); - sync_pb::SessionTab* tab = session_specifics.mutable_tab(); - if (favicon_png.get() && favicon_png->size() > 0) { - DVLOG(1) << "Storing session favicon for " - << tab_link->url() << " with size " - << favicon_png->size() << " bytes."; - tab->set_favicon(favicon_png->front(), - favicon_png->size()); - tab->set_favicon_type(sync_pb::SessionTab::TYPE_WEB_FAVICON); - tab->set_favicon_source(icon_url.spec()); - } else { - LOG(WARNING) << "Null favicon stored for url " - << tab_link->url().spec(); - } - tab_node.SetSessionSpecifics(session_specifics); - } - } -} - syncer::SyncError SessionModelAssociator::AssociateModels( syncer::SyncMergeResult* local_merge_result, syncer::SyncMergeResult* syncer_merge_result) { @@ -646,7 +595,6 @@ syncer::SyncError SessionModelAssociator::AssociateModels( syncer::SyncError SessionModelAssociator::DisassociateModels() { DCHECK(CalledOnValidThread()); DVLOG(1) << "Disassociating local session " << GetCurrentMachineTag(); - favicon_cache_.RemoveLegacyDelegate(); synced_session_tracker_.Clear(); tab_map_.clear(); tab_pool_.clear(); diff --git a/chrome/browser/sync/glue/session_model_associator.h b/chrome/browser/sync/glue/session_model_associator.h index 4778c44..ee12be2 100644 --- a/chrome/browser/sync/glue/session_model_associator.h +++ b/chrome/browser/sync/glue/session_model_associator.h @@ -54,7 +54,6 @@ class SyncedWindowDelegate; class SessionModelAssociator : public AssociatorInterface, public base::SupportsWeakPtr<SessionModelAssociator>, - public FaviconCacheObserver, public base::NonThreadSafe { public: // Does not take ownership of sync_service. @@ -82,10 +81,6 @@ class SessionModelAssociator // tag virtual int64 GetSyncIdFromSessionTag(const std::string& tag); - // FaviconCacheObserver interface. - virtual void OnFaviconUpdated(const GURL& page_url, - const GURL& icon_url) OVERRIDE; - // Resync local window information. Updates the local sessions header node // with the status of open windows and the order of tabs they contain. Should // only be called for changes that affect a window, not a change within a diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index fd0e4e1..9eda7bb 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1350,9 +1350,6 @@ const char kSyncNotificationHostPort[] = "sync-notification-host-port"; // Overrides the default server used for profile sync. const char kSyncServiceURL[] = "sync-url"; -// Enables syncing of favicons as part of tab sync. -const char kSyncTabFavicons[] = "sync-tab-favicons"; - // Makes the sync code to throw an unrecoverable error after initialization. // Useful for testing unrecoverable error scenarios. const char kSyncThrowUnrecoverableError[] = "sync-throw-unrecoverable-error"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 9ff6327..d93ddab 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -357,7 +357,6 @@ extern const char kSyncKeystoreEncryption[]; extern const char kSyncShortInitialRetryOverride[]; extern const char kSyncNotificationHostPort[]; extern const char kSyncServiceURL[]; -extern const char kSyncTabFavicons[]; extern const char kSyncThrowUnrecoverableError[]; extern const char kSyncTrySsltcpFirstForXmpp[]; extern const char kSyncEnableDeferredStartup[]; |