OLD | NEW |
---|---|
(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()); | |
stuartmorgan
2013/09/12 05:25:24
These are temporary placeholders I assume? If so,
nyquist
2013/09/12 17:42:12
Done.
| |
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 | |
OLD | NEW |