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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
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 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 case ui::CHARACTER_GRANULARITY: | 2004 case ui::CHARACTER_GRANULARITY: |
2005 return blink::WebLocalFrame::CharacterGranularity; | 2005 return blink::WebLocalFrame::CharacterGranularity; |
2006 case ui::WORD_GRANULARITY: | 2006 case ui::WORD_GRANULARITY: |
2007 return blink::WebLocalFrame::WordGranularity; | 2007 return blink::WebLocalFrame::WordGranularity; |
2008 case ui::SENTENCE_GRANULARITY: | 2008 case ui::SENTENCE_GRANULARITY: |
2009 return blink::WebLocalFrame::SentenceGranularity; | 2009 return blink::WebLocalFrame::SentenceGranularity; |
2010 case ui::LINE_GRANULARITY: | 2010 case ui::LINE_GRANULARITY: |
2011 return blink::WebLocalFrame::LineGranularity; | 2011 return blink::WebLocalFrame::LineGranularity; |
2012 case ui::PARAGRAPH_GRANULARITY: | 2012 case ui::PARAGRAPH_GRANULARITY: |
2013 return blink::WebLocalFrame::ParagraphGranularity; | 2013 return blink::WebLocalFrame::ParagraphGranularity; |
| 2014 default: |
| 2015 return blink::WebLocalFrame::CharacterGranularity; |
2014 } | 2016 } |
2015 } | 2017 } |
2016 | 2018 |
2017 | 2019 |
2018 void WebContentsImpl::SetHistoryOffsetAndLengthForView( | 2020 void WebContentsImpl::SetHistoryOffsetAndLengthForView( |
2019 RenderViewHost* render_view_host, | 2021 RenderViewHost* render_view_host, |
2020 int history_offset, | 2022 int history_offset, |
2021 int history_length) { | 2023 int history_length) { |
2022 render_view_host->Send(new ViewMsg_SetHistoryOffsetAndLength( | 2024 render_view_host->Send(new ViewMsg_SetHistoryOffsetAndLength( |
2023 render_view_host->GetRoutingID(), history_offset, history_length)); | 2025 render_view_host->GetRoutingID(), history_offset, history_length)); |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3278 type, Source<NavigationController>(&controller_), det); | 3280 type, Source<NavigationController>(&controller_), det); |
3279 } | 3281 } |
3280 | 3282 |
3281 void WebContentsImpl::MoveRangeSelectionExtent( | 3283 void WebContentsImpl::MoveRangeSelectionExtent( |
3282 const gfx::Point& extent, | 3284 const gfx::Point& extent, |
3283 ui::TextSelectionGranularity granularity) { | 3285 ui::TextSelectionGranularity granularity) { |
3284 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3286 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3285 if (!focused_frame) | 3287 if (!focused_frame) |
3286 return; | 3288 return; |
3287 | 3289 |
3288 //LOG(ERROR) << "WebContentsImpl::MoveRangeSelectionExtent"; | 3290 // LOG(ERROR) << "WebContentsImpl::MoveRangeSelectionExtent" |
| 3291 // << ", extent.x=" << extent.x() |
| 3292 // << ", extent.y=" << extent.y() |
| 3293 // << ", granularity=" << ToWebTextGranularity(granularity); |
3289 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent( | 3294 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent( |
3290 focused_frame->GetRoutingID(), | 3295 focused_frame->GetRoutingID(), |
3291 extent, | 3296 extent, |
3292 ToWebTextGranularity(granularity))); | 3297 ToWebTextGranularity(granularity))); |
3293 } | 3298 } |
3294 | 3299 |
3295 void WebContentsImpl::SelectRange(const gfx::Point& base, | 3300 void WebContentsImpl::SelectRange(const gfx::Point& base, |
3296 const gfx::Point& extent) { | 3301 const gfx::Point& extent) { |
3297 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3302 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3298 if (!focused_frame) | 3303 if (!focused_frame) |
3299 return; | 3304 return; |
3300 | 3305 |
3301 LOG(ERROR) << "WebContentsImpl::SelectRange"; | 3306 // LOG(ERROR) << "WebContentsImpl::SelectRange" |
| 3307 // << ", base.x=" << base.x() |
| 3308 // << ", base.y=" << base.y() |
| 3309 // << ", extent.x=" << extent.x() |
| 3310 // << ", extent.y=" << extent.y(); |
| 3311 |
3302 focused_frame->Send( | 3312 focused_frame->Send( |
3303 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent)); | 3313 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent)); |
3304 } | 3314 } |
3305 | 3315 |
3306 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { | 3316 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { |
3307 // If we are creating a RVH for a restored controller, then we need to make | 3317 // If we are creating a RVH for a restored controller, then we need to make |
3308 // sure the RenderView starts with a next_page_id_ larger than the number | 3318 // sure the RenderView starts with a next_page_id_ larger than the number |
3309 // of restored entries. This must be called before the RenderView starts | 3319 // of restored entries. This must be called before the RenderView starts |
3310 // navigating (to avoid a race between the browser updating max_page_id and | 3320 // navigating (to avoid a race between the browser updating max_page_id and |
3311 // the renderer updating next_page_id_). Because of this, we only call this | 3321 // the renderer updating next_page_id_). Because of this, we only call this |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4473 node->render_manager()->ResumeResponseDeferredAtStart(); | 4483 node->render_manager()->ResumeResponseDeferredAtStart(); |
4474 } | 4484 } |
4475 | 4485 |
4476 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4486 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4477 force_disable_overscroll_content_ = force_disable; | 4487 force_disable_overscroll_content_ = force_disable; |
4478 if (view_) | 4488 if (view_) |
4479 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4489 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4480 } | 4490 } |
4481 | 4491 |
4482 } // namespace content | 4492 } // namespace content |
OLD | NEW |