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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 RenderFrameHostImpl* rfh = GetMainFrame(); | 1953 RenderFrameHostImpl* rfh = GetMainFrame(); |
1954 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 1954 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
1955 } | 1955 } |
1956 | 1956 |
1957 BrowserAccessibilityManager* | 1957 BrowserAccessibilityManager* |
1958 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 1958 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
1959 RenderFrameHostImpl* rfh = GetMainFrame(); | 1959 RenderFrameHostImpl* rfh = GetMainFrame(); |
1960 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 1960 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
1961 } | 1961 } |
1962 | 1962 |
| 1963 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) { |
| 1964 RenderFrameHost* focused_frame = GetFocusedFrame(); |
| 1965 if (!focused_frame) |
| 1966 return; |
| 1967 |
| 1968 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent( |
| 1969 focused_frame->GetRoutingID(), extent)); |
| 1970 } |
| 1971 |
| 1972 void WebContentsImpl::SelectRange(const gfx::Point& base, |
| 1973 const gfx::Point& extent) { |
| 1974 RenderFrameHost* focused_frame = GetFocusedFrame(); |
| 1975 if (!focused_frame) |
| 1976 return; |
| 1977 |
| 1978 focused_frame->Send( |
| 1979 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent)); |
| 1980 } |
| 1981 |
1963 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { | 1982 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { |
1964 const gfx::Size old_size = GetPreferredSize(); | 1983 const gfx::Size old_size = GetPreferredSize(); |
1965 preferred_size_ = pref_size; | 1984 preferred_size_ = pref_size; |
1966 OnPreferredSizeChanged(old_size); | 1985 OnPreferredSizeChanged(old_size); |
1967 } | 1986 } |
1968 | 1987 |
1969 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { | 1988 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { |
1970 if (delegate_) | 1989 if (delegate_) |
1971 delegate_->ResizeDueToAutoResize(this, new_size); | 1990 delegate_->ResizeDueToAutoResize(this, new_size); |
1972 } | 1991 } |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3285 | 3304 |
3286 // TODO(avi): Remove. http://crbug.com/170921 | 3305 // TODO(avi): Remove. http://crbug.com/170921 |
3287 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; | 3306 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; |
3288 NotificationDetails det = NotificationService::NoDetails(); | 3307 NotificationDetails det = NotificationService::NoDetails(); |
3289 if (details) | 3308 if (details) |
3290 det = Details<LoadNotificationDetails>(details); | 3309 det = Details<LoadNotificationDetails>(details); |
3291 NotificationService::current()->Notify( | 3310 NotificationService::current()->Notify( |
3292 type, Source<NavigationController>(&controller_), det); | 3311 type, Source<NavigationController>(&controller_), det); |
3293 } | 3312 } |
3294 | 3313 |
3295 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) { | |
3296 RenderFrameHost* focused_frame = GetFocusedFrame(); | |
3297 if (!focused_frame) | |
3298 return; | |
3299 | |
3300 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent( | |
3301 focused_frame->GetRoutingID(), extent)); | |
3302 } | |
3303 | |
3304 void WebContentsImpl::SelectRange(const gfx::Point& base, | |
3305 const gfx::Point& extent) { | |
3306 RenderFrameHost* focused_frame = GetFocusedFrame(); | |
3307 if (!focused_frame) | |
3308 return; | |
3309 | |
3310 focused_frame->Send( | |
3311 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent)); | |
3312 } | |
3313 | |
3314 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { | 3314 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { |
3315 // If we are creating a RVH for a restored controller, then we need to make | 3315 // If we are creating a RVH for a restored controller, then we need to make |
3316 // sure the RenderView starts with a next_page_id_ larger than the number | 3316 // sure the RenderView starts with a next_page_id_ larger than the number |
3317 // of restored entries. This must be called before the RenderView starts | 3317 // of restored entries. This must be called before the RenderView starts |
3318 // navigating (to avoid a race between the browser updating max_page_id and | 3318 // navigating (to avoid a race between the browser updating max_page_id and |
3319 // the renderer updating next_page_id_). Because of this, we only call this | 3319 // the renderer updating next_page_id_). Because of this, we only call this |
3320 // from CreateRenderView and allow that to notify the RenderView for us. | 3320 // from CreateRenderView and allow that to notify the RenderView for us. |
3321 int max_restored_page_id = controller_.GetMaxRestoredPageID(); | 3321 int max_restored_page_id = controller_.GetMaxRestoredPageID(); |
3322 if (max_restored_page_id > | 3322 if (max_restored_page_id > |
3323 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance())) | 3323 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance())) |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4464 player_map->erase(it); | 4464 player_map->erase(it); |
4465 } | 4465 } |
4466 | 4466 |
4467 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4467 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4468 force_disable_overscroll_content_ = force_disable; | 4468 force_disable_overscroll_content_ = force_disable; |
4469 if (view_) | 4469 if (view_) |
4470 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4470 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4471 } | 4471 } |
4472 | 4472 |
4473 } // namespace content | 4473 } // namespace content |
OLD | NEW |