OLD | NEW |
---|---|
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/install_extension_handler.h" | |
10 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h" | 11 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h" |
11 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" | 12 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
12 #include "chrome/browser/ui/webui/shared_resources_data_source.h" | 13 #include "chrome/browser/ui/webui/shared_resources_data_source.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/web_contents.h" | |
15 #include "content/public/browser/web_ui.h" | 15 #include "content/public/browser/web_ui.h" |
16 #include "grit/browser_resources.h" | 16 #include "grit/browser_resources.h" |
17 | 17 |
18 using content::WebContents; | |
19 | |
20 namespace { | 18 namespace { |
21 | 19 |
22 ChromeWebUIDataSource* CreateExtensionsHTMLSource() { | 20 ChromeWebUIDataSource* CreateExtensionsHTMLSource() { |
23 ChromeWebUIDataSource* source = | 21 ChromeWebUIDataSource* source = |
24 new ChromeWebUIDataSource(chrome::kChromeUIExtensionsFrameHost); | 22 new ChromeWebUIDataSource(chrome::kChromeUIExtensionsFrameHost); |
25 | 23 |
26 source->set_use_json_js_format_v2(); | 24 source->set_use_json_js_format_v2(); |
27 source->set_json_path("strings.js"); | 25 source->set_json_path("strings.js"); |
28 source->add_resource_path("extensions.js", IDR_EXTENSIONS_JS); | 26 source->add_resource_path("extensions.js", IDR_EXTENSIONS_JS); |
29 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS); | 27 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS); |
30 source->set_default_resource(IDR_EXTENSIONS_HTML); | 28 source->set_default_resource(IDR_EXTENSIONS_HTML); |
31 return source; | 29 return source; |
32 } | 30 } |
33 | 31 |
34 } // namespace | 32 } // namespace |
35 | 33 |
36 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 34 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) |
James Hawkins
2012/05/01 23:13:36
This line change appears unnecessary. Can you rev
Aaron Boodman
2012/05/02 00:41:36
Done.
| |
35 : WebUIController(web_ui) { | |
37 Profile* profile = Profile::FromWebUI(web_ui); | 36 Profile* profile = Profile::FromWebUI(web_ui); |
38 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource(); | 37 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource(); |
39 ChromeURLDataManager::AddDataSource(profile, source); | 38 ChromeURLDataManager::AddDataSource(profile, source); |
40 ChromeURLDataManager::AddDataSource(profile, new SharedResourcesDataSource()); | 39 ChromeURLDataManager::AddDataSource(profile, new SharedResourcesDataSource()); |
41 | 40 |
42 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler(); | 41 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler(); |
43 handler->GetLocalizedValues(source->localized_strings()); | 42 handler->GetLocalizedValues(source->localized_strings()); |
44 web_ui->AddMessageHandler(handler); | 43 web_ui->AddMessageHandler(handler); |
45 | 44 |
46 PackExtensionHandler* pack_handler = new PackExtensionHandler(); | 45 PackExtensionHandler* pack_handler = new PackExtensionHandler(); |
47 pack_handler->GetLocalizedValues(source->localized_strings()); | 46 pack_handler->GetLocalizedValues(source->localized_strings()); |
48 web_ui->AddMessageHandler(pack_handler); | 47 web_ui->AddMessageHandler(pack_handler); |
48 | |
49 InstallExtensionHandler* install_extension_handler = | |
50 new InstallExtensionHandler(); | |
51 install_extension_handler->GetLocalizedValues(source->localized_strings()); | |
52 web_ui->AddMessageHandler(install_extension_handler); | |
49 } | 53 } |
50 | 54 |
51 ExtensionsUI::~ExtensionsUI() { | 55 ExtensionsUI::~ExtensionsUI() { |
52 } | 56 } |
OLD | NEW |