| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 732 |
| 733 #if defined(OS_ANDROID) | 733 #if defined(OS_ANDROID) |
| 734 media_player_manager_.reset( | 734 media_player_manager_.reset( |
| 735 new webkit_media::WebMediaPlayerManagerAndroid()); | 735 new webkit_media::WebMediaPlayerManagerAndroid()); |
| 736 #endif | 736 #endif |
| 737 | 737 |
| 738 // The next group of objects all implement RenderViewObserver, so are deleted | 738 // The next group of objects all implement RenderViewObserver, so are deleted |
| 739 // along with the RenderView automatically. | 739 // along with the RenderView automatically. |
| 740 devtools_agent_ = new DevToolsAgent(this); | 740 devtools_agent_ = new DevToolsAgent(this); |
| 741 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); | 741 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); |
| 742 #if defined(ENABLE_WEB_INTENTS) |
| 742 intents_host_ = new WebIntentsHost(this); | 743 intents_host_ = new WebIntentsHost(this); |
| 744 #else |
| 745 intents_host_ = NULL; |
| 746 #endif |
| 743 favicon_helper_ = new FaviconHelper(this); | 747 favicon_helper_ = new FaviconHelper(this); |
| 744 | 748 |
| 745 // Create renderer_accessibility_ if needed. | 749 // Create renderer_accessibility_ if needed. |
| 746 OnSetAccessibilityMode(params->accessibility_mode); | 750 OnSetAccessibilityMode(params->accessibility_mode); |
| 747 | 751 |
| 748 new IdleUserDetector(this); | 752 new IdleUserDetector(this); |
| 749 | 753 |
| 750 if (command_line.HasSwitch(switches::kDomAutomationController)) | 754 if (command_line.HasSwitch(switches::kDomAutomationController)) |
| 751 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | 755 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; |
| 752 | 756 |
| (...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3917 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); | 3921 Send(new ViewHostMsg_JSOutOfMemory(routing_id_)); |
| 3918 } | 3922 } |
| 3919 | 3923 |
| 3920 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, | 3924 void RenderViewImpl::didCreateScriptContext(WebFrame* frame, |
| 3921 v8::Handle<v8::Context> context, | 3925 v8::Handle<v8::Context> context, |
| 3922 int extension_group, | 3926 int extension_group, |
| 3923 int world_id) { | 3927 int world_id) { |
| 3924 GetContentClient()->renderer()->DidCreateScriptContext( | 3928 GetContentClient()->renderer()->DidCreateScriptContext( |
| 3925 frame, context, extension_group, world_id); | 3929 frame, context, extension_group, world_id); |
| 3926 | 3930 |
| 3931 #if defined(ENABLE_WEB_INTENTS) |
| 3927 intents_host_->DidCreateScriptContext( | 3932 intents_host_->DidCreateScriptContext( |
| 3928 frame, context, extension_group, world_id); | 3933 frame, context, extension_group, world_id); |
| 3934 #endif |
| 3929 } | 3935 } |
| 3930 | 3936 |
| 3931 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, | 3937 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame, |
| 3932 v8::Handle<v8::Context> context, | 3938 v8::Handle<v8::Context> context, |
| 3933 int world_id) { | 3939 int world_id) { |
| 3934 GetContentClient()->renderer()->WillReleaseScriptContext( | 3940 GetContentClient()->renderer()->WillReleaseScriptContext( |
| 3935 frame, context, world_id); | 3941 frame, context, world_id); |
| 3936 } | 3942 } |
| 3937 | 3943 |
| 3938 void RenderViewImpl::CheckPreferredSize() { | 3944 void RenderViewImpl::CheckPreferredSize() { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4290 return; | 4296 return; |
| 4291 } | 4297 } |
| 4292 ChildThread::current()->quota_dispatcher()->RequestStorageQuota( | 4298 ChildThread::current()->quota_dispatcher()->RequestStorageQuota( |
| 4293 routing_id(), GURL(origin.toString()), | 4299 routing_id(), GURL(origin.toString()), |
| 4294 static_cast<quota::StorageType>(type), requested_size, | 4300 static_cast<quota::StorageType>(type), requested_size, |
| 4295 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 4301 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 4296 } | 4302 } |
| 4297 | 4303 |
| 4298 void RenderViewImpl::registerIntentService( | 4304 void RenderViewImpl::registerIntentService( |
| 4299 WebFrame* frame, const WebIntentServiceInfo& service) { | 4305 WebFrame* frame, const WebIntentServiceInfo& service) { |
| 4306 #if defined(ENABLE_WEB_INTENTS) |
| 4300 webkit_glue::WebIntentServiceData data(service); | 4307 webkit_glue::WebIntentServiceData data(service); |
| 4301 if (data.title.empty()) | 4308 if (data.title.empty()) |
| 4302 data.title = webview()->mainFrame()->document().title(); | 4309 data.title = webview()->mainFrame()->document().title(); |
| 4303 bool user_gesture = frame->isProcessingUserGesture(); | 4310 bool user_gesture = frame->isProcessingUserGesture(); |
| 4304 Send(new IntentsHostMsg_RegisterIntentService(routing_id_, | 4311 Send(new IntentsHostMsg_RegisterIntentService(routing_id_, |
| 4305 data, | 4312 data, |
| 4306 user_gesture)); | 4313 user_gesture)); |
| 4314 #endif |
| 4307 } | 4315 } |
| 4308 | 4316 |
| 4309 void RenderViewImpl::dispatchIntent( | 4317 void RenderViewImpl::dispatchIntent( |
| 4310 WebFrame* frame, const WebIntentRequest& intentRequest) { | 4318 WebFrame* frame, const WebIntentRequest& intentRequest) { |
| 4319 #if defined(ENABLE_WEB_INTENTS) |
| 4311 webkit_glue::WebIntentData intent_data(intentRequest.intent()); | 4320 webkit_glue::WebIntentData intent_data(intentRequest.intent()); |
| 4312 | 4321 |
| 4313 // See WebMessagePortChannelImpl::postMessage() and ::OnMessagedQueued() | 4322 // See WebMessagePortChannelImpl::postMessage() and ::OnMessagedQueued() |
| 4314 WebKit::WebMessagePortChannelArray* channels = | 4323 WebKit::WebMessagePortChannelArray* channels = |
| 4315 intentRequest.intent().messagePortChannelsRelease(); | 4324 intentRequest.intent().messagePortChannelsRelease(); |
| 4316 if (channels) { | 4325 if (channels) { |
| 4317 for (size_t i = 0; i < channels->size(); ++i) { | 4326 for (size_t i = 0; i < channels->size(); ++i) { |
| 4318 WebMessagePortChannelImpl* webchannel = | 4327 WebMessagePortChannelImpl* webchannel = |
| 4319 static_cast<WebMessagePortChannelImpl*>((*channels)[i]); | 4328 static_cast<WebMessagePortChannelImpl*>((*channels)[i]); |
| 4320 intent_data.message_port_ids.push_back(webchannel->message_port_id()); | 4329 intent_data.message_port_ids.push_back(webchannel->message_port_id()); |
| 4321 DCHECK(intent_data.message_port_ids[i] != MSG_ROUTING_NONE); | 4330 DCHECK(intent_data.message_port_ids[i] != MSG_ROUTING_NONE); |
| 4322 } | 4331 } |
| 4323 delete channels; | 4332 delete channels; |
| 4324 } | 4333 } |
| 4325 | 4334 |
| 4326 int id = intents_host_->RegisterWebIntent(intentRequest); | 4335 int id = intents_host_->RegisterWebIntent(intentRequest); |
| 4327 Send(new IntentsHostMsg_WebIntentDispatch( | 4336 Send(new IntentsHostMsg_WebIntentDispatch( |
| 4328 routing_id_, intent_data, id)); | 4337 routing_id_, intent_data, id)); |
| 4338 #endif |
| 4329 } | 4339 } |
| 4330 | 4340 |
| 4331 bool RenderViewImpl::willCheckAndDispatchMessageEvent( | 4341 bool RenderViewImpl::willCheckAndDispatchMessageEvent( |
| 4332 WebKit::WebFrame* sourceFrame, | 4342 WebKit::WebFrame* sourceFrame, |
| 4333 WebKit::WebFrame* targetFrame, | 4343 WebKit::WebFrame* targetFrame, |
| 4334 WebKit::WebSecurityOrigin target_origin, | 4344 WebKit::WebSecurityOrigin target_origin, |
| 4335 WebKit::WebDOMMessageEvent event) { | 4345 WebKit::WebDOMMessageEvent event) { |
| 4336 if (!is_swapped_out_) | 4346 if (!is_swapped_out_) |
| 4337 return false; | 4347 return false; |
| 4338 | 4348 |
| (...skipping 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6606 } | 6616 } |
| 6607 #endif | 6617 #endif |
| 6608 | 6618 |
| 6609 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6619 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6610 TransportDIB::Handle dib_handle) { | 6620 TransportDIB::Handle dib_handle) { |
| 6611 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6621 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6612 RenderProcess::current()->ReleaseTransportDIB(dib); | 6622 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6613 } | 6623 } |
| 6614 | 6624 |
| 6615 } // namespace content | 6625 } // namespace content |
| OLD | NEW |