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

Side by Side 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: Addressed comments from estade. Also added DEPS for ui/webui/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/dom_distiller/webui/dom_distiller_handler.h"
6
7 #include "base/bind.h"
8 #include "base/values.h"
9 #include "content/public/browser/web_ui.h"
10
11 namespace dom_distiller {
12
13 DomDistillerHandler::DomDistillerHandler()
14 : weak_ptr_factory_(this) {
15 }
16
17 DomDistillerHandler::~DomDistillerHandler() {
18 }
19
20 void DomDistillerHandler::RegisterMessages() {
21 web_ui()->RegisterMessageCallback(
22 "requestEntries",
23 base::Bind(&DomDistillerHandler::HandleRequestEntries,
24 base::Unretained(this)));
25 }
26
27 void DomDistillerHandler::HandleRequestEntries(const ListValue* args) {
28 base::ListValue entries;
29
30 scoped_ptr<base::DictionaryValue> entry1(new base::DictionaryValue());
31 entry1->SetString("title", "Google");
32 entry1->SetString("url", "http://www.google.com/");
33 entries.Append(entry1.release());
34 scoped_ptr<base::DictionaryValue> entry2(new base::DictionaryValue());
35 entry2->SetString("title", "Chrome");
36 entry2->SetString("url", "http://www.chrome.com/");
37 entries.Append(entry2.release());
38
39 web_ui()->CallJavascriptFunction("onGotEntries", entries);
40 }
41
42 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698