| 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/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 | 908 |
| 909 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { | 909 void RenderViewImpl::RemoveObserver(RenderViewObserver* observer) { |
| 910 observer->RenderViewGone(); | 910 observer->RenderViewGone(); |
| 911 observers_.RemoveObserver(observer); | 911 observers_.RemoveObserver(observer); |
| 912 } | 912 } |
| 913 | 913 |
| 914 WebKit::WebView* RenderViewImpl::webview() const { | 914 WebKit::WebView* RenderViewImpl::webview() const { |
| 915 return static_cast<WebKit::WebView*>(webwidget()); | 915 return static_cast<WebKit::WebView*>(webwidget()); |
| 916 } | 916 } |
| 917 | 917 |
| 918 void RenderViewImpl::PluginCrashed(const FilePath& plugin_path, | 918 void RenderViewImpl::PluginCrashed(const base::FilePath& plugin_path, |
| 919 base::ProcessId plugin_pid) { | 919 base::ProcessId plugin_pid) { |
| 920 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path, plugin_pid)); | 920 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path, plugin_pid)); |
| 921 } | 921 } |
| 922 | 922 |
| 923 void RenderViewImpl::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { | 923 void RenderViewImpl::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { |
| 924 plugin_delegates_.insert(delegate); | 924 plugin_delegates_.insert(delegate); |
| 925 // If the renderer is visible, set initial visibility and focus state. | 925 // If the renderer is visible, set initial visibility and focus state. |
| 926 if (!is_hidden()) { | 926 if (!is_hidden()) { |
| 927 #if defined(OS_MACOSX) | 927 #if defined(OS_MACOSX) |
| 928 delegate->SetContainerVisibility(true); | 928 delegate->SetContainerVisibility(true); |
| (...skipping 3696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4625 void RenderViewImpl::LoadURLExternally( | 4625 void RenderViewImpl::LoadURLExternally( |
| 4626 WebKit::WebFrame* frame, | 4626 WebKit::WebFrame* frame, |
| 4627 const WebKit::WebURLRequest& request, | 4627 const WebKit::WebURLRequest& request, |
| 4628 WebKit::WebNavigationPolicy policy) { | 4628 WebKit::WebNavigationPolicy policy) { |
| 4629 loadURLExternally(frame, request, policy); | 4629 loadURLExternally(frame, request, policy); |
| 4630 } | 4630 } |
| 4631 | 4631 |
| 4632 // webkit_glue::WebPluginPageDelegate ------------------------------------------ | 4632 // webkit_glue::WebPluginPageDelegate ------------------------------------------ |
| 4633 | 4633 |
| 4634 webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( | 4634 webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( |
| 4635 const FilePath& file_path, | 4635 const base::FilePath& file_path, |
| 4636 const std::string& mime_type) { | 4636 const std::string& mime_type) { |
| 4637 if (!PluginChannelHost::IsListening()) { | 4637 if (!PluginChannelHost::IsListening()) { |
| 4638 LOG(ERROR) << "PluginChannelHost isn't listening"; | 4638 LOG(ERROR) << "PluginChannelHost isn't listening"; |
| 4639 return NULL; | 4639 return NULL; |
| 4640 } | 4640 } |
| 4641 | 4641 |
| 4642 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); | 4642 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); |
| 4643 if (in_process_plugin) { | 4643 if (in_process_plugin) { |
| 4644 #if defined(OS_WIN) && !defined(USE_AURA) | 4644 #if defined(OS_WIN) && !defined(USE_AURA) |
| 4645 return webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type); | 4645 return webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type); |
| 4646 #else | 4646 #else |
| 4647 // In-proc plugins aren't supported on non-Windows. | 4647 // In-proc plugins aren't supported on non-Windows. |
| 4648 NOTIMPLEMENTED(); | 4648 NOTIMPLEMENTED(); |
| 4649 return NULL; | 4649 return NULL; |
| 4650 #endif | 4650 #endif |
| 4651 } | 4651 } |
| 4652 | 4652 |
| 4653 return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); | 4653 return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); |
| 4654 } | 4654 } |
| 4655 | 4655 |
| 4656 WebKit::WebPlugin* RenderViewImpl::CreatePluginReplacement( | 4656 WebKit::WebPlugin* RenderViewImpl::CreatePluginReplacement( |
| 4657 const FilePath& file_path) { | 4657 const base::FilePath& file_path) { |
| 4658 return GetContentClient()->renderer()->CreatePluginReplacement( | 4658 return GetContentClient()->renderer()->CreatePluginReplacement( |
| 4659 this, file_path); | 4659 this, file_path); |
| 4660 } | 4660 } |
| 4661 | 4661 |
| 4662 void RenderViewImpl::CreatedPluginWindow(gfx::PluginWindowHandle window) { | 4662 void RenderViewImpl::CreatedPluginWindow(gfx::PluginWindowHandle window) { |
| 4663 #if defined(USE_X11) | 4663 #if defined(USE_X11) |
| 4664 Send(new ViewHostMsg_CreatePluginContainer(routing_id(), window)); | 4664 Send(new ViewHostMsg_CreatePluginContainer(routing_id(), window)); |
| 4665 #endif | 4665 #endif |
| 4666 } | 4666 } |
| 4667 | 4667 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5339 if (client) | 5339 if (client) |
| 5340 client->OnMenuAction(custom_context.request_id, action); | 5340 client->OnMenuAction(custom_context.request_id, action); |
| 5341 } else { | 5341 } else { |
| 5342 // Internal request, forward to WebKit. | 5342 // Internal request, forward to WebKit. |
| 5343 webview()->performCustomContextMenuAction(action); | 5343 webview()->performCustomContextMenuAction(action); |
| 5344 } | 5344 } |
| 5345 } | 5345 } |
| 5346 | 5346 |
| 5347 void RenderViewImpl::OnEnumerateDirectoryResponse( | 5347 void RenderViewImpl::OnEnumerateDirectoryResponse( |
| 5348 int id, | 5348 int id, |
| 5349 const std::vector<FilePath>& paths) { | 5349 const std::vector<base::FilePath>& paths) { |
| 5350 if (!enumeration_completions_[id]) | 5350 if (!enumeration_completions_[id]) |
| 5351 return; | 5351 return; |
| 5352 | 5352 |
| 5353 WebVector<WebString> ws_file_names(paths.size()); | 5353 WebVector<WebString> ws_file_names(paths.size()); |
| 5354 for (size_t i = 0; i < paths.size(); ++i) | 5354 for (size_t i = 0; i < paths.size(); ++i) |
| 5355 ws_file_names[i] = webkit_base::FilePathToWebString(paths[i]); | 5355 ws_file_names[i] = webkit_base::FilePathToWebString(paths[i]); |
| 5356 | 5356 |
| 5357 enumeration_completions_[id]->didChooseFile(ws_file_names); | 5357 enumeration_completions_[id]->didChooseFile(ws_file_names); |
| 5358 enumeration_completions_.erase(id); | 5358 enumeration_completions_.erase(id); |
| 5359 } | 5359 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5522 | 5522 |
| 5523 // Send result of all savable resource links to embedder. | 5523 // Send result of all savable resource links to embedder. |
| 5524 Send(new ViewHostMsg_SendCurrentPageAllSavableResourceLinks(routing_id(), | 5524 Send(new ViewHostMsg_SendCurrentPageAllSavableResourceLinks(routing_id(), |
| 5525 resources_list, | 5525 resources_list, |
| 5526 referrers_list, | 5526 referrers_list, |
| 5527 frames_list)); | 5527 frames_list)); |
| 5528 } | 5528 } |
| 5529 | 5529 |
| 5530 void RenderViewImpl::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( | 5530 void RenderViewImpl::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( |
| 5531 const std::vector<GURL>& links, | 5531 const std::vector<GURL>& links, |
| 5532 const std::vector<FilePath>& local_paths, | 5532 const std::vector<base::FilePath>& local_paths, |
| 5533 const FilePath& local_directory_name) { | 5533 const base::FilePath& local_directory_name) { |
| 5534 | 5534 |
| 5535 // Convert std::vector of GURLs to WebVector<WebURL> | 5535 // Convert std::vector of GURLs to WebVector<WebURL> |
| 5536 WebVector<WebURL> weburl_links(links); | 5536 WebVector<WebURL> weburl_links(links); |
| 5537 | 5537 |
| 5538 // Convert std::vector of std::strings to WebVector<WebString> | 5538 // Convert std::vector of std::strings to WebVector<WebString> |
| 5539 WebVector<WebString> webstring_paths(local_paths.size()); | 5539 WebVector<WebString> webstring_paths(local_paths.size()); |
| 5540 for (size_t i = 0; i < local_paths.size(); i++) | 5540 for (size_t i = 0; i < local_paths.size(); i++) |
| 5541 webstring_paths[i] = webkit_base::FilePathToWebString(local_paths[i]); | 5541 webstring_paths[i] = webkit_base::FilePathToWebString(local_paths[i]); |
| 5542 | 5542 |
| 5543 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, | 5543 WebPageSerializer::serialize(webview()->mainFrame(), true, this, weburl_links, |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6654 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6654 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6655 RenderProcess::current()->ReleaseTransportDIB(dib); | 6655 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6656 } | 6656 } |
| 6657 | 6657 |
| 6658 void RenderViewImpl::DidCommitCompositorFrame() { | 6658 void RenderViewImpl::DidCommitCompositorFrame() { |
| 6659 RenderWidget::DidCommitCompositorFrame(); | 6659 RenderWidget::DidCommitCompositorFrame(); |
| 6660 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); | 6660 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); |
| 6661 } | 6661 } |
| 6662 | 6662 |
| 6663 } // namespace content | 6663 } // namespace content |
| OLD | NEW |