Index: components/dom_distiller/webui/resources/about_dom_distiller.js |
diff --git a/components/dom_distiller/webui/resources/about_dom_distiller.js b/components/dom_distiller/webui/resources/about_dom_distiller.js |
index 4a401a9c911850f40ce38b569f7263e7a6d985d5..e52fd9727c0e2d0275557f32cce1500f42f0e86d 100644 |
--- a/components/dom_distiller/webui/resources/about_dom_distiller.js |
+++ b/components/dom_distiller/webui/resources/about_dom_distiller.js |
@@ -37,18 +37,43 @@ var domDistiller = { |
$('add-entry-error').classList.remove('hidden'); |
}, |
+ /** |
+ * Callback from the backend when viewing a URL failed. |
+ */ |
+ onViewUrlFailed: function() { |
+ $('view-url-error').classList.remove('hidden'); |
+ }, |
+ |
removeAllChildren: function(root) { |
while(root.firstChild) { |
root.removeChild(root.firstChild); |
} |
}, |
+ /** |
+ * Sends a request to the browser process to add the URL specified to the list |
+ * of articles. |
+ */ |
onAddArticle: function() { |
$('add-entry-error').classList.add('hidden'); |
var url = $('article_url').value; |
chrome.send('addArticle', [url]); |
}, |
+ /** |
+ * Sends a request to the browser process to view a distilled version of the |
+ * URL specified. |
+ */ |
+ onViewUrl: function() { |
+ $('view-url-error').classList.add('hidden'); |
+ var url = $('article_url').value; |
+ chrome.send('viewUrl', [url]); |
+ }, |
+ |
+ /** |
+ * Sends a request to the browser process to view a distilled version of the |
+ * selected article. |
+ */ |
onSelectArticle: function(articleId) { |
chrome.send('selectArticle', [articleId]); |
}, |
@@ -58,6 +83,7 @@ var domDistiller = { |
$('list-section').classList.remove('hidden'); |
$('entries-list-loading').classList.add('hidden'); |
$('add-entry-error').classList.add('hidden'); |
+ $('view-url-error').classList.add('hidden'); |
$('refreshbutton').addEventListener('click', function(event) { |
domDistiller.onRequestEntries(); |
@@ -65,6 +91,9 @@ var domDistiller = { |
$('addbutton').addEventListener('click', function(event) { |
domDistiller.onAddArticle(); |
}, false); |
+ $('viewbutton').addEventListener('click', function(event) { |
+ domDistiller.onViewUrl(); |
+ }, false); |
domDistiller.onRequestEntries(); |
}, |