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
3 // found in the LICENSE file.
5 #include "android_webview/renderer/print_render_frame_observer.h"
7 #include "android_webview/common/print_messages.h"
8 #include "android_webview/renderer/print_web_view_helper.h"
9 #include "content/public/renderer/render_frame.h"
11 namespace android_webview
{
13 PrintRenderFrameObserver::PrintRenderFrameObserver(
14 content::RenderFrame
* render_frame
)
15 : content::RenderFrameObserver(render_frame
) {
18 PrintRenderFrameObserver::~PrintRenderFrameObserver() {
21 bool PrintRenderFrameObserver::OnMessageReceived(
22 const IPC::Message
& message
) {
24 IPC_BEGIN_MESSAGE_MAP(PrintRenderFrameObserver
, message
)
25 IPC_MESSAGE_HANDLER(PrintMsg_PrintNodeUnderContextMenu
,
26 OnPrintNodeUnderContextMenu
)
27 IPC_MESSAGE_UNHANDLED(handled
= false)
33 void PrintRenderFrameObserver::OnPrintNodeUnderContextMenu() {
34 printing::PrintWebViewHelper
* helper
=
35 printing::PrintWebViewHelper::Get(render_frame()->GetRenderView());
37 helper
->PrintNode(render_frame()->GetContextMenuNode());
40 } // namespace android_webview