blob: ceab2d8ee656953a8d7456e0681297edbec8a7dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright (c) 2010 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 "app/l10n_util.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/profile.h"
#include "chrome/browser/profile_manager.h"
StopSyncingHandler::StopSyncingHandler() {
}
StopSyncingHandler::~StopSyncingHandler() {
}
void StopSyncingHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
DCHECK(localized_strings);
localized_strings->SetString("stop_syncing_explanation",
l10n_util::GetStringFUTF16(IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
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(dom_ui_);
dom_ui_->RegisterMessageCallback("stopSyncing",
NewCallback(this, &StopSyncingHandler::StopSyncing));
}
void StopSyncingHandler::StopSyncing(const ListValue* args){
ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
if (service != NULL && ProfileSyncService::IsSyncEnabled()) {
service->DisableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
}
}
|