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

Unified Diff: components/dom_distiller/webui/dom_distiller_handler.cc

Issue 23503042: Initial WebUI for DOM Distiller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added dependency for dom_distiller_resources Created 7 years, 3 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: components/dom_distiller/webui/dom_distiller_handler.cc
diff --git a/components/dom_distiller/webui/dom_distiller_handler.cc b/components/dom_distiller/webui/dom_distiller_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c05cc0dec73461288d668bf031c7a3d2aa198392
--- /dev/null
+++ b/components/dom_distiller/webui/dom_distiller_handler.cc
@@ -0,0 +1,42 @@
+// Copyright 2013 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 "components/dom_distiller/webui/dom_distiller_handler.h"
+
+#include "base/bind.h"
+#include "base/values.h"
+#include "content/public/browser/web_ui.h"
+
+namespace dom_distiller {
+
+DomDistillerHandler::DomDistillerHandler()
+ : weak_ptr_factory_(this) {
+}
+
+DomDistillerHandler::~DomDistillerHandler() {}
+
+void DomDistillerHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "requestEntries",
+ base::Bind(&DomDistillerHandler::HandleRequestEntries,
+ base::Unretained(this)));
+}
+
+void DomDistillerHandler::HandleRequestEntries(const ListValue* args) {
+ base::ListValue entries;
+
+ // Add some temporary placeholder entries.
+ scoped_ptr<base::DictionaryValue> entry1(new base::DictionaryValue());
+ entry1->SetString("title", "Google");
+ entry1->SetString("url", "http://www.google.com/");
+ entries.Append(entry1.release());
+ scoped_ptr<base::DictionaryValue> entry2(new base::DictionaryValue());
+ entry2->SetString("title", "Chrome");
+ entry2->SetString("url", "http://www.chrome.com/");
+ entries.Append(entry2.release());
+
+ web_ui()->CallJavascriptFunction("onGotEntries", entries);
+}
+
+} // namespace dom_distiller
« no previous file with comments | « components/dom_distiller/webui/dom_distiller_handler.h ('k') | components/dom_distiller/webui/dom_distiller_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698