OLD | NEW |
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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 bool StringifyOutput() override; | 37 bool StringifyOutput() override; |
38 void DistillPageImpl(const GURL& url, const std::string& script) override; | 38 void DistillPageImpl(const GURL& url, const std::string& script) override; |
39 | 39 |
40 private: | 40 private: |
41 friend class DistillerWebStateObserver; | 41 friend class DistillerWebStateObserver; |
42 | 42 |
43 // Called by |web_state_observer_| once the page has finished loading. | 43 // Called by |web_state_observer_| once the page has finished loading. |
44 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status); | 44 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status); |
45 | 45 |
46 // Called once the |script_| has been evaluated on the page. | 46 // Called once the |script_| has been evaluated on the page. |
47 void HandleJavaScriptResultString(NSString* result); | 47 void HandleJavaScriptResult(id result); |
| 48 |
| 49 // Converts result of WKWebView script evaluation to base::Value |
| 50 std::unique_ptr<base::Value> ValueResultFromScriptResult(id wk_result); |
48 | 51 |
49 web::BrowserState* browser_state_; | 52 web::BrowserState* browser_state_; |
50 GURL url_; | 53 GURL url_; |
51 std::string script_; | 54 std::string script_; |
52 std::unique_ptr<ios::WebControllerProvider> provider_; | 55 std::unique_ptr<ios::WebControllerProvider> provider_; |
53 std::unique_ptr<DistillerWebStateObserver> web_state_observer_; | 56 std::unique_ptr<DistillerWebStateObserver> web_state_observer_; |
54 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_; | 57 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_; |
55 }; | 58 }; |
56 | 59 |
57 } // namespace dom_distiller | 60 } // namespace dom_distiller |
58 | 61 |
59 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ | 62 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ |
OLD | NEW |