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

Unified Diff: chrome/browser/ui/browser.cc

Issue 9169096: Remove a bunch of GetProfileSyncService callers to use the new factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 731cfb7ab50328adc88062822a15202b522f8dac..428b5bf0f7c9f0311cf9cce6079622dbbdbcd986 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -88,6 +88,7 @@
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_closeable_state_watcher.h"
#include "chrome/browser/tab_contents/background_contents.h"
@@ -396,8 +397,10 @@ Browser::Browser(Type type, Profile* profile)
TabRestoreServiceChanged(tab_restore_service_);
}
- if (profile_->GetProfileSyncService())
- profile_->GetProfileSyncService()->AddObserver(this);
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
+ if (service)
+ service->AddObserver(this);
CreateInstantIfNecessary();
@@ -412,8 +415,10 @@ Browser::Browser(Type type, Profile* profile)
}
Browser::~Browser() {
- if (profile_->GetProfileSyncService())
- profile_->GetProfileSyncService()->RemoveObserver(this);
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
+ if (service)
+ service->RemoveObserver(this);
BrowserList::RemoveBrowser(this);
@@ -4365,7 +4370,8 @@ void Browser::Observe(int type,
// Browser, ProfileSyncServiceObserver implementation:
void Browser::OnStateChanged() {
- DCHECK(profile_->GetProfileSyncService());
+ DCHECK(ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
+ profile_));
// For unit tests, we don't have a window.
if (!window_)
return;
@@ -5466,7 +5472,8 @@ void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) {
void Browser::ShowSyncSetup() {
ProfileSyncService* service =
- profile()->GetOriginalProfile()->GetProfileSyncService();
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ profile()->GetOriginalProfile());
if (service->HasSyncSetupCompleted())
ShowOptionsTab(chrome::kPersonalOptionsSubPage);
else

Powered by Google App Engine
This is Rietveld 408576698