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

Side by Side Diff: chrome/browser/ui/webui/extensions/extensions_ui.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" 5 #include "chrome/browser/ui/webui/extensions/extensions_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 8 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
9 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 9 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
10 #include "chrome/browser/ui/webui/extensions/extension_commands_handler.h"
11 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
10 #include "chrome/browser/ui/webui/extensions/install_extension_handler.h" 12 #include "chrome/browser/ui/webui/extensions/install_extension_handler.h"
11 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h" 13 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h"
12 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
13 #include "chrome/browser/ui/webui/shared_resources_data_source.h" 14 #include "chrome/browser/ui/webui/shared_resources_data_source.h"
14 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
15 #include "content/public/browser/web_ui.h" 16 #include "content/public/browser/web_ui.h"
16 #include "grit/browser_resources.h" 17 #include "grit/browser_resources.h"
17 18
18 namespace { 19 namespace {
19 20
20 ChromeWebUIDataSource* CreateExtensionsHTMLSource() { 21 ChromeWebUIDataSource* CreateExtensionsHTMLSource() {
21 ChromeWebUIDataSource* source = 22 ChromeWebUIDataSource* source =
22 new ChromeWebUIDataSource(chrome::kChromeUIExtensionsFrameHost); 23 new ChromeWebUIDataSource(chrome::kChromeUIExtensionsFrameHost);
23 24
24 source->set_use_json_js_format_v2(); 25 source->set_use_json_js_format_v2();
25 source->set_json_path("strings.js"); 26 source->set_json_path("strings.js");
26 source->add_resource_path("extensions.js", IDR_EXTENSIONS_JS); 27 source->add_resource_path("extensions.js", IDR_EXTENSIONS_JS);
28 source->add_resource_path("extension_command_list.js",
29 IDR_EXTENSION_COMMAND_LIST_JS);
27 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS); 30 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS);
28 source->set_default_resource(IDR_EXTENSIONS_HTML); 31 source->set_default_resource(IDR_EXTENSIONS_HTML);
29 return source; 32 return source;
30 } 33 }
31 34
32 } // namespace 35 } // namespace
33 36
34 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) { 37 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
35 Profile* profile = Profile::FromWebUI(web_ui); 38 Profile* profile = Profile::FromWebUI(web_ui);
36 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource(); 39 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource();
37 ChromeURLDataManager::AddDataSource(profile, source); 40 ChromeURLDataManager::AddDataSource(profile, source);
38 ChromeURLDataManager::AddDataSource(profile, new SharedResourcesDataSource()); 41 ChromeURLDataManager::AddDataSource(profile, new SharedResourcesDataSource());
39 42
40 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler(); 43 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler();
41 handler->GetLocalizedValues(source->localized_strings()); 44 handler->GetLocalizedValues(source->localized_strings());
42 web_ui->AddMessageHandler(handler); 45 web_ui->AddMessageHandler(handler);
43 46
44 PackExtensionHandler* pack_handler = new PackExtensionHandler(); 47 PackExtensionHandler* pack_handler = new PackExtensionHandler();
45 pack_handler->GetLocalizedValues(source->localized_strings()); 48 pack_handler->GetLocalizedValues(source->localized_strings());
46 web_ui->AddMessageHandler(pack_handler); 49 web_ui->AddMessageHandler(pack_handler);
47 50
51 ExtensionCommandsHandler* commands_handler = new ExtensionCommandsHandler();
52 commands_handler->GetLocalizedValues(source->localized_strings());
53 web_ui->AddMessageHandler(commands_handler);
54
48 InstallExtensionHandler* install_extension_handler = 55 InstallExtensionHandler* install_extension_handler =
49 new InstallExtensionHandler(); 56 new InstallExtensionHandler();
50 install_extension_handler->GetLocalizedValues(source->localized_strings()); 57 install_extension_handler->GetLocalizedValues(source->localized_strings());
51 web_ui->AddMessageHandler(install_extension_handler); 58 web_ui->AddMessageHandler(install_extension_handler);
52 } 59 }
53 60
54 ExtensionsUI::~ExtensionsUI() { 61 ExtensionsUI::~ExtensionsUI() {
55 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698