Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: components/dom_distiller/content/browser/distillability_driver.cc

Issue 1248643004: Test distillability without JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@early
Patch Set: fix oopsies Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698