From 1ab7761d57f2144fac3f03958e571410b595a2b9 Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Sat, 19 Feb 2011 14:12:23 +0000 Subject: WebUI: Move chrome/browser/dom_ui/options/ to chrome/browser/webui/options. To reduce the size of this change I've left stub header files in chrome/browser/dom_ui/options. I'll updated the references and delete the stub files later. BUG=59945, 59946 TEST=trybots Review URL: http://codereview.chromium.org/6469067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75496 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/webui/options/stop_syncing_handler.cc | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 chrome/browser/webui/options/stop_syncing_handler.cc (limited to 'chrome/browser/webui/options/stop_syncing_handler.cc') diff --git a/chrome/browser/webui/options/stop_syncing_handler.cc b/chrome/browser/webui/options/stop_syncing_handler.cc new file mode 100644 index 0000000..9c0c579 --- /dev/null +++ b/chrome/browser/webui/options/stop_syncing_handler.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2011 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. + +#include "chrome/browser/dom_ui/options/stop_syncing_handler.h" + +#include "base/basictypes.h" +#include "base/values.h" +#include "base/callback.h" +#include "grit/chromium_strings.h" +#include "grit/generated_resources.h" +#include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "ui/base/l10n/l10n_util.h" + +StopSyncingHandler::StopSyncingHandler() { +} + +StopSyncingHandler::~StopSyncingHandler() { +} + +void StopSyncingHandler::GetLocalizedValues( + DictionaryValue* localized_strings) { + DCHECK(localized_strings); + localized_strings->SetString("stop_syncing_explanation", + l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL)); + localized_strings->SetString("stop_syncing_title", + l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE)); + localized_strings->SetString("stop_syncing_confirm", + l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL)); +} + +void StopSyncingHandler::RegisterMessages() { + DCHECK(web_ui_); + web_ui_->RegisterMessageCallback("stopSyncing", + NewCallback(this, &StopSyncingHandler::StopSyncing)); +} + +void StopSyncingHandler::StopSyncing(const ListValue* args){ + ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService(); + if (service != NULL && ProfileSyncService::IsSyncEnabled()) { + service->DisableForUser(); + ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); + } +} -- cgit v1.1