Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_distiller_page.h

Issue 2754803003: Reading List iOS: Handle multiple pages. (Closed)
Patch Set: clean Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
gambard 2017/03/17 16:14:16 Are you sure this won't be called for another "ori
Olivier 2017/03/17 16:32:42 Discussed offline. Yes, we control this code.
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(
62 web::PageLoadCompletionStatus load_completion_status) override; 63 web::PageLoadCompletionStatus load_completion_status) override;
63 64
64 private: 65 private:
65 // Returns wether there is the loading has no error and if the distillation 66 // Returns wether there is the loading has no error and if the distillation
66 // can continue. 67 // can continue.
67 bool IsLoadingSuccess(web::PageLoadCompletionStatus load_completion_status); 68 bool IsLoadingSuccess(web::PageLoadCompletionStatus load_completion_status);
68 // Work around the fact that articles opened from Google Search page and 69 // Work around the fact that articles opened from Google Search page and
(...skipping 21 matching lines...) Expand all
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_
OLDNEW
« no previous file with comments | « ios/chrome/browser/dom_distiller/distiller_viewer.cc ('k') | ios/chrome/browser/reading_list/reading_list_distiller_page.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698