OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/dom_distiller/content/browser/distillability_driver.h" |
| 6 #include "components/dom_distiller/content/common/distiller_messages.h" |
| 7 |
| 8 #include "content/public/browser/render_frame_host.h" |
| 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "content/public/browser/web_contents_user_data.h" |
| 11 |
| 12 DEFINE_WEB_CONTENTS_USER_DATA_KEY( |
| 13 dom_distiller::WebContentsDistillabilityDriver); |
| 14 |
| 15 namespace dom_distiller { |
| 16 |
| 17 WebContentsDistillabilityDriver::WebContentsDistillabilityDriver( |
| 18 content::WebContents* web_contents) |
| 19 : content::WebContentsObserver(web_contents) { |
| 20 } |
| 21 |
| 22 WebContentsDistillabilityDriver::~WebContentsDistillabilityDriver() { |
| 23 CleanUp(); |
| 24 } |
| 25 |
| 26 bool WebContentsDistillabilityDriver::OnMessageReceived(const IPC::Message &msg, |
| 27 content::RenderFrameHost* render_frame_host) { |
| 28 bool handled = true; |
| 29 IPC_BEGIN_MESSAGE_MAP(WebContentsDistillabilityDriver, msg) |
| 30 IPC_MESSAGE_HANDLER(FrameHostMsg_Distillability, |
| 31 OnDistillability) |
| 32 IPC_MESSAGE_UNHANDLED(handled = false) |
| 33 IPC_END_MESSAGE_MAP() |
| 34 return handled; |
| 35 } |
| 36 |
| 37 void WebContentsDistillabilityDriver::OnDistillability(bool distillable) { |
| 38 // FIXME: call Java UI |
| 39 } |
| 40 |
| 41 void WebContentsDistillabilityDriver::RenderProcessGone( |
| 42 base::TerminationStatus status) { |
| 43 CleanUp(); |
| 44 } |
| 45 |
| 46 void WebContentsDistillabilityDriver::ExtractFeatures() { |
| 47 // FIXME: receive Java object for callback? |
| 48 } |
| 49 |
| 50 void WebContentsDistillabilityDriver::CleanUp() { |
| 51 content::WebContentsObserver::Observe(NULL); |
| 52 } |
| 53 |
| 54 } // namespace dom_distiller |
OLD | NEW |