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 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2444 return id; | 2444 return id; |
2445 } | 2445 } |
2446 | 2446 |
2447 bool WebContentsImpl::IsSubframe() const { | 2447 bool WebContentsImpl::IsSubframe() const { |
2448 return is_subframe_; | 2448 return is_subframe_; |
2449 } | 2449 } |
2450 | 2450 |
2451 void WebContentsImpl::Find(int request_id, | 2451 void WebContentsImpl::Find(int request_id, |
2452 const base::string16& search_text, | 2452 const base::string16& search_text, |
2453 const blink::WebFindOptions& options) { | 2453 const blink::WebFindOptions& options) { |
2454 // If the browser plugin guest is a top level frame then pass the find request | |
2455 // on to it. | |
2456 if (browser_plugin_embedder_) { | |
2457 browser_plugin_embedder_->Find(request_id, search_text, options); | |
2458 return; | |
2459 } | |
2454 Send(new ViewMsg_Find(GetRoutingID(), request_id, search_text, options)); | 2460 Send(new ViewMsg_Find(GetRoutingID(), request_id, search_text, options)); |
2455 } | 2461 } |
2456 | 2462 |
2457 void WebContentsImpl::StopFinding(StopFindAction action) { | 2463 void WebContentsImpl::StopFinding(StopFindAction action) { |
2458 Send(new ViewMsg_StopFinding(GetRoutingID(), action)); | 2464 Send(new ViewMsg_StopFinding(GetRoutingID(), action)); |
2459 } | 2465 } |
2460 | 2466 |
2461 void WebContentsImpl::InsertCSS(const std::string& css) { | 2467 void WebContentsImpl::InsertCSS(const std::string& css) { |
2462 GetMainFrame()->Send(new FrameMsg_CSSInsertRequest( | 2468 GetMainFrame()->Send(new FrameMsg_CSSInsertRequest( |
2463 GetMainFrame()->GetRoutingID(), css)); | 2469 GetMainFrame()->GetRoutingID(), css)); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2907 return; | 2913 return; |
2908 | 2914 |
2909 ChildProcessSecurityPolicyImpl* policy = | 2915 ChildProcessSecurityPolicyImpl* policy = |
2910 ChildProcessSecurityPolicyImpl::GetInstance(); | 2916 ChildProcessSecurityPolicyImpl::GetInstance(); |
2911 if (policy->IsPseudoScheme(protocol)) | 2917 if (policy->IsPseudoScheme(protocol)) |
2912 return; | 2918 return; |
2913 | 2919 |
2914 delegate_->UnregisterProtocolHandler(this, protocol, url, user_gesture); | 2920 delegate_->UnregisterProtocolHandler(this, protocol, url, user_gesture); |
2915 } | 2921 } |
2916 | 2922 |
2917 void WebContentsImpl::OnFindReply(int request_id, | |
2918 int number_of_matches, | |
2919 const gfx::Rect& selection_rect, | |
2920 int active_match_ordinal, | |
2921 bool final_update) { | |
2922 if (delegate_) { | |
2923 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, | |
2924 active_match_ordinal, final_update); | |
2925 } | |
2926 } | |
2927 | |
2928 #if defined(OS_ANDROID) | 2923 #if defined(OS_ANDROID) |
2929 void WebContentsImpl::OnFindMatchRectsReply( | 2924 void WebContentsImpl::OnFindMatchRectsReply( |
2930 int version, | 2925 int version, |
2931 const std::vector<gfx::RectF>& rects, | 2926 const std::vector<gfx::RectF>& rects, |
2932 const gfx::RectF& active_rect) { | 2927 const gfx::RectF& active_rect) { |
2933 if (delegate_) | 2928 if (delegate_) |
2934 delegate_->FindMatchRectsReply(this, version, rects, active_rect); | 2929 delegate_->FindMatchRectsReply(this, version, rects, active_rect); |
2935 } | 2930 } |
2936 | 2931 |
2937 void WebContentsImpl::OnOpenDateTimeDialog( | 2932 void WebContentsImpl::OnOpenDateTimeDialog( |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3227 void WebContentsImpl::SelectRange(const gfx::Point& start, | 3222 void WebContentsImpl::SelectRange(const gfx::Point& start, |
3228 const gfx::Point& end) { | 3223 const gfx::Point& end) { |
3229 RenderFrameHost* focused_frame = GetFocusedFrame(); | 3224 RenderFrameHost* focused_frame = GetFocusedFrame(); |
3230 if (!focused_frame) | 3225 if (!focused_frame) |
3231 return; | 3226 return; |
3232 | 3227 |
3233 focused_frame->Send( | 3228 focused_frame->Send( |
3234 new InputMsg_SelectRange(focused_frame->GetRoutingID(), start, end)); | 3229 new InputMsg_SelectRange(focused_frame->GetRoutingID(), start, end)); |
3235 } | 3230 } |
3236 | 3231 |
3232 void WebContentsImpl::OnFindReply(int request_id, | |
3233 int number_of_matches, | |
3234 const gfx::Rect& selection_rect, | |
3235 int active_match_ordinal, | |
3236 bool final_update) { | |
3237 // Pass the find reply to the browser plugin embedder. | |
3238 if (browser_plugin_guest_) { | |
3239 browser_plugin_guest_->OnFindReply(request_id, number_of_matches, | |
3240 selection_rect, active_match_ordinal, | |
3241 final_update); | |
Fady Samuel
2014/09/25 10:41:29
This code is probably not necessary. If you look o
raymes
2014/09/29 05:01:34
Cool!
| |
3242 } | |
3243 | |
3244 if (delegate_) { | |
3245 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, | |
3246 active_match_ordinal, final_update); | |
3247 } | |
3248 } | |
3249 | |
3237 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { | 3250 void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { |
3238 // If we are creating a RVH for a restored controller, then we need to make | 3251 // If we are creating a RVH for a restored controller, then we need to make |
3239 // sure the RenderView starts with a next_page_id_ larger than the number | 3252 // sure the RenderView starts with a next_page_id_ larger than the number |
3240 // of restored entries. This must be called before the RenderView starts | 3253 // of restored entries. This must be called before the RenderView starts |
3241 // navigating (to avoid a race between the browser updating max_page_id and | 3254 // navigating (to avoid a race between the browser updating max_page_id and |
3242 // the renderer updating next_page_id_). Because of this, we only call this | 3255 // the renderer updating next_page_id_). Because of this, we only call this |
3243 // from CreateRenderView and allow that to notify the RenderView for us. | 3256 // from CreateRenderView and allow that to notify the RenderView for us. |
3244 int max_restored_page_id = controller_.GetMaxRestoredPageID(); | 3257 int max_restored_page_id = controller_.GetMaxRestoredPageID(); |
3245 if (max_restored_page_id > | 3258 if (max_restored_page_id > |
3246 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance())) | 3259 GetMaxPageIDForSiteInstance(rvh->GetSiteInstance())) |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4391 node->render_manager()->ResumeResponseDeferredAtStart(); | 4404 node->render_manager()->ResumeResponseDeferredAtStart(); |
4392 } | 4405 } |
4393 | 4406 |
4394 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4407 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4395 force_disable_overscroll_content_ = force_disable; | 4408 force_disable_overscroll_content_ = force_disable; |
4396 if (view_) | 4409 if (view_) |
4397 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4410 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4398 } | 4411 } |
4399 | 4412 |
4400 } // namespace content | 4413 } // namespace content |
OLD | NEW |