OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 "chrome/browser/ui/touch_web_contents_observer_win.h" |
| 6 |
| 7 #include "base/win/win_util.h" |
| 8 #include "chrome/common/render_messages.h" |
| 9 |
| 10 using content::WebContents; |
| 11 |
| 12 DEFINE_WEB_CONTENTS_USER_DATA_KEY(TouchWebContentsObserver); |
| 13 |
| 14 TouchWebContentsObserver::TouchWebContentsObserver(WebContents* web_contents) |
| 15 : content::WebContentsObserver(web_contents) { |
| 16 } |
| 17 |
| 18 TouchWebContentsObserver::~TouchWebContentsObserver() { |
| 19 } |
| 20 |
| 21 bool TouchWebContentsObserver::OnMessageReceived(const IPC::Message& message) { |
| 22 bool handled = true; |
| 23 IPC_BEGIN_MESSAGE_MAP(TouchWebContentsObserver, message) |
| 24 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusedNodeTouched, |
| 25 OnFocusedNodeTouched) |
| 26 IPC_MESSAGE_UNHANDLED(handled = false) |
| 27 IPC_END_MESSAGE_MAP() |
| 28 return handled; |
| 29 } |
| 30 |
| 31 void TouchWebContentsObserver::OnFocusedNodeTouched(bool editable) { |
| 32 #if defined(USE_AURA) |
| 33 if (editable) { |
| 34 base::win::DisplayVirtualKeyboard(); |
| 35 } else { |
| 36 base::win::DismissVirtualKeyboard(); |
| 37 } |
| 38 #endif // USE_AURA |
| 39 } |
OLD | NEW |