OLD | NEW |
(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/options/profiles_delete_handler.h" |
| 6 |
| 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" |
| 9 #include "base/value_conversions.h" |
| 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/profiles/profile_info_cache.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "grit/chromium_strings.h" |
| 15 #include "grit/generated_resources.h" |
| 16 #include "ui/base/l10n/l10n_util.h" |
| 17 |
| 18 ProfilesDeleteHandler::ProfilesDeleteHandler() { |
| 19 } |
| 20 |
| 21 ProfilesDeleteHandler::~ProfilesDeleteHandler() { |
| 22 } |
| 23 |
| 24 void ProfilesDeleteHandler::GetLocalizedValues( |
| 25 DictionaryValue* localized_strings) { |
| 26 DCHECK(localized_strings); |
| 27 localized_strings->SetString("profilesDeleteTitle", |
| 28 l10n_util::GetStringUTF16(IDS_PROFILES_DELETE_TITLE)); |
| 29 localized_strings->SetString("profilesDeleteOK", |
| 30 l10n_util::GetStringUTF16(IDS_PROFILES_DELETE_OK_BUTTON_LABEL)); |
| 31 localized_strings->SetString("profilesDeleteCancel", |
| 32 l10n_util::GetStringUTF16(IDS_CANCEL)); |
| 33 localized_strings->SetString("profilesDeleteMessage", |
| 34 l10n_util::GetStringUTF16(IDS_PROFILES_DELETE_MESSAGE)); |
| 35 } |
| 36 |
| 37 void ProfilesDeleteHandler::RegisterMessages() { |
| 38 DCHECK(web_ui_); |
| 39 web_ui_->RegisterMessageCallback("deleteProfile", |
| 40 NewCallback(this, &ProfilesDeleteHandler::DeleteProfile)); |
| 41 } |
| 42 |
| 43 void ProfilesDeleteHandler::DeleteProfile(const ListValue* args) { |
| 44 Value* file_path_value; |
| 45 FilePath profile_file_path; |
| 46 if (!args->Get(0, &file_path_value) || |
| 47 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) { |
| 48 return; |
| 49 } |
| 50 |
| 51 g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
| 52 profile_file_path); |
| 53 } |
| 54 |
OLD | NEW |