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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/extensions/extension_commands_handler.h"
6
7 #include "base/bind.h"
8 #include "base/values.h"
9 #include "chrome/browser/extensions/api/commands/extension_command_service.h"
10 #include "chrome/browser/extensions/api/commands/extension_command_service_facto ry.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "content/public/browser/web_ui.h"
13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h"
15
16 ExtensionCommandsHandler::ExtensionCommandsHandler() {
17 }
18
19 ExtensionCommandsHandler::~ExtensionCommandsHandler() {
20 }
21
22 void ExtensionCommandsHandler::GetLocalizedValues(
23 DictionaryValue* localized_strings) {
24 DCHECK(localized_strings);
25 localized_strings->SetString("extensionCommandsOverlay",
26 l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_DIALOG_TITLE));
27 localized_strings->SetString("extensionCommandsEmpty",
28 l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_EMPTY));
29 localized_strings->SetString("extensionCommandsInactive",
30 l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_INACTIVE));
31 localized_strings->SetString("close", l10n_util::GetStringUTF16(IDS_CLOSE));
32 }
33
34 void ExtensionCommandsHandler::RegisterMessages() {
35 web_ui()->RegisterMessageCallback("extensionCommandsRequestExtensionsData",
36 base::Bind(&ExtensionCommandsHandler::HandleRequestExtensionsData,
37 base::Unretained(this)));
38 }
39
40 void ExtensionCommandsHandler::HandleRequestExtensionsData(
41 const ListValue* args) {
42 DictionaryValue results;
43
44 Profile* profile = Profile::FromWebUI(web_ui());
45 ExtensionCommandService* command_service =
46 ExtensionCommandServiceFactory::GetForProfile(profile);
47 command_service->GetAllCommands(&results);
48
49 web_ui()->CallJavascriptFunction(
50 "ExtensionCommandsOverlay.returnExtensionsData", results);
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698