Chromium Code Reviews| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs)); | 655 base::TimeDelta::FromMilliseconds(kDelayForForcedCaptureMs)); |
| 656 } | 656 } |
| 657 | 657 |
| 658 void ChromeRenderViewObserver::DidClearWindowObject(WebFrame* frame) { | 658 void ChromeRenderViewObserver::DidClearWindowObject(WebFrame* frame) { |
| 659 if (render_view()->GetEnabledBindings() & | 659 if (render_view()->GetEnabledBindings() & |
| 660 content::BINDINGS_POLICY_EXTERNAL_HOST) { | 660 content::BINDINGS_POLICY_EXTERNAL_HOST) { |
| 661 GetExternalHostBindings()->BindToJavascript(frame, "externalHost"); | 661 GetExternalHostBindings()->BindToJavascript(frame, "externalHost"); |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 | 664 |
| 665 void ChromeRenderViewObserver::DidHandleTouchEvent(const WebTouchEvent& event) { | |
| 666 // TODO(mazda): Consider using WebKit::WebInputEvent::GestureTap event when | |
| 667 // it's implemented. Only sends the message on touch end event | |
| 668 // for now. | |
| 669 if (event.type != WebKit::WebInputEvent::TouchEnd) | |
| 670 return; | |
| 671 // Ignore the case of multiple touches | |
| 672 if (event.touchesLength != 1) | |
| 673 return; | |
| 674 if (render_view()->GetWebView()->textInputType() == | |
| 675 WebKit::WebTextInputTypeNone) { | |
| 676 return; | |
| 677 } | |
| 678 WebKit::WebNode node = render_view()->GetFocusedNode(); | |
| 679 if (node.isNull()) | |
| 680 return; | |
| 681 WebKit::WebAccessibilityObject accessibility = | |
| 682 render_view()->GetWebView()->accessibilityObject(); | |
| 683 if (accessibility.isNull()) | |
| 684 return; | |
| 685 const WebKit::WebTouchPoint point = event.touches[0]; | |
| 686 accessibility = accessibility.hitTest(point.position); | |
| 687 if (accessibility.isNull()) | |
| 688 return; | |
| 689 if (accessibility.node() == node) | |
| 690 render_view()->Send(new ChromeViewHostMsg_FocusedEditableNodeTouched( | |
|
Rick Byers
2012/12/18 19:22:58
If you're removing all senders of this message, th
| |
| 691 render_view()->GetRoutingID())); | |
| 692 } | |
| 693 | |
| 694 void ChromeRenderViewObserver::CapturePageInfoLater(bool preliminary_capture, | 665 void ChromeRenderViewObserver::CapturePageInfoLater(bool preliminary_capture, |
| 695 base::TimeDelta delay) { | 666 base::TimeDelta delay) { |
| 696 capture_timer_.Start( | 667 capture_timer_.Start( |
| 697 FROM_HERE, | 668 FROM_HERE, |
| 698 delay, | 669 delay, |
| 699 base::Bind(&ChromeRenderViewObserver::CapturePageInfo, | 670 base::Bind(&ChromeRenderViewObserver::CapturePageInfo, |
| 700 base::Unretained(this), | 671 base::Unretained(this), |
| 701 preliminary_capture)); | 672 preliminary_capture)); |
| 702 } | 673 } |
| 703 | 674 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 844 if (!external_host_bindings_.get()) { | 815 if (!external_host_bindings_.get()) { |
| 845 external_host_bindings_.reset(new ExternalHostBindings( | 816 external_host_bindings_.reset(new ExternalHostBindings( |
| 846 render_view(), routing_id())); | 817 render_view(), routing_id())); |
| 847 } | 818 } |
| 848 return external_host_bindings_.get(); | 819 return external_host_bindings_.get(); |
| 849 } | 820 } |
| 850 | 821 |
| 851 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { | 822 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { |
| 852 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); | 823 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); |
| 853 } | 824 } |
| OLD | NEW |