Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 12321005: Enable touch based selection and editing for webpages behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 webview()->setDeviceScaleFactor(device_scale_factor_); 733 webview()->setDeviceScaleFactor(device_scale_factor_);
734 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( 734 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled(
735 ShouldUseFixedPositionCompositing(device_scale_factor_)); 735 ShouldUseFixedPositionCompositing(device_scale_factor_));
736 736
737 webkit_preferences_.Apply(webview()); 737 webkit_preferences_.Apply(webview());
738 webview()->initializeMainFrame(this); 738 webview()->initializeMainFrame(this);
739 739
740 if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) 740 if (command_line.HasSwitch(switches::kEnableTouchDragDrop))
741 webview()->settings()->setTouchDragDropEnabled(true); 741 webview()->settings()->setTouchDragDropEnabled(true);
742 742
743 if (command_line.HasSwitch(switches::kEnableTouchEditing))
744 webview()->settings()->setTouchEditingEnabled(true);
745
743 if (!params->frame_name.empty()) 746 if (!params->frame_name.empty())
744 webview()->mainFrame()->setName(params->frame_name); 747 webview()->mainFrame()->setName(params->frame_name);
745 webview()->settings()->setMinimumTimerInterval( 748 webview()->settings()->setMinimumTimerInterval(
746 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : 749 is_hidden() ? webkit_glue::kBackgroundTabTimerInterval :
747 webkit_glue::kForegroundTabTimerInterval); 750 webkit_glue::kForegroundTabTimerInterval);
748 751
749 OnSetRendererPrefs(params->renderer_prefs); 752 OnSetRendererPrefs(params->renderer_prefs);
750 753
751 #if defined(ENABLE_WEBRTC) 754 #if defined(ENABLE_WEBRTC)
752 if (!media_stream_dispatcher_) 755 if (!media_stream_dispatcher_)
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 2184
2182 void RenderViewImpl::didExecuteCommand(const WebString& command_name) { 2185 void RenderViewImpl::didExecuteCommand(const WebString& command_name) {
2183 const std::string& name = UTF16ToUTF8(command_name); 2186 const std::string& name = UTF16ToUTF8(command_name);
2184 if (StartsWithASCII(name, "Move", true) || 2187 if (StartsWithASCII(name, "Move", true) ||
2185 StartsWithASCII(name, "Insert", true) || 2188 StartsWithASCII(name, "Insert", true) ||
2186 StartsWithASCII(name, "Delete", true)) 2189 StartsWithASCII(name, "Delete", true))
2187 return; 2190 return;
2188 RenderThreadImpl::current()->RecordUserMetrics(name); 2191 RenderThreadImpl::current()->RecordUserMetrics(name);
2189 } 2192 }
2190 2193
2194 void RenderViewImpl::didChangeTouchEditingHandleVisibility(bool visible) {
2195 Send(new ViewHostMsg_TouchEditingHandlesVisibilityChanged(
2196 routing_id(), visible));
2197 }
2198
2191 bool RenderViewImpl::handleCurrentKeyboardEvent() { 2199 bool RenderViewImpl::handleCurrentKeyboardEvent() {
2192 if (edit_commands_.empty()) 2200 if (edit_commands_.empty())
2193 return false; 2201 return false;
2194 2202
2195 WebFrame* frame = webview()->focusedFrame(); 2203 WebFrame* frame = webview()->focusedFrame();
2196 if (!frame) 2204 if (!frame)
2197 return false; 2205 return false;
2198 2206
2199 EditCommands::iterator it = edit_commands_.begin(); 2207 EditCommands::iterator it = edit_commands_.begin();
2200 EditCommands::iterator end = edit_commands_.end(); 2208 EditCommands::iterator end = edit_commands_.end();
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
4777 range.set_end(range.start() + text.length()); 4785 range.set_end(range.start() + text.length());
4778 } 4786 }
4779 } 4787 }
4780 4788
4781 // Sometimes we get repeated didChangeSelection calls from webkit when 4789 // Sometimes we get repeated didChangeSelection calls from webkit when
4782 // the selection hasn't actually changed. We don't want to report these 4790 // the selection hasn't actually changed. We don't want to report these
4783 // because it will cause us to continually claim the X clipboard. 4791 // because it will cause us to continually claim the X clipboard.
4784 if (selection_text_offset_ != offset || 4792 if (selection_text_offset_ != offset ||
4785 selection_range_ != range || 4793 selection_range_ != range ||
4786 selection_text_ != text) { 4794 selection_text_ != text) {
4795 webview()->updateTouchEditing();
4787 selection_text_ = text; 4796 selection_text_ = text;
4788 selection_text_offset_ = offset; 4797 selection_text_offset_ = offset;
4789 selection_range_ = range; 4798 selection_range_ = range;
4790 Send(new ViewHostMsg_SelectionChanged(routing_id_, text, offset, range)); 4799 Send(new ViewHostMsg_SelectionChanged(routing_id_, text, offset, range));
4791 } 4800 }
4792 } 4801 }
4793 4802
4794 GURL RenderViewImpl::GetAlternateErrorPageURL(const GURL& failed_url, 4803 GURL RenderViewImpl::GetAlternateErrorPageURL(const GURL& failed_url,
4795 ErrorPageType error_type) { 4804 ErrorPageType error_type) {
4796 if (failed_url.SchemeIsSecure()) { 4805 if (failed_url.SchemeIsSecure()) {
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
6675 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6684 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6676 RenderProcess::current()->ReleaseTransportDIB(dib); 6685 RenderProcess::current()->ReleaseTransportDIB(dib);
6677 } 6686 }
6678 6687
6679 void RenderViewImpl::DidCommitCompositorFrame() { 6688 void RenderViewImpl::DidCommitCompositorFrame() {
6680 RenderWidget::DidCommitCompositorFrame(); 6689 RenderWidget::DidCommitCompositorFrame();
6681 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); 6690 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame());
6682 } 6691 }
6683 6692
6684 } // namespace content 6693 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698