1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ 6#define COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ 7 8#include <vector> 9 10#include "base/memory/ref_counted.h" 11#include "components/dom_distiller/core/proto/distilled_page.pb.h" 12 13namespace dom_distiller { 14 15// Update about an article that is currently under distillation. 16class ArticleDistillationUpdate { 17 public: 18 typedef base::RefCountedData<DistilledPageProto> RefCountedPageProto; 19 20 ArticleDistillationUpdate( 21 const std::vector<scoped_refptr<RefCountedPageProto> >& pages, 22 bool has_next_page, 23 bool has_prev_page); 24 ~ArticleDistillationUpdate(); 25 26 // Returns the distilled page at |index|. 27 const DistilledPageProto& GetDistilledPage(size_t index) const; 28 29 // Returns the size of distilled pages in this update. 30 size_t GetPagesSize() const { return pages_.size(); } 31 32 // Returns true, if article has a next page that is currently under 33 // distillation and that is not part of the distilled pages included in this 34 // update. 35 bool HasNextPage() const { return has_next_page_; } 36 37 // Returns true if article has a previous page that is currently under 38 // distillation and that is not part of the distilled pages included in this 39 // update. 40 bool HasPrevPage() const { return has_prev_page_; } 41 42 private: 43 bool has_next_page_; 44 bool has_prev_page_; 45 // Currently available pages. 46 std::vector<scoped_refptr<RefCountedPageProto> > pages_; 47}; 48 49} // namespace dom_distiller 50 51#endif // COMPONENTS_DOM_DISTILLER_CORE_ARTICLE_DISTILLATION_UPDATE_H_ 52