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

Side by Side Diff: chrome/browser/ui/webui/extensions/extensions_ui.cc

Issue 11881055: Simplify WebUI data sources. Currently WebUI data sources implement a URLDataSourceDelegate interfa… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix issue in about_ui exposed by cros tests Created 7 years, 11 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/command_handler.h" 10 #include "chrome/browser/ui/webui/extensions/command_handler.h"
(...skipping 20 matching lines...) Expand all
31 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS); 31 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS);
32 source->set_default_resource(IDR_EXTENSIONS_HTML); 32 source->set_default_resource(IDR_EXTENSIONS_HTML);
33 return source; 33 return source;
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) { 38 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
39 Profile* profile = Profile::FromWebUI(web_ui); 39 Profile* profile = Profile::FromWebUI(web_ui);
40 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource(); 40 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource();
41 ChromeURLDataManager::AddDataSource(profile, source); 41 ChromeURLDataManager::AddDataSourceImpl(profile, source);
42 ChromeURLDataManager::AddDataSource(profile, new SharedResourcesDataSource()); 42 ChromeURLDataManager::AddDataSource(profile, new SharedResourcesDataSource());
43 43
44 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler(); 44 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler();
45 handler->GetLocalizedValues(source->localized_strings()); 45 handler->GetLocalizedValues(source->localized_strings());
46 web_ui->AddMessageHandler(handler); 46 web_ui->AddMessageHandler(handler);
47 47
48 PackExtensionHandler* pack_handler = new PackExtensionHandler(); 48 PackExtensionHandler* pack_handler = new PackExtensionHandler();
49 pack_handler->GetLocalizedValues(source->localized_strings()); 49 pack_handler->GetLocalizedValues(source->localized_strings());
50 web_ui->AddMessageHandler(pack_handler); 50 web_ui->AddMessageHandler(pack_handler);
51 51
52 extensions::CommandHandler* commands_handler = 52 extensions::CommandHandler* commands_handler =
53 new extensions::CommandHandler(profile); 53 new extensions::CommandHandler(profile);
54 commands_handler->GetLocalizedValues(source->localized_strings()); 54 commands_handler->GetLocalizedValues(source->localized_strings());
55 web_ui->AddMessageHandler(commands_handler); 55 web_ui->AddMessageHandler(commands_handler);
56 56
57 InstallExtensionHandler* install_extension_handler = 57 InstallExtensionHandler* install_extension_handler =
58 new InstallExtensionHandler(); 58 new InstallExtensionHandler();
59 install_extension_handler->GetLocalizedValues(source->localized_strings()); 59 install_extension_handler->GetLocalizedValues(source->localized_strings());
60 web_ui->AddMessageHandler(install_extension_handler); 60 web_ui->AddMessageHandler(install_extension_handler);
61 61
62 web_ui->AddMessageHandler(new GenericHandler()); 62 web_ui->AddMessageHandler(new GenericHandler());
63 } 63 }
64 64
65 ExtensionsUI::~ExtensionsUI() { 65 ExtensionsUI::~ExtensionsUI() {
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698