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

Unified Diff: chrome/browser/ui/webui/extensions/extension_commands_handler.cc

Issue 10383240: This adds a webui overlay on the extensions page for showing what Extension keybindings are active.… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/extensions/extension_commands_handler.cc
===================================================================
--- chrome/browser/ui/webui/extensions/extension_commands_handler.cc (revision 0)
+++ chrome/browser/ui/webui/extensions/extension_commands_handler.cc (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 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/extensions/extension_commands_handler.h"
+
+#include "base/bind.h"
+#include "base/values.h"
+#include "chrome/browser/extensions/api/commands/extension_command_service.h"
+#include "chrome/browser/extensions/api/commands/extension_command_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/web_ui.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+ExtensionCommandsHandler::ExtensionCommandsHandler() {
+}
+
+ExtensionCommandsHandler::~ExtensionCommandsHandler() {
+}
+
+void ExtensionCommandsHandler::GetLocalizedValues(
+ DictionaryValue* localized_strings) {
+ DCHECK(localized_strings);
+ localized_strings->SetString("extensionCommandsOverlay",
+ l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_DIALOG_TITLE));
+ localized_strings->SetString("extensionCommandsEmpty",
+ l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_EMPTY));
+ localized_strings->SetString("extensionCommandsInactive",
+ l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_INACTIVE));
+ localized_strings->SetString("close", l10n_util::GetStringUTF16(IDS_CLOSE));
+}
+
+void ExtensionCommandsHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback("extensionCommandsRequestExtensionsData",
+ base::Bind(&ExtensionCommandsHandler::HandleRequestExtensionsData,
+ base::Unretained(this)));
+}
+
+void ExtensionCommandsHandler::HandleRequestExtensionsData(
+ const ListValue* args) {
+ DictionaryValue results;
+
+ Profile* profile = Profile::FromWebUI(web_ui());
+ ExtensionCommandService* command_service =
+ ExtensionCommandServiceFactory::GetForProfile(profile);
+ command_service->GetAllCommands(&results);
+
+ web_ui()->CallJavascriptFunction(
+ "ExtensionCommandsOverlay.returnExtensionsData", results);
+}
Property changes on: chrome\browser\ui\webui\extensions\extension_commands_handler.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698