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

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

Issue 2635193003: IOS Reading distillation: Handle Google AMP iFrame. (Closed)
Patch Set: rebase Created 3 years, 11 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 19 matching lines...) Expand all
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(
41 web::PageLoadCompletionStatus load_completion_status);
42
43 // Returns wether there is the loading has no error and if the distillation 40 // Returns wether there is the loading has no error and if the distillation
44 // can continue. 41 // can continue.
45 bool IsLoadingSuccess(web::PageLoadCompletionStatus load_completion_status); 42 bool IsLoadingSuccess(web::PageLoadCompletionStatus load_completion_status);
43 // Work around the fact that articles opened from Google Search page and
44 // Google News are presented in an iframe. This method detects if the current
45 // page is a Google AMP and navigate to the iframe in that case.
46 // Returns whether the current page is a Google AMP page.
47 // IsGoogleCachedAMPPage will determine if the current page is a Google AMP
48 // page.
49 bool IsGoogleCachedAMPPage();
50 // HandleGoogleCachedAMPPage will navigate to the iframe containing the actual
51 // article page.
52 void HandleGoogleCachedAMPPage();
53 // Handles the JavaScript response. If the URL of the iframe is returned,
54 // triggers a navigation to it. Stop distillation of the page there as the new
55 // load will trigger a new distillation.
56 bool HandleGoogleCachedAMPPageJavaScriptResult(id result, NSError* error);
57
58 // Waits a delay then calls DelayedOnLoadURLDone.
59 void WaitForPageLoadCompletion();
60
61 // Continues distillation by calling superclass |OnLoadURLDone|.
62 void DelayedOnLoadURLDone();
63
46 FaviconWebStateDispatcher* web_state_dispatcher_; 64 FaviconWebStateDispatcher* web_state_dispatcher_;
47 base::WeakPtrFactory<ReadingListDistillerPage> weak_ptr_factory_; 65 base::WeakPtrFactory<ReadingListDistillerPage> weak_ptr_factory_;
48 }; 66 };
49 67
50 } // namespace reading_list 68 } // namespace reading_list
51 69
52 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_ 70 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_DISTILLER_PAGE_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/BUILD.gn ('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