| 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_factory.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/pack_extension_handler.h" | 10 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h" |
| 11 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" | 11 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
| 12 #include "chrome/browser/ui/webui/shared_resources_data_source.h" | 12 #include "chrome/browser/ui/webui/shared_resources_data_source.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "content/public/browser/web_contents.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; | 18 using content::WebContents; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS); | 29 source->add_resource_path("extension_list.js", IDR_EXTENSION_LIST_JS); |
| 30 source->set_default_resource(IDR_EXTENSIONS_HTML); | 30 source->set_default_resource(IDR_EXTENSIONS_HTML); |
| 31 return source; | 31 return source; |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 36 ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 37 Profile* profile = Profile::FromWebUI(web_ui); | 37 Profile* profile = Profile::FromWebUI(web_ui); |
| 38 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource(); | 38 ChromeWebUIDataSource* source = CreateExtensionsHTMLSource(); |
| 39 profile->GetChromeURLDataManager()->AddDataSource(source); | 39 ChromeURLDataManagerFactory::GetForProfile(profile)->AddDataSource(source); |
| 40 profile->GetChromeURLDataManager()->AddDataSource( | 40 ChromeURLDataManagerFactory::GetForProfile(profile)-> |
| 41 new SharedResourcesDataSource()); | 41 AddDataSource(new SharedResourcesDataSource()); |
| 42 | 42 |
| 43 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler(); | 43 ExtensionSettingsHandler* handler = new ExtensionSettingsHandler(); |
| 44 handler->GetLocalizedValues(source->localized_strings()); | 44 handler->GetLocalizedValues(source->localized_strings()); |
| 45 web_ui->AddMessageHandler(handler); | 45 web_ui->AddMessageHandler(handler); |
| 46 | 46 |
| 47 PackExtensionHandler* pack_handler = new PackExtensionHandler(); | 47 PackExtensionHandler* pack_handler = new PackExtensionHandler(); |
| 48 pack_handler->GetLocalizedValues(source->localized_strings()); | 48 pack_handler->GetLocalizedValues(source->localized_strings()); |
| 49 web_ui->AddMessageHandler(pack_handler); | 49 web_ui->AddMessageHandler(pack_handler); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ExtensionsUI::~ExtensionsUI() { | 52 ExtensionsUI::~ExtensionsUI() { |
| 53 } | 53 } |
| OLD | NEW |