summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 20:09:13 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 20:09:13 +0000
commit5e61afb935ec49bda9c3a1ef33fc11eaae242beb (patch)
tree8f6ce2ee74bffaaf7680fceb6b65fdf9c6c11f2f /chrome/browser/ui/webui
parentb7df4e2be5517bc7914152609e957b77dbcfb26f (diff)
downloadchromium_src-5e61afb935ec49bda9c3a1ef33fc11eaae242beb.zip
chromium_src-5e61afb935ec49bda9c3a1ef33fc11eaae242beb.tar.gz
chromium_src-5e61afb935ec49bda9c3a1ef33fc11eaae242beb.tar.bz2
Remove a bunch of GetProfileSyncService callers to use the new factory.
This is mostly everything except code under /sync or sync_internals (those require a little more time as they have unit test implications). The ones here are quite simple but need several owner-approvals, and given the upcoming 18 branch I'd like to get this landed without a cross-team monday crunch :) TBR=jhawkins@chromium.org TBR=mirandac@chromium.org TBR=isherman@chromium.org TBR=nkostylev@chromium.org TBR=estade@chromium.org BUG=93922 Review URL: http://codereview.chromium.org/9169096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui')
-rw-r--r--chrome/browser/ui/webui/ntp/foreign_session_handler.cc7
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc7
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_login_handler.cc6
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_resource_cache.cc3
-rw-r--r--chrome/browser/ui/webui/options/options_sync_setup_handler.cc7
-rw-r--r--chrome/browser/ui/webui/options/personal_options_handler.cc14
-rw-r--r--chrome/browser/ui/webui/options/stop_syncing_handler.cc7
-rw-r--r--chrome/browser/ui/webui/options2/browser_options_handler2.cc12
-rw-r--r--chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc11
-rw-r--r--chrome/browser/ui/webui/options2/stop_syncing_handler2.cc7
-rw-r--r--chrome/browser/ui/webui/sessions_ui.cc6
11 files changed, 52 insertions, 35 deletions
diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
index daa8a8d..f7c7317 100644
--- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
+++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,6 +16,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
@@ -74,8 +75,8 @@ void ForeignSessionHandler::Observe(
}
SessionModelAssociator* ForeignSessionHandler::GetModelAssociator() {
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
if (service == NULL)
return NULL;
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
index 5a33bb2..aba9c8f 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,8 @@
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/public/browser/web_ui.h"
@@ -56,7 +58,8 @@ NewTabPageSyncHandler::MessageType
}
void NewTabPageSyncHandler::RegisterMessages() {
- sync_service_ = Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ sync_service_ = ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ Profile::FromWebUI(web_ui()));
DCHECK(sync_service_); // This shouldn't get called by an incognito NTP.
DCHECK(!sync_service_->IsManaged()); // And neither if sync is managed.
sync_service_->AddObserver(this);
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index f429b79..8b95675 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,6 +20,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/sync_setup_flow.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
@@ -174,7 +175,8 @@ void NTPLoginHandler::HandleLoginMessageSeen(const ListValue* args) {
}
void NTPLoginHandler::HandleShowAdvancedLoginUI(const ListValue* args) {
- Profile::FromWebUI(web_ui())->GetProfileSyncService()->ShowConfigure(false);
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ Profile::FromWebUI(web_ui()))->ShowConfigure(false);
}
void NTPLoginHandler::UpdateLogin() {
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index f8ed702..cb1def5 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
@@ -339,7 +340,7 @@ void NTPResourceCache::CreateNewTabHTML() {
// Don't initiate the sync related message passing with the page if the sync
// code is not present.
- if (profile_->GetProfileSyncService())
+ if (ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_))
localized_strings.SetString("syncispresent", "true");
else
localized_strings.SetString("syncispresent", "false");
diff --git a/chrome/browser/ui/webui/options/options_sync_setup_handler.cc b/chrome/browser/ui/webui/options/options_sync_setup_handler.cc
index 75f9166..af88e2c 100644
--- a/chrome/browser/ui/webui/options/options_sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/options/options_sync_setup_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "content/public/browser/web_ui.h"
OptionsSyncSetupHandler::OptionsSyncSetupHandler(
@@ -16,8 +17,8 @@ OptionsSyncSetupHandler::~OptionsSyncSetupHandler() {
}
void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
DCHECK(service);
// We should bring up either a login or a configure flow based on the state of
diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc
index 34b0ad1..9442a23 100644
--- a/chrome/browser/ui/webui/options/personal_options_handler.cc
+++ b/chrome/browser/ui/webui/options/personal_options_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,6 +23,7 @@
#include "chrome/browser/profiles/profile_info_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/sync_setup_flow.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/themes/theme_service.h"
@@ -65,8 +66,8 @@ PersonalOptionsHandler::PersonalOptionsHandler() {
}
PersonalOptionsHandler::~PersonalOptionsHandler() {
- ProfileSyncService* sync_service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* sync_service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
if (sync_service)
sync_service->RemoveObserver(this);
}
@@ -251,8 +252,8 @@ void PersonalOptionsHandler::Observe(
void PersonalOptionsHandler::OnStateChanged() {
string16 status_label;
string16 link_label;
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
DCHECK(service);
bool managed = service->IsManaged();
bool sync_setup_completed = service->HasSyncSetupCompleted();
@@ -369,7 +370,8 @@ void PersonalOptionsHandler::Initialize() {
content::NotificationService::AllSources());
ObserveThemeChanged();
- ProfileSyncService* sync_service = profile->GetProfileSyncService();
+ ProfileSyncService* sync_service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(profile));
if (sync_service) {
sync_service->AddObserver(this);
OnStateChanged();
diff --git a/chrome/browser/ui/webui/options/stop_syncing_handler.cc b/chrome/browser/ui/webui/options/stop_syncing_handler.cc
index ad04a45..7920df8 100644
--- a/chrome/browser/ui/webui/options/stop_syncing_handler.cc
+++ b/chrome/browser/ui/webui/options/stop_syncing_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_ui.h"
#include "grit/chromium_strings.h"
@@ -45,8 +46,8 @@ void StopSyncingHandler::RegisterMessages() {
}
void StopSyncingHandler::StopSyncing(const ListValue* args){
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
if (service != NULL && ProfileSyncService::IsSyncEnabled()) {
service->DisableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
diff --git a/chrome/browser/ui/webui/options2/browser_options_handler2.cc b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
index 1720519..7f02994 100644
--- a/chrome/browser/ui/webui/options2/browser_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_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_setup_flow.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/themes/theme_service.h"
@@ -95,8 +96,8 @@ BrowserOptionsHandler::BrowserOptionsHandler()
}
BrowserOptionsHandler::~BrowserOptionsHandler() {
- ProfileSyncService* sync_service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* sync_service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
if (sync_service)
sync_service->RemoveObserver(this);
@@ -280,8 +281,8 @@ void BrowserOptionsHandler::RegisterMessages() {
void BrowserOptionsHandler::OnStateChanged() {
string16 status_label;
string16 link_label;
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
DCHECK(service);
bool managed = service->IsManaged();
bool sync_setup_completed = service->HasSyncSetupCompleted();
@@ -371,7 +372,8 @@ void BrowserOptionsHandler::OnStateChanged() {
void BrowserOptionsHandler::Initialize() {
Profile* profile = Profile::FromWebUI(web_ui());
- ProfileSyncService* sync_service = profile->GetProfileSyncService();
+ ProfileSyncService* sync_service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
if (sync_service) {
sync_service->AddObserver(this);
OnStateChanged();
diff --git a/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc b/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc
index 7f12258..3824ad5 100644
--- a/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc
+++ b/chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "content/public/browser/web_ui.h"
namespace options2 {
@@ -18,8 +19,8 @@ OptionsSyncSetupHandler::~OptionsSyncSetupHandler() {
}
void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
DCHECK(service);
// We should bring up either a login or a configure flow based on the state of
@@ -36,8 +37,8 @@ void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
}
void OptionsSyncSetupHandler::ShowSetupUI() {
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
DCHECK(service);
// The user is trying to manually load a syncSetup URL. We should bring up
diff --git a/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc b/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc
index 3678535..3363f2c 100644
--- a/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc
+++ b/chrome/browser/ui/webui/options2/stop_syncing_handler2.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_ui.h"
#include "grit/chromium_strings.h"
@@ -47,8 +48,8 @@ void StopSyncingHandler::RegisterMessages() {
}
void StopSyncingHandler::StopSyncing(const ListValue* args){
- ProfileSyncService* service =
- Profile::FromWebUI(web_ui())->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
if (service != NULL && ProfileSyncService::IsSyncEnabled()) {
service->DisableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
diff --git a/chrome/browser/ui/webui/sessions_ui.cc b/chrome/browser/ui/webui/sessions_ui.cc
index bfaddf7..9e5665f 100644
--- a/chrome/browser/ui/webui/sessions_ui.cc
+++ b/chrome/browser/ui/webui/sessions_ui.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "chrome/browser/sync/glue/session_model_associator.h"
#include "chrome/browser/sync/glue/synced_session.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
@@ -127,7 +128,8 @@ browser_sync::SessionModelAssociator* SessionsDOMHandler::GetModelAssociator() {
Profile* profile = Profile::FromWebUI(web_ui());
if (!profile->HasProfileSyncService())
return NULL;
- ProfileSyncService* service = profile->GetProfileSyncService();
+ ProfileSyncService* service(ProfileSyncServiceFactory::
+ GetInstance()->GetForProfile(profile));
if (!service->ShouldPushChanges())
return NULL;
return service->GetSessionModelAssociator();