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

Unified Diff: chrome/browser/ui/webui/media/media_internals_ui.cc

Issue 7638002: Apply content-security-policy directive to chrome://media-internals (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
« no previous file with comments | « chrome/browser/resources/media_internals/media_internals.js ('k') | chrome/test/functional/special_tabs.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/media/media_internals_ui.cc
===================================================================
--- chrome/browser/ui/webui/media/media_internals_ui.cc (revision 96277)
+++ chrome/browser/ui/webui/media/media_internals_ui.cc (working copy)
@@ -8,6 +8,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/browser/ui/webui/media/media_internals_handler.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/url_constants.h"
@@ -16,55 +17,16 @@
namespace {
-class MediaInternalsHTMLSource : public ChromeURLDataManager::DataSource {
- public:
- MediaInternalsHTMLSource();
+ChromeWebUIDataSource* CreateMediaInternalsHTMLSource() {
+ ChromeWebUIDataSource* source =
+ new ChromeWebUIDataSource(chrome::kChromeUIMediaInternalsHost);
- // Called when the network layer has requested a resource underneath
- // the path we registered.
- virtual void StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id);
- virtual std::string GetMimeType(const std::string& path) const;
-
- private:
- virtual ~MediaInternalsHTMLSource() {}
- DISALLOW_COPY_AND_ASSIGN(MediaInternalsHTMLSource);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// MediaInternalsHTMLSource
-//
-////////////////////////////////////////////////////////////////////////////////
-
-MediaInternalsHTMLSource::MediaInternalsHTMLSource()
- : DataSource(chrome::kChromeUIMediaInternalsHost, MessageLoop::current()) {
+ source->set_json_path("strings.js");
+ source->add_resource_path("media_internals.js", IDR_MEDIA_INTERNALS_JS);
+ source->set_default_resource(IDR_MEDIA_INTERNALS_HTML);
+ return source;
}
-void MediaInternalsHTMLSource::StartDataRequest(const std::string& path,
- bool is_incognito,
- int request_id) {
- DictionaryValue localized_strings;
- SetFontAndTextDirection(&localized_strings);
-
- base::StringPiece html_template(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_MEDIA_INTERNALS_HTML));
- std::string html(html_template.data(), html_template.size());
- jstemplate_builder::AppendI18nTemplateSourceHtml(&html);
- jstemplate_builder::AppendJsTemplateSourceHtml(&html);
- jstemplate_builder::AppendJsonHtml(&localized_strings, &html);
- jstemplate_builder::AppendI18nTemplateProcessHtml(&html);
-
- SendResponse(request_id, base::RefCountedString::TakeString(&html));
-}
-
-std::string MediaInternalsHTMLSource::GetMimeType(
- const std::string& path) const {
- return "text/html";
-}
-
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -79,5 +41,5 @@
Profile* profile = Profile::FromBrowserContext(contents->browser_context());
profile->GetChromeURLDataManager()->AddDataSource(
- new MediaInternalsHTMLSource());
+ CreateMediaInternalsHTMLSource());
}
« no previous file with comments | « chrome/browser/resources/media_internals/media_internals.js ('k') | chrome/test/functional/special_tabs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698