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

Unified Diff: components/dom_distiller/webui/resources/about_dom_distiller.js

Issue 151003006: Add support for distilling arbitrary URLs in DOM Distiller Viewer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added new strings to iOS whitelist Created 6 years, 10 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/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();
},
« no previous file with comments | « components/dom_distiller/webui/resources/about_dom_distiller.html ('k') | components/dom_distiller_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698