diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 14:12:23 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 14:12:23 +0000 |
commit | 1ab7761d57f2144fac3f03958e571410b595a2b9 (patch) | |
tree | b955a9d1e73f56d953339e852a7402faf9141a09 /chrome/browser/webui/options/stop_syncing_handler.cc | |
parent | c1338959f5d9fa970750a3007c52f3151b877232 (diff) | |
download | chromium_src-1ab7761d57f2144fac3f03958e571410b595a2b9.zip chromium_src-1ab7761d57f2144fac3f03958e571410b595a2b9.tar.gz chromium_src-1ab7761d57f2144fac3f03958e571410b595a2b9.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/webui/options/stop_syncing_handler.cc')
-rw-r--r-- | chrome/browser/webui/options/stop_syncing_handler.cc | 46 |
1 files changed, 46 insertions, 0 deletions
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); + } +} |