| Index: chrome/browser/ui/webui/devtools_ui.cc
|
| ===================================================================
|
| --- chrome/browser/ui/webui/devtools_ui.cc (revision 176443)
|
| +++ chrome/browser/ui/webui/devtools_ui.cc (working copy)
|
| @@ -17,6 +17,7 @@
|
| #include "content/public/browser/devtools_client_host.h"
|
| #include "content/public/browser/devtools_http_handler.h"
|
| #include "content/public/browser/render_view_host.h"
|
| +#include "content/public/browser/url_data_source_delegate.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_ui.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| @@ -33,14 +34,16 @@
|
|
|
| } // namespace
|
|
|
| -class DevToolsDataSource : public ChromeURLDataManager::DataSource {
|
| +class DevToolsDataSource : public content::URLDataSourceDelegate {
|
| public:
|
| DevToolsDataSource();
|
|
|
| + // content::URLDataSourceDelegate implementation.
|
| + virtual std::string GetSource() OVERRIDE;
|
| virtual void StartDataRequest(const std::string& path,
|
| bool is_incognito,
|
| - int request_id);
|
| - virtual std::string GetMimeType(const std::string& path) const;
|
| + int request_id) OVERRIDE;
|
| + virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
|
|
|
| private:
|
| ~DevToolsDataSource() {}
|
| @@ -48,10 +51,13 @@
|
| };
|
|
|
|
|
| -DevToolsDataSource::DevToolsDataSource()
|
| - : DataSource(chrome::kChromeUIDevToolsHost, NULL) {
|
| +DevToolsDataSource::DevToolsDataSource() {
|
| }
|
|
|
| +std::string DevToolsDataSource::GetSource() {
|
| + return chrome::kChromeUIDevToolsHost;
|
| +}
|
| +
|
| void DevToolsDataSource::StartDataRequest(const std::string& path,
|
| bool is_incognito,
|
| int request_id) {
|
| @@ -67,7 +73,7 @@
|
| const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(
|
| resource_id));
|
| - SendResponse(request_id, bytes);
|
| + url_data_source()->SendResponse(request_id, bytes);
|
| }
|
|
|
| std::string DevToolsDataSource::GetMimeType(const std::string& path) const {
|
| @@ -92,16 +98,14 @@
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| static bool registered = false;
|
| if (!registered) {
|
| - DevToolsDataSource* data_source = new DevToolsDataSource();
|
| - ChromeURLDataManager::AddDataSource(profile, data_source);
|
| + ChromeURLDataManager::AddDataSource(profile, new DevToolsDataSource);
|
| registered = true;
|
| }
|
| }
|
|
|
| DevToolsUI::DevToolsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
|
| - DevToolsDataSource* data_source = new DevToolsDataSource();
|
| - Profile* profile = Profile::FromWebUI(web_ui);
|
| - ChromeURLDataManager::AddDataSource(profile, data_source);
|
| + ChromeURLDataManager::AddDataSource(
|
| + Profile::FromWebUI(web_ui), new DevToolsDataSource);
|
| }
|
|
|
| void DevToolsUI::RenderViewCreated(
|
|
|