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

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: 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 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 void DomDistillerHandler::RegisterMessages() {
20 web_ui()->RegisterMessageCallback(
21 "requestEntries",
22 base::Bind(&DomDistillerHandler::HandleRequestEntries,
23 base::Unretained(this)));
24 }
25
26 void DomDistillerHandler::HandleRequestEntries(const ListValue* args) {
27 base::ListValue entries;
28
29 // Add some temporary placeholder entries.
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
« 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