| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ | 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ |
| 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ | 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 ReadingListDistillerPageDelegate(); | 38 ReadingListDistillerPageDelegate(); |
| 39 DISALLOW_COPY_AND_ASSIGN(ReadingListDistillerPageDelegate); | 39 DISALLOW_COPY_AND_ASSIGN(ReadingListDistillerPageDelegate); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // An DistillerPageIOS that will retain WebState to allow favicon download and | 42 // An DistillerPageIOS that will retain WebState to allow favicon download and |
| 43 // and add a 2 seconds delay between loading and distillation. | 43 // and add a 2 seconds delay between loading and distillation. |
| 44 class ReadingListDistillerPage : public dom_distiller::DistillerPageIOS { | 44 class ReadingListDistillerPage : public dom_distiller::DistillerPageIOS { |
| 45 public: | 45 public: |
| 46 typedef base::Callback<void(const GURL&, const GURL&)> RedirectionCallback; | 46 typedef base::Callback<void(const GURL&, const GURL&)> RedirectionCallback; |
| 47 | 47 |
| 48 // Creates a ReadingListDistillerPage. WebStates to download the pages will | 48 // Creates a ReadingListDistillerPage to distill |url|. WebStates to download |
| 49 // be provided by web_state_dispatcher. | 49 // the pages will be provided by web_state_dispatcher. |
| 50 // |browser_state|, |web_state_dispatcher| and |delegate| must not be null. | 50 // |browser_state|, |web_state_dispatcher| and |delegate| must not be null. |
| 51 explicit ReadingListDistillerPage( | 51 explicit ReadingListDistillerPage( |
| 52 const GURL& url, |
| 52 web::BrowserState* browser_state, | 53 web::BrowserState* browser_state, |
| 53 FaviconWebStateDispatcher* web_state_dispatcher, | 54 FaviconWebStateDispatcher* web_state_dispatcher, |
| 54 ReadingListDistillerPageDelegate* delegate); | 55 ReadingListDistillerPageDelegate* delegate); |
| 55 ~ReadingListDistillerPage() override; | 56 ~ReadingListDistillerPage() override; |
| 56 | 57 |
| 57 protected: | 58 protected: |
| 58 void DistillPageImpl(const GURL& url, const std::string& script) override; | 59 void DistillPageImpl(const GURL& url, const std::string& script) override; |
| 59 void OnDistillationDone(const GURL& page_url, | 60 void OnDistillationDone(const GURL& page_url, |
| 60 const base::Value* value) override; | 61 const base::Value* value) override; |
| 61 void OnLoadURLDone( | 62 void OnLoadURLDone( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 90 | 91 |
| 91 // Continue the distillation on the page that is currently loaded in | 92 // Continue the distillation on the page that is currently loaded in |
| 92 // |CurrentWebState()|. | 93 // |CurrentWebState()|. |
| 93 void ContinuePageDistillation(); | 94 void ContinuePageDistillation(); |
| 94 // Starts the fetching of |page_url|'s favicon. | 95 // Starts the fetching of |page_url|'s favicon. |
| 95 void FetchFavicon(const GURL& page_url); | 96 void FetchFavicon(const GURL& page_url); |
| 96 | 97 |
| 97 // Continues distillation by calling superclass |OnLoadURLDone|. | 98 // Continues distillation by calling superclass |OnLoadURLDone|. |
| 98 void DelayedOnLoadURLDone(int delayed_task_id); | 99 void DelayedOnLoadURLDone(int delayed_task_id); |
| 99 GURL original_url_; | 100 GURL original_url_; |
| 101 bool distilling_main_page_; |
| 100 | 102 |
| 101 FaviconWebStateDispatcher* web_state_dispatcher_; | 103 FaviconWebStateDispatcher* web_state_dispatcher_; |
| 102 ReadingListDistillerPageDelegate* delegate_; | 104 ReadingListDistillerPageDelegate* delegate_; |
| 103 int delayed_task_id_; | 105 int delayed_task_id_; |
| 104 base::WeakPtrFactory<ReadingListDistillerPage> weak_ptr_factory_; | 106 base::WeakPtrFactory<ReadingListDistillerPage> weak_ptr_factory_; |
| 105 | 107 |
| 106 DISALLOW_COPY_AND_ASSIGN(ReadingListDistillerPage); | 108 DISALLOW_COPY_AND_ASSIGN(ReadingListDistillerPage); |
| 107 }; | 109 }; |
| 108 | 110 |
| 109 } // namespace reading_list | 111 } // namespace reading_list |
| 110 | 112 |
| 111 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ | 113 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ |
| OLD | NEW |