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

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: Used scoped_refptr Created 5 years, 5 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/clipboard_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 RenderFrameHostImpl* rfh = GetMainFrame(); 1955 RenderFrameHostImpl* rfh = GetMainFrame();
1956 return rfh ? rfh->browser_accessibility_manager() : nullptr; 1956 return rfh ? rfh->browser_accessibility_manager() : nullptr;
1957 } 1957 }
1958 1958
1959 BrowserAccessibilityManager* 1959 BrowserAccessibilityManager*
1960 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { 1960 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {
1961 RenderFrameHostImpl* rfh = GetMainFrame(); 1961 RenderFrameHostImpl* rfh = GetMainFrame();
1962 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; 1962 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr;
1963 } 1963 }
1964 1964
1965 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) {
1966 RenderFrameHost* focused_frame = GetFocusedFrame();
1967 if (!focused_frame)
1968 return;
1969
1970 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent(
1971 focused_frame->GetRoutingID(), extent));
1972 }
1973
1974 void WebContentsImpl::SelectRange(const gfx::Point& base,
1975 const gfx::Point& extent) {
1976 RenderFrameHost* focused_frame = GetFocusedFrame();
1977 if (!focused_frame)
1978 return;
1979
1980 focused_frame->Send(
1981 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent));
1982 }
1983
1965 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { 1984 void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) {
1966 const gfx::Size old_size = GetPreferredSize(); 1985 const gfx::Size old_size = GetPreferredSize();
1967 preferred_size_ = pref_size; 1986 preferred_size_ = pref_size;
1968 OnPreferredSizeChanged(old_size); 1987 OnPreferredSizeChanged(old_size);
1969 } 1988 }
1970 1989
1971 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { 1990 void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) {
1972 if (delegate_) 1991 if (delegate_)
1973 delegate_->ResizeDueToAutoResize(this, new_size); 1992 delegate_->ResizeDueToAutoResize(this, new_size);
1974 } 1993 }
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 3293
3275 // TODO(avi): Remove. http://crbug.com/170921 3294 // TODO(avi): Remove. http://crbug.com/170921
3276 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; 3295 int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP;
3277 NotificationDetails det = NotificationService::NoDetails(); 3296 NotificationDetails det = NotificationService::NoDetails();
3278 if (details) 3297 if (details)
3279 det = Details<LoadNotificationDetails>(details); 3298 det = Details<LoadNotificationDetails>(details);
3280 NotificationService::current()->Notify( 3299 NotificationService::current()->Notify(
3281 type, Source<NavigationController>(&controller_), det); 3300 type, Source<NavigationController>(&controller_), det);
3282 } 3301 }
3283 3302
3284 void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) {
3285 RenderFrameHost* focused_frame = GetFocusedFrame();
3286 if (!focused_frame)
3287 return;
3288
3289 focused_frame->Send(new InputMsg_MoveRangeSelectionExtent(
3290 focused_frame->GetRoutingID(), extent));
3291 }
3292
3293 void WebContentsImpl::SelectRange(const gfx::Point& base,
3294 const gfx::Point& extent) {
3295 RenderFrameHost* focused_frame = GetFocusedFrame();
3296 if (!focused_frame)
3297 return;
3298
3299 focused_frame->Send(
3300 new InputMsg_SelectRange(focused_frame->GetRoutingID(), base, extent));
3301 }
3302
3303 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { 3303 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) {
3304 // If we are creating a RVH for a restored controller, then we need to make 3304 // If we are creating a RVH for a restored controller, then we need to make
3305 // sure the RenderView starts with a next_page_id_ larger than the number 3305 // sure the RenderView starts with a next_page_id_ larger than the number
3306 // of restored entries. This must be called before the RenderView starts 3306 // of restored entries. This must be called before the RenderView starts
3307 // navigating (to avoid a race between the browser updating max_page_id and 3307 // navigating (to avoid a race between the browser updating max_page_id and
3308 // the renderer updating next_page_id_). Because of this, we only call this 3308 // the renderer updating next_page_id_). Because of this, we only call this
3309 // from CreateRenderView and allow that to notify the RenderView for us. 3309 // from CreateRenderView and allow that to notify the RenderView for us.
3310 int max_restored_page_id = controller_.GetMaxRestoredPageID(); 3310 int max_restored_page_id = controller_.GetMaxRestoredPageID();
3311 if (max_restored_page_id > 3311 if (max_restored_page_id >
3312 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance())) 3312 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()))
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 player_map->erase(it); 4391 player_map->erase(it);
4392 } 4392 }
4393 4393
4394 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4394 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4395 force_disable_overscroll_content_ = force_disable; 4395 force_disable_overscroll_content_ = force_disable;
4396 if (view_) 4396 if (view_)
4397 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4397 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4398 } 4398 }
4399 4399
4400 } // namespace content 4400 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/clipboard_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698