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

Unified Diff: chrome/browser/ui/webui/devtools_ui.cc

Issue 11885021: Don't derive from ChromeURLDataManager::DataSource, and instead have these classes implement a dele… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: nits 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 side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698