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

Side by Side Diff: chrome/browser/ui/webui/options2/stop_syncing_handler.cc

Issue 8937011: Revert "Options2: Pull the trigger." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/options2/stop_syncing_handler.h"
6
7 #include "base/basictypes.h"
8 #include "base/bind.h"
9 #include "base/utf_string_conversions.h"
10 #include "base/values.h"
11 #include "chrome/browser/google/google_util.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/common/url_constants.h"
16 #include "grit/chromium_strings.h"
17 #include "grit/generated_resources.h"
18 #include "ui/base/l10n/l10n_util.h"
19
20 StopSyncingHandler::StopSyncingHandler() {
21 }
22
23 StopSyncingHandler::~StopSyncingHandler() {
24 }
25
26 void StopSyncingHandler::GetLocalizedValues(
27 DictionaryValue* localized_strings) {
28 DCHECK(localized_strings);
29 localized_strings->SetString("stopSyncingExplanation",
30 l10n_util::GetStringFUTF16(
31 IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL,
32 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
33 ASCIIToUTF16(google_util::StringAppendGoogleLocaleParam(
34 chrome::kSyncGoogleDashboardURL))));
35 localized_strings->SetString("stopSyncingTitle",
36 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE));
37 localized_strings->SetString("stopSyncingConfirm",
38 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL));
39 }
40
41 void StopSyncingHandler::RegisterMessages() {
42 DCHECK(web_ui_);
43 web_ui_->RegisterMessageCallback("stopSyncing",
44 base::Bind(&StopSyncingHandler::StopSyncing, base::Unretained(this)));
45 }
46
47 void StopSyncingHandler::StopSyncing(const ListValue* args){
48 ProfileSyncService* service =
49 Profile::FromWebUI(web_ui_)->GetProfileSyncService();
50 if (service != NULL && ProfileSyncService::IsSyncEnabled()) {
51 service->DisableForUser();
52 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
53 }
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698