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

Side by Side Diff: components/dom_distiller/ios/distiller_page_ios.h

Issue 2529283002: Save favicon during reading list distillation (Closed)
Patch Set: Fix test Created 4 years 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 2014 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_
6 #define COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ 6 #define COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "components/dom_distiller/core/distiller_page.h" 12 #include "components/dom_distiller/core/distiller_page.h"
13 #include "components/dom_distiller/ios/favicon_web_state_dispatcher.h"
13 #include "ios/web/public/web_state/web_state_observer.h" 14 #include "ios/web/public/web_state/web_state_observer.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace ios {
17 class WebControllerProvider;
18 }
19
20 namespace web {
21 class BrowserState;
22 }
23
24 namespace dom_distiller { 17 namespace dom_distiller {
25 18
26 class DistillerWebStateObserver; 19 class DistillerWebStateObserver;
27 20
28 // Loads URLs and injects JavaScript into a page, extracting the distilled page 21 // Loads URLs and injects JavaScript into a page, extracting the distilled page
29 // content. 22 // content.
30 class DistillerPageIOS : public DistillerPage { 23 class DistillerPageIOS : public DistillerPage {
31 public: 24 public:
32 explicit DistillerPageIOS(web::BrowserState* browser_state); 25 explicit DistillerPageIOS(FaviconWebStateDispatcher* web_state_dispatcher);
33 ~DistillerPageIOS() override; 26 ~DistillerPageIOS() override;
34 27
35 protected: 28 protected:
36 bool StringifyOutput() override; 29 bool StringifyOutput() override;
37 void DistillPageImpl(const GURL& url, const std::string& script) override; 30 void DistillPageImpl(const GURL& url, const std::string& script) override;
38 31
39 private: 32 private:
40 friend class DistillerWebStateObserver; 33 friend class DistillerWebStateObserver;
41 34
42 // Called by |web_state_observer_| once the page has finished loading. 35 // Called by |web_state_observer_| once the page has finished loading.
43 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status); 36 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status);
44 37
45 // Called once the |script_| has been evaluated on the page. 38 // Called once the |script_| has been evaluated on the page.
46 void HandleJavaScriptResult(id result); 39 void HandleJavaScriptResult(id result);
47 40
48 // Converts result of WKWebView script evaluation to base::Value 41 // Converts result of WKWebView script evaluation to base::Value
49 std::unique_ptr<base::Value> ValueResultFromScriptResult(id wk_result); 42 std::unique_ptr<base::Value> ValueResultFromScriptResult(id wk_result);
50 43
51 web::BrowserState* browser_state_;
52 GURL url_; 44 GURL url_;
53 std::string script_; 45 std::string script_;
54 std::unique_ptr<ios::WebControllerProvider> provider_; 46 web::WebState* web_state_;
47 FaviconWebStateDispatcher* web_state_dispatcher_;
55 std::unique_ptr<DistillerWebStateObserver> web_state_observer_; 48 std::unique_ptr<DistillerWebStateObserver> web_state_observer_;
56 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_; 49 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_;
57 }; 50 };
58 51
59 } // namespace dom_distiller 52 } // namespace dom_distiller
60 53
61 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ 54 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_
OLDNEW
« no previous file with comments | « components/dom_distiller/ios/distiller_page_factory_ios.mm ('k') | components/dom_distiller/ios/distiller_page_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698