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

Unified Diff: chrome/browser/dom_ui/net_internals_ui.cc

Issue 5228004: Switch the about:gpu implementation from an about handler to dom_ui.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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/dom_ui/gpu_internals_ui.cc ('k') | chrome/browser/resources/gpu_internals.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/net_internals_ui.cc
===================================================================
--- chrome/browser/dom_ui/net_internals_ui.cc (revision 68554)
+++ chrome/browser/dom_ui/net_internals_ui.cc (working copy)
@@ -32,6 +32,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_version_info.h"
+#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
@@ -319,6 +320,9 @@
void NetInternalsHTMLSource::StartDataRequest(const std::string& path,
bool is_off_the_record,
int request_id) {
+ DictionaryValue localized_strings;
+ SetFontAndTextDirection(&localized_strings);
+
// The provided "path" may contain a fragment, or query section. We only
// care about the path itself, and will disregard anything else.
std::string filename =
@@ -329,13 +333,20 @@
// Note that users can type anything into the address bar, though, so we must
// handle arbitrary input.
if (filename.empty() || filename == "index.html") {
- scoped_refptr<RefCountedStaticMemory> bytes(
- ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
+ base::StringPiece html(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_NET_INTERNALS_INDEX_HTML));
- if (bytes && bytes->front()) {
- SendResponse(request_id, bytes);
- return;
- }
+ std::string full_html(html.data(), html.size());
+ jstemplate_builder::AppendJsonHtml(&localized_strings, &full_html);
+ jstemplate_builder::AppendI18nTemplateSourceHtml(&full_html);
+ jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html);
+ jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
+
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+ SendResponse(request_id, html_bytes);
+ return;
}
const std::string data_string("<p style='color:red'>Failed to read resource" +
« no previous file with comments | « chrome/browser/dom_ui/gpu_internals_ui.cc ('k') | chrome/browser/resources/gpu_internals.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698