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

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

Issue 7714007: Apply content-security-policy directive to chrome://workers page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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/workers_ui.cc
===================================================================
--- chrome/browser/ui/webui/workers_ui.cc (revision 97885)
+++ chrome/browser/ui/webui/workers_ui.cc (working copy)
@@ -34,26 +34,23 @@
namespace {
-class WorkersUIHTMLSource : public ChromeURLDataManager::DataSource {
+class WorkersUIHTMLSource : public ChromeWebUIDataSource {
public:
WorkersUIHTMLSource();
virtual void StartDataRequest(const std::string& path,
bool is_incognito,
int request_id);
-
- virtual std::string GetMimeType(const std::string&) const;
-
private:
~WorkersUIHTMLSource() {}
-
void SendSharedWorkersData(int request_id);
-
DISALLOW_COPY_AND_ASSIGN(WorkersUIHTMLSource);
};
WorkersUIHTMLSource::WorkersUIHTMLSource()
- : DataSource(chrome::kChromeUIWorkersHost, NULL) {
+ : ChromeWebUIDataSource(chrome::kChromeUIWorkersHost, NULL) {
+ add_resource_path("workers.js", IDR_WORKERS_INDEX_JS);
+ set_default_resource(IDR_WORKERS_INDEX_HTML);
}
void WorkersUIHTMLSource::StartDataRequest(const std::string& path,
@@ -62,23 +59,10 @@
if (path == kWorkersDataFile) {
SendSharedWorkersData(request_id);
} else {
- int idr = IDR_WORKERS_INDEX_HTML;
- scoped_refptr<RefCountedStaticMemory> response(
- ResourceBundle::GetSharedInstance().LoadDataResourceBytes(idr));
- SendResponse(request_id, response);
+ ChromeWebUIDataSource::StartDataRequest(path, is_incognito, request_id);
}
}
-std::string WorkersUIHTMLSource::GetMimeType(const std::string& path) const {
- if (EndsWith(path, ".css", false))
- return "text/css";
- if (EndsWith(path, ".js", false))
- return "application/javascript";
- if (EndsWith(path, ".json", false))
- return "plain/text";
- return "text/html";
-}
-
void WorkersUIHTMLSource::SendSharedWorkersData(int request_id) {
ListValue workers_list;
BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS);

Powered by Google App Engine
This is Rietveld 408576698