| 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/core/distiller.h" | 5 #include "components/dom_distiller/core/distiller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 DistillerFactoryImpl::DistillerFactoryImpl( | 24 DistillerFactoryImpl::DistillerFactoryImpl( |
| 25 scoped_ptr<DistillerPageFactory> distiller_page_factory, | 25 scoped_ptr<DistillerPageFactory> distiller_page_factory, |
| 26 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory) | 26 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory) |
| 27 : distiller_page_factory_(distiller_page_factory.Pass()), | 27 : distiller_page_factory_(distiller_page_factory.Pass()), |
| 28 distiller_url_fetcher_factory_(distiller_url_fetcher_factory.Pass()) {} | 28 distiller_url_fetcher_factory_(distiller_url_fetcher_factory.Pass()) {} |
| 29 | 29 |
| 30 DistillerFactoryImpl::~DistillerFactoryImpl() {} | 30 DistillerFactoryImpl::~DistillerFactoryImpl() {} |
| 31 | 31 |
| 32 scoped_ptr<Distiller> DistillerFactoryImpl::CreateDistiller() { | 32 scoped_ptr<Distiller> DistillerFactoryImpl::CreateDistiller() { |
| 33 return scoped_ptr<Distiller>(new DistillerImpl( | 33 scoped_ptr<DistillerImpl> distiller(new DistillerImpl( |
| 34 *distiller_page_factory_, *distiller_url_fetcher_factory_)); | 34 *distiller_page_factory_, *distiller_url_fetcher_factory_)); |
| 35 distiller->Init(); |
| 36 return distiller.PassAs<Distiller>(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 DistillerImpl::DistillerImpl( | 39 DistillerImpl::DistillerImpl( |
| 38 const DistillerPageFactory& distiller_page_factory, | 40 const DistillerPageFactory& distiller_page_factory, |
| 39 const DistillerURLFetcherFactory& distiller_url_fetcher_factory) | 41 const DistillerURLFetcherFactory& distiller_url_fetcher_factory) |
| 40 : distiller_page_factory_(distiller_page_factory), | 42 : distiller_page_factory_(distiller_page_factory), |
| 41 distiller_url_fetcher_factory_(distiller_url_fetcher_factory) { | 43 distiller_url_fetcher_factory_(distiller_url_fetcher_factory) { |
| 42 distiller_page_ = distiller_page_factory_.CreateDistillerPage(this).Pass(); | 44 distiller_page_ = distiller_page_factory_.CreateDistillerPage(this).Pass(); |
| 43 } | 45 } |
| 44 | 46 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 DistillerURLFetcher* fetcher = image_fetchers_[id]; | 129 DistillerURLFetcher* fetcher = image_fetchers_[id]; |
| 128 int result = image_fetchers_.erase(id); | 130 int result = image_fetchers_.erase(id); |
| 129 delete fetcher; | 131 delete fetcher; |
| 130 DCHECK_EQ(1, result); | 132 DCHECK_EQ(1, result); |
| 131 if (image_fetchers_.empty()) { | 133 if (image_fetchers_.empty()) { |
| 132 distillation_cb_.Run(proto_.Pass()); | 134 distillation_cb_.Run(proto_.Pass()); |
| 133 } | 135 } |
| 134 } | 136 } |
| 135 | 137 |
| 136 } // namespace dom_distiller | 138 } // namespace dom_distiller |
| OLD | NEW |