| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | 755 webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
| 756 } | 756 } |
| 757 main_render_frame_->Initialize(); | 757 main_render_frame_->Initialize(); |
| 758 | 758 |
| 759 if (switches::IsTouchDragDropEnabled()) | 759 if (switches::IsTouchDragDropEnabled()) |
| 760 webview()->settings()->setTouchDragDropEnabled(true); | 760 webview()->settings()->setTouchDragDropEnabled(true); |
| 761 | 761 |
| 762 if (switches::IsTouchEditingEnabled()) | 762 if (switches::IsTouchEditingEnabled()) |
| 763 webview()->settings()->setTouchEditingEnabled(true); | 763 webview()->settings()->setTouchEditingEnabled(true); |
| 764 | 764 |
| 765 #if defined(OS_ANDROID) |
| 766 WebSettings::SelectionStrategyType selection_strategy_default = |
| 767 WebSettings::SelectionStrategyType::Direction; |
| 768 #else |
| 769 WebSettings::SelectionStrategyType selection_strategy_default = |
| 770 WebSettings::SelectionStrategyType::Character; |
| 771 #endif |
| 772 |
| 773 WebSettings::SelectionStrategyType selection_strategy = |
| 774 selection_strategy_default; |
| 775 const std::string selection_strategy_str = |
| 776 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 777 switches::kTouchTextSelectionStrategy); |
| 778 if (selection_strategy_str == "character") |
| 779 selection_strategy = WebSettings::SelectionStrategyType::Character; |
| 780 else if (selection_strategy_str == "direction") |
| 781 selection_strategy = WebSettings::SelectionStrategyType::Direction; |
| 782 webview()->settings()->setSelectionStrategy(selection_strategy); |
| 783 |
| 765 if (!params.frame_name.empty()) | 784 if (!params.frame_name.empty()) |
| 766 webview()->mainFrame()->setName(params.frame_name); | 785 webview()->mainFrame()->setName(params.frame_name); |
| 767 | 786 |
| 768 // TODO(davidben): Move this state from Blink into content. | 787 // TODO(davidben): Move this state from Blink into content. |
| 769 if (params.window_was_created_with_opener) | 788 if (params.window_was_created_with_opener) |
| 770 webview()->setOpenedByDOM(); | 789 webview()->setOpenedByDOM(); |
| 771 | 790 |
| 772 OnSetRendererPrefs(params.renderer_preferences); | 791 OnSetRendererPrefs(params.renderer_preferences); |
| 773 | 792 |
| 774 ApplyBlinkSettings(command_line, webview()->settings()); | 793 ApplyBlinkSettings(command_line, webview()->settings()); |
| (...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3068 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | 3087 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; |
| 3069 possible_drag_event_info_.event_location = | 3088 possible_drag_event_info_.event_location = |
| 3070 gfx::Point(event.globalX, event.globalY); | 3089 gfx::Point(event.globalX, event.globalY); |
| 3071 return false; | 3090 return false; |
| 3072 } | 3091 } |
| 3073 | 3092 |
| 3074 void RenderViewImpl::DidHandleMouseEvent(const WebMouseEvent& event) { | 3093 void RenderViewImpl::DidHandleMouseEvent(const WebMouseEvent& event) { |
| 3075 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); | 3094 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleMouseEvent(event)); |
| 3076 } | 3095 } |
| 3077 | 3096 |
| 3078 void RenderViewImpl::DidHandleTouchEvent(const WebTouchEvent& event) { | |
| 3079 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleTouchEvent(event)); | |
| 3080 } | |
| 3081 | |
| 3082 bool RenderViewImpl::HasTouchEventHandlersAt(const gfx::Point& point) const { | 3097 bool RenderViewImpl::HasTouchEventHandlersAt(const gfx::Point& point) const { |
| 3083 if (!webview()) | 3098 if (!webview()) |
| 3084 return false; | 3099 return false; |
| 3085 return webview()->hasTouchEventHandlersAt(point); | 3100 return webview()->hasTouchEventHandlersAt(point); |
| 3086 } | 3101 } |
| 3087 | 3102 |
| 3088 void RenderViewImpl::OnWasHidden() { | 3103 void RenderViewImpl::OnWasHidden() { |
| 3089 RenderWidget::OnWasHidden(); | 3104 RenderWidget::OnWasHidden(); |
| 3090 | 3105 |
| 3091 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 3106 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3770 std::vector<gfx::Size> sizes; | 3785 std::vector<gfx::Size> sizes; |
| 3771 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3786 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3772 if (!url.isEmpty()) | 3787 if (!url.isEmpty()) |
| 3773 urls.push_back( | 3788 urls.push_back( |
| 3774 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3789 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3775 } | 3790 } |
| 3776 SendUpdateFaviconURL(urls); | 3791 SendUpdateFaviconURL(urls); |
| 3777 } | 3792 } |
| 3778 | 3793 |
| 3779 } // namespace content | 3794 } // namespace content |
| OLD | NEW |