| 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 19 matching lines...) Expand all Loading... |
| 30 ~ReadingListDistillerPage() override; | 30 ~ReadingListDistillerPage() override; |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 void DistillPageImpl(const GURL& url, const std::string& script) override; | 33 void DistillPageImpl(const GURL& url, const std::string& script) override; |
| 34 void OnDistillationDone(const GURL& page_url, | 34 void OnDistillationDone(const GURL& page_url, |
| 35 const base::Value* value) override; | 35 const base::Value* value) override; |
| 36 void OnLoadURLDone( | 36 void OnLoadURLDone( |
| 37 web::PageLoadCompletionStatus load_completion_status) override; | 37 web::PageLoadCompletionStatus load_completion_status) override; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 void DelayedOnLoadURLDone( | 40 // Work around the fact that articles opened from Google Search page and |
| 41 web::PageLoadCompletionStatus load_completion_status); | 41 // Google News are presented in an iframe. This method detects if the current |
| 42 // page is a Google AMP and navigate to the iframe in that case. |
| 43 // Returns whether the current page is a Google AMP page. |
| 44 // IsGoogleCachedAMPPage will determine if the current page is a Google AMP |
| 45 // page. |
| 46 bool IsGoogleCachedAMPPage(); |
| 47 // HandleGoogleCachedAMPPage will navigate to the iframe containing the actual |
| 48 // article page. |
| 49 void HandleGoogleCachedAMPPage(); |
| 50 // Handles the JavaScript response. If the URL of the iframe is returned, |
| 51 // triggers a navigation to it. Stop distillation of the page there as the new |
| 52 // load will trigger a new distillation. |
| 53 bool HandleGoogleCachedAMPPageJavaScriptResult(id result, NSError* error); |
| 54 |
| 55 // Waits a delay then calls DelayedOnLoadURLDone. |
| 56 void WaitForPageLoadCompletion(); |
| 57 |
| 58 // Continues distillation by calling superclass |OnLoadURLDone|. |
| 59 void DelayedOnLoadURLDone(); |
| 60 |
| 42 FaviconWebStateDispatcher* web_state_dispatcher_; | 61 FaviconWebStateDispatcher* web_state_dispatcher_; |
| 43 base::WeakPtrFactory<ReadingListDistillerPage> weak_ptr_factory_; | 62 base::WeakPtrFactory<ReadingListDistillerPage> weak_ptr_factory_; |
| 44 }; | 63 }; |
| 45 | 64 |
| 46 } // namespace reading_list | 65 } // namespace reading_list |
| 47 | 66 |
| 48 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ | 67 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ |
| OLD | NEW |