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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 void RenderViewImpl::focusPrevious() { | 2325 void RenderViewImpl::focusPrevious() { |
2326 Send(new ViewHostMsg_TakeFocus(routing_id_, true)); | 2326 Send(new ViewHostMsg_TakeFocus(routing_id_, true)); |
2327 } | 2327 } |
2328 | 2328 |
2329 void RenderViewImpl::focusedNodeChanged(const WebNode& node) { | 2329 void RenderViewImpl::focusedNodeChanged(const WebNode& node) { |
2330 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node))); | 2330 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node))); |
2331 | 2331 |
2332 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node)); | 2332 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node)); |
2333 } | 2333 } |
2334 | 2334 |
| 2335 void RenderViewImpl::numberOfWheelEventHandlersChanged(unsigned num_handlers) { |
| 2336 Send(new ViewHostMsg_DidChangeNumWheelEvents(routing_id_, num_handlers)); |
| 2337 } |
| 2338 |
| 2339 void RenderViewImpl::hasTouchEventHandlers(bool has_handlers) { |
| 2340 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
| 2341 } |
| 2342 |
2335 void RenderViewImpl::didUpdateLayout() { | 2343 void RenderViewImpl::didUpdateLayout() { |
2336 // We don't always want to set up a timer, only if we've been put in that | 2344 // We don't always want to set up a timer, only if we've been put in that |
2337 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 2345 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
2338 // message. | 2346 // message. |
2339 if (!send_preferred_size_changes_ || !webview()) | 2347 if (!send_preferred_size_changes_ || !webview()) |
2340 return; | 2348 return; |
2341 | 2349 |
2342 if (check_preferred_size_timer_.IsRunning()) | 2350 if (check_preferred_size_timer_.IsRunning()) |
2343 return; | 2351 return; |
2344 check_preferred_size_timer_.Start(FROM_HERE, | 2352 check_preferred_size_timer_.Start(FROM_HERE, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2509 bool found = GetPluginInfo(params.url, frame->top()->document().url(), | 2517 bool found = GetPluginInfo(params.url, frame->top()->document().url(), |
2510 params.mimeType.utf8(), &info, &mime_type); | 2518 params.mimeType.utf8(), &info, &mime_type); |
2511 if (!found) | 2519 if (!found) |
2512 return NULL; | 2520 return NULL; |
2513 | 2521 |
2514 WebPluginParams params_to_use = params; | 2522 WebPluginParams params_to_use = params; |
2515 params_to_use.mimeType = WebString::fromUTF8(mime_type); | 2523 params_to_use.mimeType = WebString::fromUTF8(mime_type); |
2516 return CreatePlugin(frame, info, params_to_use); | 2524 return CreatePlugin(frame, info, params_to_use); |
2517 } | 2525 } |
2518 | 2526 |
2519 WebPlugin* RenderViewImpl::createPluginReplacement( | |
2520 WebFrame* frame, | |
2521 const WebPluginParams& params) { | |
2522 webkit::WebPluginInfo info; | |
2523 std::string mime_type; | |
2524 GetPluginInfo(params.url, frame->top()->document().url(), | |
2525 params.mimeType.utf8(), &info, &mime_type); | |
2526 return content::GetContentClient()->renderer()->CreatePluginReplacement( | |
2527 this, info.path); | |
2528 } | |
2529 | |
2530 WebSharedWorker* RenderViewImpl::createSharedWorker( | 2527 WebSharedWorker* RenderViewImpl::createSharedWorker( |
2531 WebFrame* frame, const WebURL& url, const WebString& name, | 2528 WebFrame* frame, const WebURL& url, const WebString& name, |
2532 unsigned long long document_id) { | 2529 unsigned long long document_id) { |
2533 | 2530 |
2534 int route_id = MSG_ROUTING_NONE; | 2531 int route_id = MSG_ROUTING_NONE; |
2535 bool exists = false; | 2532 bool exists = false; |
2536 bool url_mismatch = false; | 2533 bool url_mismatch = false; |
2537 ViewHostMsg_CreateWorker_Params params; | 2534 ViewHostMsg_CreateWorker_Params params; |
2538 params.url = url; | 2535 params.url = url; |
2539 params.name = name; | 2536 params.name = name; |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3786 } | 3783 } |
3787 | 3784 |
3788 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, | 3785 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, |
3789 v8::Handle<v8::Context> context, | 3786 v8::Handle<v8::Context> context, |
3790 int extension_group, | 3787 int extension_group, |
3791 int world_id) { | 3788 int world_id) { |
3792 content::GetContentClient()->renderer()->DidCreateScriptContext( | 3789 content::GetContentClient()->renderer()->DidCreateScriptContext( |
3793 frame, context, extension_group, world_id); | 3790 frame, context, extension_group, world_id); |
3794 } | 3791 } |
3795 | 3792 |
3796 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, | |
3797 v8::Handle<v8::Context> context, | |
3798 int world_id) { | |
3799 content::GetContentClient()->renderer()->DidCreateScriptContext( | |
3800 frame, context, -1, world_id); | |
3801 } | |
3802 | |
3803 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, | 3793 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, |
3804 v8::Handle<v8::Context> context, | 3794 v8::Handle<v8::Context> context, |
3805 int world_id) { | 3795 int world_id) { |
3806 content::GetContentClient()->renderer()->WillReleaseScriptContext( | 3796 content::GetContentClient()->renderer()->WillReleaseScriptContext( |
3807 frame, context, world_id); | 3797 frame, context, world_id); |
3808 } | 3798 } |
3809 | 3799 |
3810 void RenderViewImpl::CheckPreferredSize() { | 3800 void RenderViewImpl::CheckPreferredSize() { |
3811 // We don't always want to send the change messages over IPC, only if we've | 3801 // We don't always want to send the change messages over IPC, only if we've |
3812 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 3802 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3999 void RenderViewImpl::didChangeScrollOffset(WebFrame* frame) { | 3989 void RenderViewImpl::didChangeScrollOffset(WebFrame* frame) { |
4000 StartNavStateSyncTimerIfNecessary(); | 3990 StartNavStateSyncTimerIfNecessary(); |
4001 | 3991 |
4002 if (webview()->mainFrame() == frame) | 3992 if (webview()->mainFrame() == frame) |
4003 UpdateScrollState(frame); | 3993 UpdateScrollState(frame); |
4004 | 3994 |
4005 FOR_EACH_OBSERVER( | 3995 FOR_EACH_OBSERVER( |
4006 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); | 3996 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); |
4007 } | 3997 } |
4008 | 3998 |
4009 void RenderViewImpl::numberOfWheelEventHandlersChanged(unsigned num_handlers) { | |
4010 Send(new ViewHostMsg_DidChangeNumWheelEvents(routing_id_, num_handlers)); | |
4011 } | |
4012 | |
4013 void RenderViewImpl::hasTouchEventHandlers(bool has_handlers) { | |
4014 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | |
4015 } | |
4016 | |
4017 void RenderViewImpl::SendFindReply(int request_id, | 3999 void RenderViewImpl::SendFindReply(int request_id, |
4018 int match_count, | 4000 int match_count, |
4019 int ordinal, | 4001 int ordinal, |
4020 const WebRect& selection_rect, | 4002 const WebRect& selection_rect, |
4021 bool final_status_update) { | 4003 bool final_status_update) { |
4022 #if defined(OS_ANDROID) | 4004 #if defined(OS_ANDROID) |
4023 if (synchronous_find_reply_message_.get()) { | 4005 if (synchronous_find_reply_message_.get()) { |
4024 if (final_status_update) { | 4006 if (final_status_update) { |
4025 ViewMsg_SynchronousFind::WriteReplyParams( | 4007 ViewMsg_SynchronousFind::WriteReplyParams( |
4026 synchronous_find_reply_message_.get(), | 4008 synchronous_find_reply_message_.get(), |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6349 | 6331 |
6350 updating_frame_tree_ = true; | 6332 updating_frame_tree_ = true; |
6351 active_frame_id_map_.clear(); | 6333 active_frame_id_map_.clear(); |
6352 | 6334 |
6353 target_process_id_ = process_id; | 6335 target_process_id_ = process_id; |
6354 target_routing_id_ = route_id; | 6336 target_routing_id_ = route_id; |
6355 CreateFrameTree(webview()->mainFrame(), frames); | 6337 CreateFrameTree(webview()->mainFrame(), frames); |
6356 | 6338 |
6357 updating_frame_tree_ = false; | 6339 updating_frame_tree_ = false; |
6358 } | 6340 } |
OLD | NEW |