| 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 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1951 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1952 DidDetachInterstitialPage()); | 1952 DidDetachInterstitialPage()); |
| 1953 } | 1953 } |
| 1954 | 1954 |
| 1955 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, | 1955 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, |
| 1956 int history_length) { | 1956 int history_length) { |
| 1957 SetHistoryOffsetAndLengthForView( | 1957 SetHistoryOffsetAndLengthForView( |
| 1958 GetRenderViewHost(), history_offset, history_length); | 1958 GetRenderViewHost(), history_offset, history_length); |
| 1959 } | 1959 } |
| 1960 | 1960 |
| 1961 blink::WebLocalFrame::TextGranularity WebContentsImpl::ToWebTextGranularity( |
| 1962 ui::TextSelectionGranularity granularity) { |
| 1963 switch (granularity) { |
| 1964 case ui::CHARACTER_GRANULARITY: |
| 1965 return blink::WebLocalFrame::CharacterGranularity; |
| 1966 case ui::WORD_GRANULARITY: |
| 1967 return blink::WebLocalFrame::WordGranularity; |
| 1968 case ui::SENTENCE_GRANULARITY: |
| 1969 return blink::WebLocalFrame::SentenceGranularity; |
| 1970 case ui::LINE_GRANULARITY: |
| 1971 return blink::WebLocalFrame::LineGranularity; |
| 1972 case ui::PARAGRAPH_GRANULARITY: |
| 1973 return blink::WebLocalFrame::ParagraphGranularity; |
| 1974 } |
| 1975 } |
| 1976 |
| 1977 |
| 1961 void WebContentsImpl::SetHistoryOffsetAndLengthForView( | 1978 void WebContentsImpl::SetHistoryOffsetAndLengthForView( |
| 1962 RenderViewHost* render_view_host, | 1979 RenderViewHost* render_view_host, |
| 1963 int history_offset, | 1980 int history_offset, |
| 1964 int history_length) { | 1981 int history_length) { |
| 1965 render_view_host->Send(new ViewMsg_SetHistoryOffsetAndLength( | 1982 render_view_host->Send(new ViewMsg_SetHistoryOffsetAndLength( |
| 1966 render_view_host->GetRoutingID(), history_offset, history_length)); | 1983 render_view_host->GetRoutingID(), history_offset, history_length)); |
| 1967 } | 1984 } |
| 1968 | 1985 |
| 1969 void WebContentsImpl::ReloadFocusedFrame(bool ignore_cache) { | 1986 void WebContentsImpl::ReloadFocusedFrame(bool ignore_cache) { |
| 1970 RenderFrameHost* focused_frame = GetFocusedFrame(); | 1987 RenderFrameHost* focused_frame = GetFocusedFrame(); |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 | 3210 |
| 3194 // TODO(avi): Remove. http://crbug.com/170921 | 3211 // TODO(avi): Remove. http://crbug.com/170921 |
| 3195 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; | 3212 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; |
| 3196 NotificationDetails det = NotificationService::NoDetails(); | 3213 NotificationDetails det = NotificationService::NoDetails(); |
| 3197 if (details) | 3214 if (details) |
| 3198 det = Details<LoadNotificationDetails>(details); | 3215 det = Details<LoadNotificationDetails>(details); |
| 3199 NotificationService::current()->Notify( | 3216 NotificationService::current()->Notify( |
| 3200 type, Source<NavigationController>(&controller_), det); | 3217 type, Source<NavigationController>(&controller_), det); |
| 3201 } | 3218 } |
| 3202 | 3219 |
| 3203 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) { | 3220 void WebContentsImpl::MoveRangeSelectionExtent( |
| 3221 const gfx::Point& extent, |
| 3222 ui::TextSelectionGranularity granularity) { |
| 3204 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3223 RenderFrameHost* focused_frame = GetFocusedFrame(); |
| 3205 if (!focused_frame) | 3224 if (!focused_frame) |
| 3206 return; | 3225 return; |
| 3207 | 3226 |
| 3227 //LOG(ERROR) << "WebContentsImpl::MoveRangeSelectionExtent"; |
| 3208 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent( | 3228 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent( |
| 3209 focused_frame->GetRoutingID(), extent)); | 3229 focused_frame->GetRoutingID(), |
| 3230 extent, |
| 3231 ToWebTextGranularity(granularity))); |
| 3210 } | 3232 } |
| 3211 | 3233 |
| 3212 void WebContentsImpl::SelectRange(const gfx::Point& base, | 3234 void WebContentsImpl::SelectRange(const gfx::Point& base, |
| 3213 const gfx::Point& extent) { | 3235 const gfx::Point& extent) { |
| 3214 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3236 RenderFrameHost* focused_frame = GetFocusedFrame(); |
| 3215 if (!focused_frame) | 3237 if (!focused_frame) |
| 3216 return; | 3238 return; |
| 3217 | 3239 |
| 3240 LOG(ERROR) << "WebContentsImpl::SelectRange"; |
| 3218 focused_frame->Send( | 3241 focused_frame->Send( |
| 3219 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent)); | 3242 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent)); |
| 3220 } | 3243 } |
| 3221 | 3244 |
| 3222 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { | 3245 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { |
| 3223 // If we are creating a RVH for a restored controller, then we need to make | 3246 // If we are creating a RVH for a restored controller, then we need to make |
| 3224 // sure the RenderView starts with a next_page_id_ larger than the number | 3247 // sure the RenderView starts with a next_page_id_ larger than the number |
| 3225 // of restored entries. This must be called before the RenderView starts | 3248 // of restored entries. This must be called before the RenderView starts |
| 3226 // navigating (to avoid a race between the browser updating max_page_id and | 3249 // navigating (to avoid a race between the browser updating max_page_id and |
| 3227 // the renderer updating next_page_id_). Because of this, we only call this | 3250 // the renderer updating next_page_id_). Because of this, we only call this |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4381 node->render_manager()->ResumeResponseDeferredAtStart(); | 4404 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4382 } | 4405 } |
| 4383 | 4406 |
| 4384 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4407 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4385 force_disable_overscroll_content_ = force_disable; | 4408 force_disable_overscroll_content_ = force_disable; |
| 4386 if (view_) | 4409 if (view_) |
| 4387 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4410 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4388 } | 4411 } |
| 4389 | 4412 |
| 4390 } // namespace content | 4413 } // namespace content |
| OLD | NEW |