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

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

Issue 2529283002: Save favicon during reading list distillation (Closed)
Patch Set: Add a comment 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 "ios/web/public/web_state/web_state_observer.h" 13 #include "ios/web/public/web_state/web_state_observer.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace ios { 16 namespace ios {
17 class WebControllerProvider; 17 class WebControllerProvider;
18 } 18 }
19 19
20 namespace web { 20 namespace web {
21 class BrowserState; 21 class BrowserState;
22 } 22 }
23 23
24 namespace dom_distiller { 24 namespace dom_distiller {
25 25
26 class DistillerFaviconIOS;
26 class DistillerWebStateObserver; 27 class DistillerWebStateObserver;
27 28
28 // Loads URLs and injects JavaScript into a page, extracting the distilled page 29 // Loads URLs and injects JavaScript into a page, extracting the distilled page
29 // content. 30 // content.
30 class DistillerPageIOS : public DistillerPage { 31 class DistillerPageIOS : public DistillerPage {
31 public: 32 public:
32 explicit DistillerPageIOS(web::BrowserState* browser_state); 33 explicit DistillerPageIOS(web::BrowserState* browser_state,
34 DistillerFaviconIOS* distiller_favicon);
33 ~DistillerPageIOS() override; 35 ~DistillerPageIOS() override;
34 36
35 protected: 37 protected:
36 bool StringifyOutput() override; 38 bool StringifyOutput() override;
37 void DistillPageImpl(const GURL& url, const std::string& script) override; 39 void DistillPageImpl(const GURL& url, const std::string& script) override;
38 40
39 private: 41 private:
40 friend class DistillerWebStateObserver; 42 friend class DistillerWebStateObserver;
41 43
42 // Called by |web_state_observer_| once the page has finished loading. 44 // Called by |web_state_observer_| once the page has finished loading.
43 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status); 45 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status);
44 46
45 // Called once the |script_| has been evaluated on the page. 47 // Called once the |script_| has been evaluated on the page.
46 void HandleJavaScriptResult(id result); 48 void HandleJavaScriptResult(id result);
47 49
50 // Called once the script for finding the favicons on the page has been
51 // evaluated. Extracts the data from the |result| and let |distiller_favicon_|
Eugene But (OOO till 7-30) 2016/11/30 18:51:30 Please describe what |result| is, including it's a
52 // handle the URL.
53 void HandleFaviconResult(id result);
54
48 // Converts result of WKWebView script evaluation to base::Value 55 // Converts result of WKWebView script evaluation to base::Value
49 std::unique_ptr<base::Value> ValueResultFromScriptResult(id wk_result); 56 std::unique_ptr<base::Value> ValueResultFromScriptResult(id wk_result);
50 57
51 web::BrowserState* browser_state_; 58 web::BrowserState* browser_state_;
52 GURL url_; 59 GURL url_;
53 std::string script_; 60 std::string script_;
54 std::unique_ptr<ios::WebControllerProvider> provider_; 61 std::unique_ptr<ios::WebControllerProvider> provider_;
55 std::unique_ptr<DistillerWebStateObserver> web_state_observer_; 62 std::unique_ptr<DistillerWebStateObserver> web_state_observer_;
63 DistillerFaviconIOS* distiller_favicon_;
56 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_; 64 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_;
57 }; 65 };
58 66
59 } // namespace dom_distiller 67 } // namespace dom_distiller
60 68
61 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ 69 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698