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

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

Issue 6299002: [Sync] Port about:sync to DOMUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added workaround for bug 69633 Created 9 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/dom_ui/sync_internals_html_source.cc
diff --git a/chrome/browser/dom_ui/sync_internals_html_source.cc b/chrome/browser/dom_ui/sync_internals_html_source.cc
new file mode 100644
index 0000000000000000000000000000000000000000..456c93fb93b2c6bd854074bd00da70777b9b5e90
--- /dev/null
+++ b/chrome/browser/dom_ui/sync_internals_html_source.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/dom_ui/sync_internals_html_source.h"
+
+#include <algorithm>
+
+#include "app/resource_bundle.h"
+#include "base/message_loop.h"
+#include "base/ref_counted.h"
+#include "base/ref_counted_memory.h"
+#include "base/string_piece.h"
+#include "base/values.h"
+#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/url_constants.h"
+#include "grit/sync_internals_resources.h"
+
+SyncInternalsHTMLSource::SyncInternalsHTMLSource()
+ : DataSource(chrome::kChromeUISyncInternalsHost,
+ MessageLoop::current()) {}
+
+SyncInternalsHTMLSource::~SyncInternalsHTMLSource() {}
+
+void SyncInternalsHTMLSource::StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id) {
+ base::StringPiece html_template(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_SYNC_INTERNALS_INDEX_HTML));
+ DictionaryValue localized_strings;
+ SetFontAndTextDirection(&localized_strings);
+
+ 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);
+
+ scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes());
+ bytes->data.resize(html.size());
+ std::copy(html.begin(), html.end(), bytes->data.begin());
+ SendResponse(request_id, bytes);
+}
+
+std::string SyncInternalsHTMLSource::GetMimeType(
+ const std::string& path) const {
+ return "text/html";
+}
« no previous file with comments | « chrome/browser/dom_ui/sync_internals_html_source.h ('k') | chrome/browser/dom_ui/sync_internals_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698