| 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 "chrome/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs)); | 656 base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs)); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void ChromeRenderViewObserver::DidClearWindowObject(WebFrame* frame) { | 659 void ChromeRenderViewObserver::DidClearWindowObject(WebFrame* frame) { |
| 660 if (render_view()->GetEnabledBindings() & | 660 if (render_view()->GetEnabledBindings() & |
| 661 content::BINDINGS_POLICY_EXTERNAL_HOST) { | 661 content::BINDINGS_POLICY_EXTERNAL_HOST) { |
| 662 GetExternalHostBindings()->BindToJavascript(frame, "externalHost"); | 662 GetExternalHostBindings()->BindToJavascript(frame, "externalHost"); |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 | 665 |
| 666 void ChromeRenderViewObserver::DidHandleTouchEvent(const WebTouchEvent& event) { | |
| 667 // TODO(mazda): Consider using WebKit::WebInputEvent::GestureTap event when | |
| 668 // it's implemented. Only sends the message on touch end event | |
| 669 // for now. | |
| 670 if (event.type != WebKit::WebInputEvent::TouchEnd) | |
| 671 return; | |
| 672 // Ignore the case of multiple touches | |
| 673 if (event.touchesLength != 1) | |
| 674 return; | |
| 675 if (render_view()->GetWebView()->textInputType() == | |
| 676 WebKit::WebTextInputTypeNone) { | |
| 677 return; | |
| 678 } | |
| 679 WebKit::WebNode node = render_view()->GetFocusedNode(); | |
| 680 if (node.isNull()) | |
| 681 return; | |
| 682 WebKit::WebAccessibilityObject accessibility = | |
| 683 render_view()->GetWebView()->accessibilityObject(); | |
| 684 if (accessibility.isNull()) | |
| 685 return; | |
| 686 const WebKit::WebTouchPoint point = event.touches[0]; | |
| 687 accessibility = accessibility.hitTest(point.position); | |
| 688 if (accessibility.isNull()) | |
| 689 return; | |
| 690 if (accessibility.node() == node) | |
| 691 render_view()->Send(new ChromeViewHostMsg_FocusedEditableNodeTouched( | |
| 692 render_view()->GetRoutingID())); | |
| 693 } | |
| 694 | |
| 695 void ChromeRenderViewObserver::DidHandleGestureEvent( | 666 void ChromeRenderViewObserver::DidHandleGestureEvent( |
| 696 const WebGestureEvent& event) { | 667 const WebGestureEvent& event) { |
| 697 if (event.type != WebKit::WebGestureEvent::GestureTap) | 668 if (event.type != WebKit::WebGestureEvent::GestureTap) |
| 698 return; | 669 return; |
| 699 | 670 |
| 700 if (render_view()->GetWebView()->textInputType() != | 671 if (render_view()->GetWebView()->textInputType() != |
| 701 WebKit::WebTextInputTypeNone) { | 672 WebKit::WebTextInputTypeNone) { |
| 702 render_view()->Send(new ChromeViewHostMsg_FocusedEditableNodeTouched( | 673 render_view()->Send(new ChromeViewHostMsg_FocusedEditableNodeTouched( |
| 703 routing_id())); | 674 routing_id())); |
| 704 } | 675 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 if (!external_host_bindings_.get()) { | 828 if (!external_host_bindings_.get()) { |
| 858 external_host_bindings_.reset(new ExternalHostBindings( | 829 external_host_bindings_.reset(new ExternalHostBindings( |
| 859 render_view(), routing_id())); | 830 render_view(), routing_id())); |
| 860 } | 831 } |
| 861 return external_host_bindings_.get(); | 832 return external_host_bindings_.get(); |
| 862 } | 833 } |
| 863 | 834 |
| 864 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { | 835 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { |
| 865 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); | 836 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); |
| 866 } | 837 } |
| OLD | NEW |