| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "components/dom_distiller/webui/dom_distiller_handler.h" | 5 #include "components/dom_distiller/webui/dom_distiller_handler.h" | 
| 6 | 6 | 
| 7 #include <vector> | 7 #include <vector> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/values.h" | 10 #include "base/values.h" | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 58       base::Bind(&DomDistillerHandler::HandleViewUrl, base::Unretained(this))); | 58       base::Bind(&DomDistillerHandler::HandleViewUrl, base::Unretained(this))); | 
| 59 } | 59 } | 
| 60 | 60 | 
| 61 void DomDistillerHandler::HandleAddArticle(const base::ListValue* args) { | 61 void DomDistillerHandler::HandleAddArticle(const base::ListValue* args) { | 
| 62   std::string url; | 62   std::string url; | 
| 63   args->GetString(0, &url); | 63   args->GetString(0, &url); | 
| 64   GURL gurl(url); | 64   GURL gurl(url); | 
| 65   if (gurl.is_valid()) { | 65   if (gurl.is_valid()) { | 
| 66     service_->AddToList( | 66     service_->AddToList( | 
| 67         gurl, | 67         gurl, | 
|  | 68         service_->CreateDefaultDistillerPage(), | 
| 68         base::Bind(base::Bind(&DomDistillerHandler::OnArticleAdded, | 69         base::Bind(base::Bind(&DomDistillerHandler::OnArticleAdded, | 
| 69                               base::Unretained(this)))); | 70                               base::Unretained(this)))); | 
| 70   } else { | 71   } else { | 
| 71     web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); | 72     web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); | 
| 72   } | 73   } | 
| 73 } | 74 } | 
| 74 | 75 | 
| 75 void DomDistillerHandler::HandleViewUrl(const base::ListValue* args) { | 76 void DomDistillerHandler::HandleViewUrl(const base::ListValue* args) { | 
| 76   GURL view_url = GetViewUrlFromArgs(article_scheme_, args); | 77   GURL view_url = GetViewUrlFromArgs(article_scheme_, args); | 
| 77   if (view_url.is_valid()) { | 78   if (view_url.is_valid()) { | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 121 void DomDistillerHandler::OnArticleAdded(bool article_available) { | 122 void DomDistillerHandler::OnArticleAdded(bool article_available) { | 
| 122   // TODO(nyquist): Update this function. | 123   // TODO(nyquist): Update this function. | 
| 123   if (article_available) { | 124   if (article_available) { | 
| 124     HandleRequestEntries(NULL); | 125     HandleRequestEntries(NULL); | 
| 125   } else { | 126   } else { | 
| 126     web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); | 127     web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); | 
| 127   } | 128   } | 
| 128 } | 129 } | 
| 129 | 130 | 
| 130 }  // namespace dom_distiller | 131 }  // namespace dom_distiller | 
| OLD | NEW | 
|---|