| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 case blink::WebTextDirectionLeftToRight: | 112 case blink::WebTextDirectionLeftToRight: |
| 113 return base::i18n::LEFT_TO_RIGHT; | 113 return base::i18n::LEFT_TO_RIGHT; |
| 114 case blink::WebTextDirectionRightToLeft: | 114 case blink::WebTextDirectionRightToLeft: |
| 115 return base::i18n::RIGHT_TO_LEFT; | 115 return base::i18n::RIGHT_TO_LEFT; |
| 116 default: | 116 default: |
| 117 NOTREACHED(); | 117 NOTREACHED(); |
| 118 return base::i18n::UNKNOWN_DIRECTION; | 118 return base::i18n::UNKNOWN_DIRECTION; |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 #if defined(OS_WIN) && defined(USE_AURA) | 122 #if defined(OS_WIN) |
| 123 | 123 |
| 124 const int kVirtualKeyboardDisplayWaitTimeoutMs = 100; | 124 const int kVirtualKeyboardDisplayWaitTimeoutMs = 100; |
| 125 const int kMaxVirtualKeyboardDisplayRetries = 5; | 125 const int kMaxVirtualKeyboardDisplayRetries = 5; |
| 126 | 126 |
| 127 void DismissVirtualKeyboardTask() { | 127 void DismissVirtualKeyboardTask() { |
| 128 static int virtual_keyboard_display_retries = 0; | 128 static int virtual_keyboard_display_retries = 0; |
| 129 // If the virtual keyboard is not yet visible, then we execute the task again | 129 // If the virtual keyboard is not yet visible, then we execute the task again |
| 130 // waiting for it to show up. | 130 // waiting for it to show up. |
| 131 if (!base::win::DismissVirtualKeyboard()) { | 131 if (!base::win::DismissVirtualKeyboard()) { |
| 132 if (virtual_keyboard_display_retries < kMaxVirtualKeyboardDisplayRetries) { | 132 if (virtual_keyboard_display_retries < kMaxVirtualKeyboardDisplayRetries) { |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 NotificationService::NoDetails()); | 1770 NotificationService::NoDetails()); |
| 1771 } | 1771 } |
| 1772 | 1772 |
| 1773 void RenderViewHostImpl::OnTakeFocus(bool reverse) { | 1773 void RenderViewHostImpl::OnTakeFocus(bool reverse) { |
| 1774 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | 1774 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); |
| 1775 if (view) | 1775 if (view) |
| 1776 view->TakeFocus(reverse); | 1776 view->TakeFocus(reverse); |
| 1777 } | 1777 } |
| 1778 | 1778 |
| 1779 void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) { | 1779 void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) { |
| 1780 #if defined(OS_WIN) && defined(USE_AURA) | 1780 #if defined(OS_WIN) |
| 1781 if (!is_editable_node && virtual_keyboard_requested_) { | 1781 if (!is_editable_node && virtual_keyboard_requested_) { |
| 1782 virtual_keyboard_requested_ = false; | 1782 virtual_keyboard_requested_ = false; |
| 1783 BrowserThread::PostDelayedTask( | 1783 BrowserThread::PostDelayedTask( |
| 1784 BrowserThread::UI, FROM_HERE, | 1784 BrowserThread::UI, FROM_HERE, |
| 1785 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), | 1785 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), |
| 1786 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); | 1786 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); |
| 1787 } | 1787 } |
| 1788 #endif | 1788 #endif |
| 1789 NotificationService::current()->Notify( | 1789 NotificationService::current()->Notify( |
| 1790 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 1790 NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 void RenderViewHostImpl::OnDomOperationResponse( | 2190 void RenderViewHostImpl::OnDomOperationResponse( |
| 2191 const std::string& json_string, int automation_id) { | 2191 const std::string& json_string, int automation_id) { |
| 2192 DomOperationNotificationDetails details(json_string, automation_id); | 2192 DomOperationNotificationDetails details(json_string, automation_id); |
| 2193 NotificationService::current()->Notify( | 2193 NotificationService::current()->Notify( |
| 2194 NOTIFICATION_DOM_OPERATION_RESPONSE, | 2194 NOTIFICATION_DOM_OPERATION_RESPONSE, |
| 2195 Source<RenderViewHost>(this), | 2195 Source<RenderViewHost>(this), |
| 2196 Details<DomOperationNotificationDetails>(&details)); | 2196 Details<DomOperationNotificationDetails>(&details)); |
| 2197 } | 2197 } |
| 2198 | 2198 |
| 2199 void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) { | 2199 void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) { |
| 2200 #if defined(OS_WIN) && defined(USE_AURA) | 2200 #if defined(OS_WIN) |
| 2201 if (editable) { | 2201 if (editable) { |
| 2202 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); | 2202 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); |
| 2203 } else { | 2203 } else { |
| 2204 virtual_keyboard_requested_ = false; | 2204 virtual_keyboard_requested_ = false; |
| 2205 base::win::DismissVirtualKeyboard(); | 2205 base::win::DismissVirtualKeyboard(); |
| 2206 } | 2206 } |
| 2207 #endif | 2207 #endif |
| 2208 } | 2208 } |
| 2209 | 2209 |
| 2210 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 2210 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2258 void RenderViewHostImpl::AttachToFrameTree() { | 2258 void RenderViewHostImpl::AttachToFrameTree() { |
| 2259 FrameTree* frame_tree = delegate_->GetFrameTree(); | 2259 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 2260 | 2260 |
| 2261 frame_tree->ResetForMainFrameSwap(); | 2261 frame_tree->ResetForMainFrameSwap(); |
| 2262 if (main_frame_id() != FrameTreeNode::kInvalidFrameId) { | 2262 if (main_frame_id() != FrameTreeNode::kInvalidFrameId) { |
| 2263 frame_tree->OnFirstNavigationAfterSwap(main_frame_id()); | 2263 frame_tree->OnFirstNavigationAfterSwap(main_frame_id()); |
| 2264 } | 2264 } |
| 2265 } | 2265 } |
| 2266 | 2266 |
| 2267 } // namespace content | 2267 } // namespace content |
| OLD | NEW |