| 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 service_->CreateDefaultDistillerPage( |
| 69 web_ui()->GetWebContents()->GetContainerBounds().size()), |
| 69 base::Bind(base::Bind(&DomDistillerHandler::OnArticleAdded, | 70 base::Bind(base::Bind(&DomDistillerHandler::OnArticleAdded, |
| 70 base::Unretained(this)))); | 71 base::Unretained(this)))); |
| 71 } else { | 72 } else { |
| 72 web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); | 73 web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 | 76 |
| 76 void DomDistillerHandler::HandleViewUrl(const base::ListValue* args) { | 77 void DomDistillerHandler::HandleViewUrl(const base::ListValue* args) { |
| 77 GURL view_url = GetViewUrlFromArgs(article_scheme_, args); | 78 GURL view_url = GetViewUrlFromArgs(article_scheme_, args); |
| 78 if (view_url.is_valid()) { | 79 if (view_url.is_valid()) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void DomDistillerHandler::OnArticleAdded(bool article_available) { | 123 void DomDistillerHandler::OnArticleAdded(bool article_available) { |
| 123 // TODO(nyquist): Update this function. | 124 // TODO(nyquist): Update this function. |
| 124 if (article_available) { | 125 if (article_available) { |
| 125 HandleRequestEntries(NULL); | 126 HandleRequestEntries(NULL); |
| 126 } else { | 127 } else { |
| 127 web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); | 128 web_ui()->CallJavascriptFunction("domDistiller.onArticleAddFailed"); |
| 128 } | 129 } |
| 129 } | 130 } |
| 130 | 131 |
| 131 } // namespace dom_distiller | 132 } // namespace dom_distiller |
| OLD | NEW |