| Index: components/dom_distiller/content/browser/distillability_driver.cc
|
| diff --git a/components/dom_distiller/content/browser/distillability_driver.cc b/components/dom_distiller/content/browser/distillability_driver.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e02910d28f0be80ed66601f1352c1956a5c6a86c
|
| --- /dev/null
|
| +++ b/components/dom_distiller/content/browser/distillability_driver.cc
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/dom_distiller/content/browser/distillability_driver.h"
|
| +#include "components/dom_distiller/content/common/distiller_messages.h"
|
| +
|
| +#include "content/public/browser/render_frame_host.h"
|
| +#include "content/public/browser/web_contents_observer.h"
|
| +#include "content/public/browser/web_contents_user_data.h"
|
| +
|
| +DEFINE_WEB_CONTENTS_USER_DATA_KEY(
|
| + dom_distiller::WebContentsDistillabilityDriver);
|
| +
|
| +namespace dom_distiller {
|
| +
|
| +WebContentsDistillabilityDriver::WebContentsDistillabilityDriver(
|
| + content::WebContents* web_contents)
|
| + : content::WebContentsObserver(web_contents) {
|
| +}
|
| +
|
| +WebContentsDistillabilityDriver::~WebContentsDistillabilityDriver() {
|
| + CleanUp();
|
| +}
|
| +
|
| +bool WebContentsDistillabilityDriver::OnMessageReceived(const IPC::Message &msg,
|
| + content::RenderFrameHost* render_frame_host) {
|
| + bool handled = true;
|
| + IPC_BEGIN_MESSAGE_MAP(WebContentsDistillabilityDriver, msg)
|
| + IPC_MESSAGE_HANDLER(FrameHostMsg_Distillability,
|
| + OnDistillability)
|
| + IPC_MESSAGE_UNHANDLED(handled = false)
|
| + IPC_END_MESSAGE_MAP()
|
| + return handled;
|
| +}
|
| +
|
| +void WebContentsDistillabilityDriver::OnDistillability(bool distillable) {
|
| + // FIXME: call Java UI
|
| +}
|
| +
|
| +void WebContentsDistillabilityDriver::RenderProcessGone(
|
| + base::TerminationStatus status) {
|
| + CleanUp();
|
| +}
|
| +
|
| +void WebContentsDistillabilityDriver::ExtractFeatures() {
|
| + // FIXME: receive Java object for callback?
|
| +}
|
| +
|
| +void WebContentsDistillabilityDriver::CleanUp() {
|
| + content::WebContentsObserver::Observe(NULL);
|
| +}
|
| +
|
| +} // namespace dom_distiller
|
|
|