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

Side by Side Diff: chrome/browser/ui/webui/options/stop_syncing_handler.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: rm todos 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/options/stop_syncing_handler.h" 5 #include "chrome/browser/ui/webui/options/stop_syncing_handler.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/google/google_util.h" 11 #include "chrome/browser/google/google_util.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 14 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/browser/sync/profile_sync_service_factory.h"
15 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
16 #include "content/public/browser/web_ui.h" 17 #include "content/public/browser/web_ui.h"
17 #include "grit/chromium_strings.h" 18 #include "grit/chromium_strings.h"
18 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 21
21 StopSyncingHandler::StopSyncingHandler() { 22 StopSyncingHandler::StopSyncingHandler() {
22 } 23 }
23 24
24 StopSyncingHandler::~StopSyncingHandler() { 25 StopSyncingHandler::~StopSyncingHandler() {
(...skipping 13 matching lines...) Expand all
38 localized_strings->SetString("stopSyncingConfirm", 39 localized_strings->SetString("stopSyncingConfirm",
39 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL)); 40 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL));
40 } 41 }
41 42
42 void StopSyncingHandler::RegisterMessages() { 43 void StopSyncingHandler::RegisterMessages() {
43 web_ui()->RegisterMessageCallback("stopSyncing", 44 web_ui()->RegisterMessageCallback("stopSyncing",
44 base::Bind(&StopSyncingHandler::StopSyncing, base::Unretained(this))); 45 base::Bind(&StopSyncingHandler::StopSyncing, base::Unretained(this)));
45 } 46 }
46 47
47 void StopSyncingHandler::StopSyncing(const ListValue* args){ 48 void StopSyncingHandler::StopSyncing(const ListValue* args){
48 ProfileSyncService* service = 49 ProfileSyncService* service(ProfileSyncServiceFactory::
49 Profile::FromWebUI(web_ui())->GetProfileSyncService(); 50 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
50 if (service != NULL && ProfileSyncService::IsSyncEnabled()) { 51 if (service != NULL && ProfileSyncService::IsSyncEnabled()) {
51 service->DisableForUser(); 52 service->DisableForUser();
52 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); 53 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
53 } 54 }
54 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698