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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // 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 |
30 // content. | 30 // content. |
31 class DistillerPageIOS : public DistillerPage { | 31 class DistillerPageIOS : public DistillerPage { |
32 public: | 32 public: |
33 explicit DistillerPageIOS(web::BrowserState* browser_state); | 33 explicit DistillerPageIOS(web::BrowserState* browser_state); |
34 ~DistillerPageIOS() override; | 34 ~DistillerPageIOS() override; |
35 | 35 |
36 protected: | 36 protected: |
37 bool StringifyOutput() override; | 37 bool StringifyOutput() override; |
38 bool CreateNewContext() override; | |
39 void DistillPageImpl(const GURL& url, const std::string& script) override; | 38 void DistillPageImpl(const GURL& url, const std::string& script) override; |
40 | 39 |
41 private: | 40 private: |
42 friend class DistillerWebStateObserver; | 41 friend class DistillerWebStateObserver; |
43 | 42 |
44 // Called by |web_state_observer_| once the page has finished loading. | 43 // Called by |web_state_observer_| once the page has finished loading. |
45 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status); | 44 void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status); |
46 | 45 |
47 // Called once the |script_| has been evaluated on the page. | 46 // Called once the |script_| has been evaluated on the page. |
48 void HandleJavaScriptResultString(NSString* result); | 47 void HandleJavaScriptResultString(NSString* result); |
49 | 48 |
50 web::BrowserState* browser_state_; | 49 web::BrowserState* browser_state_; |
51 GURL url_; | 50 GURL url_; |
52 std::string script_; | 51 std::string script_; |
53 scoped_ptr<ios::WebControllerProvider> provider_; | 52 scoped_ptr<ios::WebControllerProvider> provider_; |
54 scoped_ptr<DistillerWebStateObserver> web_state_observer_; | 53 scoped_ptr<DistillerWebStateObserver> web_state_observer_; |
55 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_; | 54 base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_; |
56 }; | 55 }; |
57 | 56 |
58 } // namespace dom_distiller | 57 } // namespace dom_distiller |
59 | 58 |
60 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ | 59 #endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_ |
OLD | NEW |