OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/dom_distiller/content/browser/distillable_page_utils.h" | 5 #include "components/dom_distiller/content/browser/distillable_page_utils.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/dom_distiller/content/browser/distillability_driver.h" |
13 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" | 14 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" |
14 #include "components/dom_distiller/core/distillable_page_detector.h" | 15 #include "components/dom_distiller/core/distillable_page_detector.h" |
15 #include "components/dom_distiller/core/experiments.h" | 16 #include "components/dom_distiller/core/experiments.h" |
16 #include "components/dom_distiller/core/page_features.h" | 17 #include "components/dom_distiller/core/page_features.h" |
17 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
18 #include "grit/components_resources.h" | 19 #include "grit/components_resources.h" |
19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
20 | 21 |
21 namespace dom_distiller { | 22 namespace dom_distiller { |
22 namespace { | 23 namespace { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 92 } |
92 std::string extract_features_js = | 93 std::string extract_features_js = |
93 ResourceBundle::GetSharedInstance() | 94 ResourceBundle::GetSharedInstance() |
94 .GetRawDataResource(IDR_EXTRACT_PAGE_FEATURES_JS) | 95 .GetRawDataResource(IDR_EXTRACT_PAGE_FEATURES_JS) |
95 .as_string(); | 96 .as_string(); |
96 RunIsolatedJavaScript( | 97 RunIsolatedJavaScript( |
97 main_frame, extract_features_js, | 98 main_frame, extract_features_js, |
98 base::Bind(OnExtractFeaturesJsResult, detector, callback)); | 99 base::Bind(OnExtractFeaturesJsResult, detector, callback)); |
99 } | 100 } |
100 | 101 |
| 102 void setDelegate(content::WebContents* web_contents, |
| 103 DistillabilityDelegate delegate) { |
| 104 CHECK(web_contents); |
| 105 DistillabilityDriver::CreateForWebContents(web_contents); |
| 106 |
| 107 DistillabilityDriver *driver = |
| 108 DistillabilityDriver::FromWebContents(web_contents); |
| 109 CHECK(driver); |
| 110 driver->SetDelegate(delegate); |
| 111 } |
| 112 |
101 } // namespace dom_distiller | 113 } // namespace dom_distiller |
OLD | NEW |