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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 8775063: Revert 112693 - committed before review was done - Landing 8688002: PPB_TCPSocket_Private/PPB_UDP... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | ppapi/ppapi_shared.gypi » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "content/renderer/web_ui_bindings.h" 77 #include "content/renderer/web_ui_bindings.h"
78 #include "content/renderer/webplugin_delegate_proxy.h" 78 #include "content/renderer/webplugin_delegate_proxy.h"
79 #include "content/renderer/websharedworker_proxy.h" 79 #include "content/renderer/websharedworker_proxy.h"
80 #include "media/base/filter_collection.h" 80 #include "media/base/filter_collection.h"
81 #include "media/base/media_switches.h" 81 #include "media/base/media_switches.h"
82 #include "media/base/message_loop_factory_impl.h" 82 #include "media/base/message_loop_factory_impl.h"
83 #include "net/base/escape.h" 83 #include "net/base/escape.h"
84 #include "net/base/net_errors.h" 84 #include "net/base/net_errors.h"
85 #include "net/http/http_util.h" 85 #include "net/http/http_util.h"
86 #include "ppapi/c/private/ppb_flash_net_connector.h" 86 #include "ppapi/c/private/ppb_flash_net_connector.h"
87 #include "ppapi/proxy/ppapi_messages.h"
88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" 87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h"
89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h"
90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" 89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" 91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h"
93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" 92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h"
95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h" 94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback s.h"
96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" 95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h"
97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h" 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 271
273 static const size_t kExtraCharsBeforeAndAfterSelection = 100; 272 static const size_t kExtraCharsBeforeAndAfterSelection = 100;
274 273
275 // The maximum number of popups that can be spawned from one page. 274 // The maximum number of popups that can be spawned from one page.
276 static const int kMaximumNumberOfUnacknowledgedPopups = 25; 275 static const int kMaximumNumberOfUnacknowledgedPopups = 25;
277 276
278 static const float kScalingIncrement = 0.1f; 277 static const float kScalingIncrement = 0.1f;
279 278
280 static const float kScalingIncrementForGesture = 0.01f; 279 static const float kScalingIncrementForGesture = 0.01f;
281 280
282 static const char* kPredefinedAllowedSocketOrigins[] = {
283 "okddffdblfhhnmhodogpojmfkjmhinfp"
284 };
285
286 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { 281 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) {
287 WebVector<WebURL> urls; 282 WebVector<WebURL> urls;
288 ds->redirectChain(urls); 283 ds->redirectChain(urls);
289 result->reserve(urls.size()); 284 result->reserve(urls.size());
290 for (size_t i = 0; i < urls.size(); ++i) 285 for (size_t i = 0; i < urls.size(); ++i)
291 result->push_back(urls[i]); 286 result->push_back(urls[i]);
292 } 287 }
293 288
294 // If |data_source| is non-null and has a DocumentState associated with it, 289 // If |data_source| is non-null and has a DocumentState associated with it,
295 // the AltErrorPageResourceFetcher is reset. 290 // the AltErrorPageResourceFetcher is reset.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 renderer_accessibility_ = new RendererAccessibility(this); 419 renderer_accessibility_ = new RendererAccessibility(this);
425 420
426 new IdleUserDetector(this); 421 new IdleUserDetector(this);
427 422
428 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 423 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
429 if (command_line.HasSwitch(switches::kEnableMediaStream)) { 424 if (command_line.HasSwitch(switches::kEnableMediaStream)) {
430 media_stream_impl_ = new MediaStreamImpl( 425 media_stream_impl_ = new MediaStreamImpl(
431 RenderThreadImpl::current()->video_capture_impl_manager()); 426 RenderThreadImpl::current()->video_capture_impl_manager());
432 } 427 }
433 428
434 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i)
435 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]);
436
437 std::string allowed_list =
438 command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI);
439 if (!allowed_list.empty()) {
440 StringTokenizer t(allowed_list, ",");
441 while (t.GetNext()) {
442 allowed_socket_origins_.insert(t.token());
443 }
444 }
445
446 content::GetContentClient()->renderer()->RenderViewCreated(this); 429 content::GetContentClient()->renderer()->RenderViewCreated(this);
447 } 430 }
448 431
449 RenderViewImpl::~RenderViewImpl() { 432 RenderViewImpl::~RenderViewImpl() {
450 history_page_ids_.clear(); 433 history_page_ids_.clear();
451 434
452 if (decrement_shared_popup_at_destruction_) 435 if (decrement_shared_popup_at_destruction_)
453 shared_popup_counter_->data--; 436 shared_popup_counter_->data--;
454 437
455 // If file chooser is still waiting for answer, dispatch empty answer. 438 // If file chooser is still waiting for answer, dispatch empty answer.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 const std::string& mime_type, 571 const std::string& mime_type,
589 webkit::WebPluginInfo* plugin_info, 572 webkit::WebPluginInfo* plugin_info,
590 std::string* actual_mime_type) { 573 std::string* actual_mime_type) {
591 bool found = false; 574 bool found = false;
592 Send(new ViewHostMsg_GetPluginInfo( 575 Send(new ViewHostMsg_GetPluginInfo(
593 routing_id_, url, page_url, mime_type, &found, plugin_info, 576 routing_id_, url, page_url, mime_type, &found, plugin_info,
594 actual_mime_type)); 577 actual_mime_type));
595 return found; 578 return found;
596 } 579 }
597 580
598 bool RenderViewImpl::CanUseSocketAPIs() {
599 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
600 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL());
601 if (!url.is_valid())
602 return false;
603
604 return allowed_socket_origins_.find(url.host()) !=
605 allowed_socket_origins_.end();
606 }
607
608 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { 581 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
609 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; 582 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
610 if (main_frame) 583 if (main_frame)
611 content::GetContentClient()->SetActiveURL(main_frame->document().url()); 584 content::GetContentClient()->SetActiveURL(main_frame->document().url());
612 585
613 ObserverListBase<RenderViewObserver>::Iterator it(observers_); 586 ObserverListBase<RenderViewObserver>::Iterator it(observers_);
614 RenderViewObserver* observer; 587 RenderViewObserver* observer;
615 while ((observer = it.GetNext()) != NULL) 588 while ((observer = it.GetNext()) != NULL)
616 if (observer->OnMessageReceived(message)) 589 if (observer->OnMessageReceived(message))
617 return true; 590 return true;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, 679 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
707 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) 680 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
708 #if defined(OS_MACOSX) 681 #if defined(OS_MACOSX)
709 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) 682 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem)
710 #endif 683 #endif
711 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) 684 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed)
712 // TODO(viettrungluu): Move to a separate message filter. 685 // TODO(viettrungluu): Move to a separate message filter.
713 #if defined(ENABLE_FLAPPER_HACKS) 686 #if defined(ENABLE_FLAPPER_HACKS)
714 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) 687 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK)
715 #endif 688 #endif
716 // TODO(dpolukhin): Move TCP/UDP to a separate message filter.
717 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
718 OnTCPSocketConnectACK)
719 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
720 OnTCPSocketSSLHandshakeACK)
721 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
722 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
723 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK)
724 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK,
725 OnUDPSocketRecvFromACK)
726 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK)
727 #if defined(OS_MACOSX) 689 #if defined(OS_MACOSX)
728 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) 690 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize)
729 #endif 691 #endif
730 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, 692 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
731 OnSetHistoryLengthAndPrune) 693 OnSetHistoryLengthAndPrune)
732 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 694 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
733 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK) 695 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK)
734 IPC_MESSAGE_HANDLER(ViewMsg_MouseLockLost, OnMouseLockLost) 696 IPC_MESSAGE_HANDLER(ViewMsg_MouseLockLost, OnMouseLockLost)
735 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) 697 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit)
736 698
(...skipping 4017 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 const PP_NetAddress_Private& local_addr, 4716 const PP_NetAddress_Private& local_addr,
4755 const PP_NetAddress_Private& remote_addr) { 4717 const PP_NetAddress_Private& remote_addr) {
4756 pepper_delegate_.OnConnectTcpACK( 4718 pepper_delegate_.OnConnectTcpACK(
4757 request_id, 4719 request_id,
4758 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), 4720 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit),
4759 local_addr, 4721 local_addr,
4760 remote_addr); 4722 remote_addr);
4761 } 4723 }
4762 #endif 4724 #endif
4763 4725
4764 void RenderViewImpl::OnTCPSocketConnectACK(
4765 uint32 plugin_dispatcher_id,
4766 uint32 socket_id,
4767 bool succeeded,
4768 const PP_NetAddress_Private& local_addr,
4769 const PP_NetAddress_Private& remote_addr) {
4770 pepper_delegate_.OnTCPSocketConnectACK(
4771 socket_id, succeeded, local_addr, remote_addr);
4772 }
4773
4774 void RenderViewImpl::OnTCPSocketSSLHandshakeACK(
4775 uint32 plugin_dispatcher_id,
4776 uint32 socket_id,
4777 bool succeeded) {
4778 pepper_delegate_.OnTCPSocketSSLHandshakeACK(socket_id, succeeded);
4779 }
4780
4781 void RenderViewImpl::OnTCPSocketReadACK(uint32 plugin_dispatcher_id,
4782 uint32 socket_id,
4783 bool succeeded,
4784 const std::string& data) {
4785 pepper_delegate_.OnTCPSocketReadACK(socket_id, succeeded, data);
4786 }
4787
4788 void RenderViewImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
4789 uint32 socket_id,
4790 bool succeeded,
4791 int32_t bytes_written) {
4792 pepper_delegate_.OnTCPSocketWriteACK(socket_id, succeeded, bytes_written);
4793 }
4794
4795 void RenderViewImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id,
4796 uint32 socket_id,
4797 bool succeeded) {
4798 pepper_delegate_.OnUDPSocketBindACK(socket_id, succeeded);
4799 }
4800
4801 void RenderViewImpl::OnUDPSocketRecvFromACK(
4802 uint32 plugin_dispatcher_id,
4803 uint32 socket_id,
4804 bool succeeded,
4805 const std::string& data,
4806 const PP_NetAddress_Private& remote_addr) {
4807 pepper_delegate_.OnUDPSocketRecvFromACK(socket_id,
4808 succeeded,
4809 data,
4810 remote_addr);
4811 }
4812
4813 void RenderViewImpl::OnUDPSocketSendToACK(uint32 plugin_dispatcher_id,
4814 uint32 socket_id,
4815 bool succeeded,
4816 int32_t bytes_written) {
4817 pepper_delegate_.OnUDPSocketSendToACK(socket_id, succeeded, bytes_written);
4818 }
4819
4820 void RenderViewImpl::OnContextMenuClosed( 4726 void RenderViewImpl::OnContextMenuClosed(
4821 const webkit_glue::CustomContextMenuContext& custom_context) { 4727 const webkit_glue::CustomContextMenuContext& custom_context) {
4822 if (custom_context.is_pepper_menu) 4728 if (custom_context.is_pepper_menu)
4823 pepper_delegate_.OnContextMenuClosed(custom_context); 4729 pepper_delegate_.OnContextMenuClosed(custom_context);
4824 else 4730 else
4825 context_menu_node_.reset(); 4731 context_menu_node_.reset();
4826 } 4732 }
4827 4733
4828 void RenderViewImpl::OnEnableViewSourceMode() { 4734 void RenderViewImpl::OnEnableViewSourceMode() {
4829 if (!webview()) 4735 if (!webview())
(...skipping 25 matching lines...) Expand all
4855 return !!RenderThreadImpl::current()->compositor_thread(); 4761 return !!RenderThreadImpl::current()->compositor_thread();
4856 } 4762 }
4857 4763
4858 void RenderViewImpl::OnJavaBridgeInit( 4764 void RenderViewImpl::OnJavaBridgeInit(
4859 const IPC::ChannelHandle& channel_handle) { 4765 const IPC::ChannelHandle& channel_handle) {
4860 DCHECK(!java_bridge_dispatcher_.get()); 4766 DCHECK(!java_bridge_dispatcher_.get());
4861 #if defined(ENABLE_JAVA_BRIDGE) 4767 #if defined(ENABLE_JAVA_BRIDGE)
4862 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); 4768 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle));
4863 #endif 4769 #endif
4864 } 4770 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | ppapi/ppapi_shared.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698