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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1162373002: Make some editing/selection functions accessible to c/b/renderer_host/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sadrul@'s comments Created 5 years, 6 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
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/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 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 RenderFrameHostImpl* rfh = GetMainFrame(); 1942 RenderFrameHostImpl* rfh = GetMainFrame();
1943 return rfh ? rfh->browser_accessibility_manager() : nullptr; 1943 return rfh ? rfh->browser_accessibility_manager() : nullptr;
1944 } 1944 }
1945 1945
1946 BrowserAccessibilityManager* 1946 BrowserAccessibilityManager*
1947 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { 1947 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {
1948 RenderFrameHostImpl* rfh = GetMainFrame(); 1948 RenderFrameHostImpl* rfh = GetMainFrame();
1949 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; 1949 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr;
1950 } 1950 }
1951 1951
1952 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) {
1953 RenderFrameHost* focused_frame = GetFocusedFrame();
1954 if (!focused_frame)
1955 return;
1956
1957 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent(
1958 focused_frame->GetRoutingID(), extent));
1959 }
1960
1961 void WebContentsImpl::SelectRange(const gfx::Point& base,
1962 const gfx::Point& extent) {
1963 RenderFrameHost* focused_frame = GetFocusedFrame();
1964 if (!focused_frame)
1965 return;
1966
1967 focused_frame->Send(
1968 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent));
1969 }
1970
1952 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { 1971 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) {
1953 const gfx::Size old_size = GetPreferredSize(); 1972 const gfx::Size old_size = GetPreferredSize();
1954 preferred_size_ = pref_size; 1973 preferred_size_ = pref_size;
1955 OnPreferredSizeChanged(old_size); 1974 OnPreferredSizeChanged(old_size);
1956 } 1975 }
1957 1976
1958 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { 1977 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) {
1959 if (delegate_) 1978 if (delegate_)
1960 delegate_->ResizeDueToAutoResize(this, new_size); 1979 delegate_->ResizeDueToAutoResize(this, new_size);
1961 } 1980 }
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 3288
3270 // TODO(avi): Remove. http://crbug.com/170921 3289 // TODO(avi): Remove. http://crbug.com/170921
3271 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; 3290 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP;
3272 NotificationDetails det = NotificationService::NoDetails(); 3291 NotificationDetails det = NotificationService::NoDetails();
3273 if (details) 3292 if (details)
3274 det = Details<LoadNotificationDetails>(details); 3293 det = Details<LoadNotificationDetails>(details);
3275 NotificationService::current()->Notify( 3294 NotificationService::current()->Notify(
3276 type, Source<NavigationController>(&controller_), det); 3295 type, Source<NavigationController>(&controller_), det);
3277 } 3296 }
3278 3297
3279 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) {
3280 RenderFrameHost* focused_frame = GetFocusedFrame();
3281 if (!focused_frame)
3282 return;
3283
3284 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent(
3285 focused_frame->GetRoutingID(), extent));
3286 }
3287
3288 void WebContentsImpl::SelectRange(const gfx::Point& base,
3289 const gfx::Point& extent) {
3290 RenderFrameHost* focused_frame = GetFocusedFrame();
3291 if (!focused_frame)
3292 return;
3293
3294 focused_frame->Send(
3295 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent));
3296 }
3297
3298 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { 3298 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) {
3299 // If we are creating a RVH for a restored controller, then we need to make 3299 // If we are creating a RVH for a restored controller, then we need to make
3300 // sure the RenderView starts with a next_page_id_ larger than the number 3300 // sure the RenderView starts with a next_page_id_ larger than the number
3301 // of restored entries. This must be called before the RenderView starts 3301 // of restored entries. This must be called before the RenderView starts
3302 // navigating (to avoid a race between the browser updating max_page_id and 3302 // navigating (to avoid a race between the browser updating max_page_id and
3303 // the renderer updating next_page_id_). Because of this, we only call this 3303 // the renderer updating next_page_id_). Because of this, we only call this
3304 // from CreateRenderView and allow that to notify the RenderView for us. 3304 // from CreateRenderView and allow that to notify the RenderView for us.
3305 int max_restored_page_id = controller_.GetMaxRestoredPageID(); 3305 int max_restored_page_id = controller_.GetMaxRestoredPageID();
3306 if (max_restored_page_id > 3306 if (max_restored_page_id >
3307 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance())) 3307 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()))
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
4435 player_map->erase(it); 4435 player_map->erase(it);
4436 } 4436 }
4437 4437
4438 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4438 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4439 force_disable_overscroll_content_ = force_disable; 4439 force_disable_overscroll_content_ = force_disable;
4440 if (view_) 4440 if (view_)
4441 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4441 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4442 } 4442 }
4443 4443
4444 } // namespace content 4444 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698