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

Unified Diff: chrome/browser/ui/webui/options/profiles_delete_handler.cc

Issue 7400032: Multi-profile WebUI settings (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Notify when deleting profile from cache Created 9 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/profiles_delete_handler.cc
diff --git a/chrome/browser/ui/webui/options/profiles_delete_handler.cc b/chrome/browser/ui/webui/options/profiles_delete_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..37ee9508ce96a3afcf7557c184dc73243af30208
--- /dev/null
+++ b/chrome/browser/ui/webui/options/profiles_delete_handler.cc
@@ -0,0 +1,54 @@
+// 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/ui/webui/options/profiles_delete_handler.h"
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/value_conversions.h"
+#include "base/values.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile_info_cache.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+ProfilesDeleteHandler::ProfilesDeleteHandler() {
+}
+
+ProfilesDeleteHandler::~ProfilesDeleteHandler() {
+}
+
+void ProfilesDeleteHandler::GetLocalizedValues(
+ DictionaryValue* localized_strings) {
+ DCHECK(localized_strings);
+ localized_strings->SetString("profilesDeleteTitle",
+ l10n_util::GetStringUTF16(IDS_PROFILES_DELETE_TITLE));
+ localized_strings->SetString("profilesDeleteOK",
+ l10n_util::GetStringUTF16(IDS_PROFILES_DELETE_OK_BUTTON_LABEL));
+ localized_strings->SetString("profilesDeleteCancel",
+ l10n_util::GetStringUTF16(IDS_CANCEL));
+ localized_strings->SetString("profilesDeleteMessage",
+ l10n_util::GetStringUTF16(IDS_PROFILES_DELETE_MESSAGE));
+}
+
+void ProfilesDeleteHandler::RegisterMessages() {
+ DCHECK(web_ui_);
+ web_ui_->RegisterMessageCallback("deleteProfile",
+ NewCallback(this, &ProfilesDeleteHandler::DeleteProfile));
+}
+
+void ProfilesDeleteHandler::DeleteProfile(const ListValue* args) {
+ Value* file_path_value;
+ FilePath profile_file_path;
+ if (!args->Get(0, &file_path_value) ||
+ !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) {
+ return;
+ }
+
+ g_browser_process->profile_manager()->ScheduleProfileForDeletion(
+ profile_file_path);
+}
+

Powered by Google App Engine
This is Rietveld 408576698