[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / android_webview / renderer / print_render_frame_observer.cc
blob1e4b6c6fd2a52eb9f4cf67e1e8f0d6003abff5a5
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 "components/printing/common/print_messages.h"
8 #include "components/printing/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) {
23 bool handled = true;
24 IPC_BEGIN_MESSAGE_MAP(PrintRenderFrameObserver, message)
25 IPC_MESSAGE_HANDLER(PrintMsg_PrintNodeUnderContextMenu,
26 OnPrintNodeUnderContextMenu)
27 IPC_MESSAGE_UNHANDLED(handled = false)
28 IPC_END_MESSAGE_MAP()
30 return handled;
33 void PrintRenderFrameObserver::OnPrintNodeUnderContextMenu() {
34 printing::PrintWebViewHelper* helper =
35 printing::PrintWebViewHelper::Get(render_frame()->GetRenderView());
36 if (helper)
37 helper->PrintNode(render_frame()->GetContextMenuNode());
40 } // namespace android_webview