| OLD | NEW |
| 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 Loading... |
| 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" |
| 87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" | 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" |
| 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
| 89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
| 90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" | 92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" |
| 92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
| 94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
| 95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
| 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
| 97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
| 98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" | 100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" |
| 100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
| 101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" | 102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" |
| 102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" | 105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h" |
| 105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" | 106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" |
| 106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
| 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" | 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" |
| 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" | 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" |
| 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
| 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" | 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" |
| 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
| 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" | 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" |
| 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
| 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 117 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" |
| 116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 118 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
| 117 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData
.h" | 119 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData
.h" |
| 118 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| 119 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" | 121 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" |
| 120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" | 122 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" |
| 121 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 123 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
| 122 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" | 124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" |
| 123 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" | 125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" |
| 124 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 using WebKit::WebPageSerializer; | 208 using WebKit::WebPageSerializer; |
| 207 using WebKit::WebPageSerializerClient; | 209 using WebKit::WebPageSerializerClient; |
| 208 using WebKit::WebPlugin; | 210 using WebKit::WebPlugin; |
| 209 using WebKit::WebPluginContainer; | 211 using WebKit::WebPluginContainer; |
| 210 using WebKit::WebPluginDocument; | 212 using WebKit::WebPluginDocument; |
| 211 using WebKit::WebPluginParams; | 213 using WebKit::WebPluginParams; |
| 212 using WebKit::WebPoint; | 214 using WebKit::WebPoint; |
| 213 using WebKit::WebPopupMenuInfo; | 215 using WebKit::WebPopupMenuInfo; |
| 214 using WebKit::WebRange; | 216 using WebKit::WebRange; |
| 215 using WebKit::WebRect; | 217 using WebKit::WebRect; |
| 218 using WebKit::WebReferrerPolicy; |
| 216 using WebKit::WebScriptSource; | 219 using WebKit::WebScriptSource; |
| 217 using WebKit::WebSearchableFormData; | 220 using WebKit::WebSearchableFormData; |
| 218 using WebKit::WebSecurityOrigin; | 221 using WebKit::WebSecurityOrigin; |
| 219 using WebKit::WebSecurityPolicy; | 222 using WebKit::WebSecurityPolicy; |
| 220 using WebKit::WebSettings; | 223 using WebKit::WebSettings; |
| 221 using WebKit::WebSharedWorker; | 224 using WebKit::WebSharedWorker; |
| 222 using WebKit::WebSize; | 225 using WebKit::WebSize; |
| 223 using WebKit::WebStorageNamespace; | 226 using WebKit::WebStorageNamespace; |
| 224 using WebKit::WebStorageQuotaCallbacks; | 227 using WebKit::WebStorageQuotaCallbacks; |
| 225 using WebKit::WebStorageQuotaError; | 228 using WebKit::WebStorageQuotaError; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 239 using WebKit::WebWorker; | 242 using WebKit::WebWorker; |
| 240 using WebKit::WebWorkerClient; | 243 using WebKit::WebWorkerClient; |
| 241 using appcache::WebApplicationCacheHostImpl; | 244 using appcache::WebApplicationCacheHostImpl; |
| 242 using base::Time; | 245 using base::Time; |
| 243 using base::TimeDelta; | 246 using base::TimeDelta; |
| 244 using content::DocumentState; | 247 using content::DocumentState; |
| 245 using content::NavigationState; | 248 using content::NavigationState; |
| 246 using content::RenderThread; | 249 using content::RenderThread; |
| 247 using content::RenderViewObserver; | 250 using content::RenderViewObserver; |
| 248 using content::RenderViewVisitor; | 251 using content::RenderViewVisitor; |
| 252 using content::Referrer; |
| 249 using content::V8ValueConverter; | 253 using content::V8ValueConverter; |
| 250 using webkit_glue::AltErrorPageResourceFetcher; | 254 using webkit_glue::AltErrorPageResourceFetcher; |
| 251 using webkit_glue::FormField; | 255 using webkit_glue::FormField; |
| 252 using webkit_glue::PasswordForm; | 256 using webkit_glue::PasswordForm; |
| 253 using webkit_glue::PasswordFormDomManager; | 257 using webkit_glue::PasswordFormDomManager; |
| 254 using webkit_glue::ResourceFetcher; | 258 using webkit_glue::ResourceFetcher; |
| 255 | 259 |
| 256 //----------------------------------------------------------------------------- | 260 //----------------------------------------------------------------------------- |
| 257 | 261 |
| 258 typedef std::map<WebKit::WebView*, RenderViewImpl*> ViewMap; | 262 typedef std::map<WebKit::WebView*, RenderViewImpl*> ViewMap; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 271 | 275 |
| 272 static const size_t kExtraCharsBeforeAndAfterSelection = 100; | 276 static const size_t kExtraCharsBeforeAndAfterSelection = 100; |
| 273 | 277 |
| 274 // The maximum number of popups that can be spawned from one page. | 278 // The maximum number of popups that can be spawned from one page. |
| 275 static const int kMaximumNumberOfUnacknowledgedPopups = 25; | 279 static const int kMaximumNumberOfUnacknowledgedPopups = 25; |
| 276 | 280 |
| 277 static const float kScalingIncrement = 0.1f; | 281 static const float kScalingIncrement = 0.1f; |
| 278 | 282 |
| 279 static const float kScalingIncrementForGesture = 0.01f; | 283 static const float kScalingIncrementForGesture = 0.01f; |
| 280 | 284 |
| 285 static const char* kPredefinedAllowedSocketOrigins[] = { |
| 286 "okddffdblfhhnmhodogpojmfkjmhinfp" |
| 287 }; |
| 288 |
| 281 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 289 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
| 282 WebVector<WebURL> urls; | 290 WebVector<WebURL> urls; |
| 283 ds->redirectChain(urls); | 291 ds->redirectChain(urls); |
| 284 result->reserve(urls.size()); | 292 result->reserve(urls.size()); |
| 285 for (size_t i = 0; i < urls.size(); ++i) | 293 for (size_t i = 0; i < urls.size(); ++i) |
| 286 result->push_back(urls[i]); | 294 result->push_back(urls[i]); |
| 287 } | 295 } |
| 288 | 296 |
| 289 // If |data_source| is non-null and has a DocumentState associated with it, | 297 // If |data_source| is non-null and has a DocumentState associated with it, |
| 290 // the AltErrorPageResourceFetcher is reset. | 298 // the AltErrorPageResourceFetcher is reset. |
| 291 static void StopAltErrorPageFetcher(WebDataSource* data_source) { | 299 static void StopAltErrorPageFetcher(WebDataSource* data_source) { |
| 292 if (data_source) { | 300 if (data_source) { |
| 293 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 301 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 294 if (document_state) | 302 if (document_state) |
| 295 document_state->set_alt_error_page_fetcher(NULL); | 303 document_state->set_alt_error_page_fetcher(NULL); |
| 296 } | 304 } |
| 297 } | 305 } |
| 298 | 306 |
| 299 static bool IsReload(const ViewMsg_Navigate_Params& params) { | 307 static bool IsReload(const ViewMsg_Navigate_Params& params) { |
| 300 return | 308 return |
| 301 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || | 309 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || |
| 302 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; | 310 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; |
| 303 } | 311 } |
| 304 | 312 |
| 313 static WebReferrerPolicy getReferrerPolicyFromRequest( |
| 314 const WebURLRequest& request) { |
| 315 return request.extraData() ? |
| 316 static_cast<RequestExtraData*>(request.extraData())->referrer_policy() : |
| 317 WebKit::WebReferrerPolicyDefault; |
| 318 } |
| 319 |
| 305 /////////////////////////////////////////////////////////////////////////////// | 320 /////////////////////////////////////////////////////////////////////////////// |
| 306 | 321 |
| 307 int32 RenderViewImpl::next_page_id_ = 1; | 322 int32 RenderViewImpl::next_page_id_ = 1; |
| 308 | 323 |
| 309 struct RenderViewImpl::PendingFileChooser { | 324 struct RenderViewImpl::PendingFileChooser { |
| 310 PendingFileChooser(const content::FileChooserParams& p, | 325 PendingFileChooser(const content::FileChooserParams& p, |
| 311 WebFileChooserCompletion* c) | 326 WebFileChooserCompletion* c) |
| 312 : params(p), | 327 : params(p), |
| 313 completion(c) { | 328 completion(c) { |
| 314 } | 329 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 renderer_accessibility_ = new RendererAccessibility(this); | 434 renderer_accessibility_ = new RendererAccessibility(this); |
| 420 | 435 |
| 421 new IdleUserDetector(this); | 436 new IdleUserDetector(this); |
| 422 | 437 |
| 423 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 438 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 424 if (command_line.HasSwitch(switches::kEnableMediaStream)) { | 439 if (command_line.HasSwitch(switches::kEnableMediaStream)) { |
| 425 media_stream_impl_ = new MediaStreamImpl( | 440 media_stream_impl_ = new MediaStreamImpl( |
| 426 RenderThreadImpl::current()->video_capture_impl_manager()); | 441 RenderThreadImpl::current()->video_capture_impl_manager()); |
| 427 } | 442 } |
| 428 | 443 |
| 444 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
| 445 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
| 446 |
| 447 std::string allowed_list = |
| 448 command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI); |
| 449 if (!allowed_list.empty()) { |
| 450 StringTokenizer t(allowed_list, ","); |
| 451 while (t.GetNext()) { |
| 452 allowed_socket_origins_.insert(t.token()); |
| 453 } |
| 454 } |
| 455 |
| 429 content::GetContentClient()->renderer()->RenderViewCreated(this); | 456 content::GetContentClient()->renderer()->RenderViewCreated(this); |
| 430 } | 457 } |
| 431 | 458 |
| 432 RenderViewImpl::~RenderViewImpl() { | 459 RenderViewImpl::~RenderViewImpl() { |
| 433 history_page_ids_.clear(); | 460 history_page_ids_.clear(); |
| 434 | 461 |
| 435 if (decrement_shared_popup_at_destruction_) | 462 if (decrement_shared_popup_at_destruction_) |
| 436 shared_popup_counter_->data--; | 463 shared_popup_counter_->data--; |
| 437 | 464 |
| 438 // If file chooser is still waiting for answer, dispatch empty answer. | 465 // If file chooser is still waiting for answer, dispatch empty answer. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 const std::string& mime_type, | 598 const std::string& mime_type, |
| 572 webkit::WebPluginInfo* plugin_info, | 599 webkit::WebPluginInfo* plugin_info, |
| 573 std::string* actual_mime_type) { | 600 std::string* actual_mime_type) { |
| 574 bool found = false; | 601 bool found = false; |
| 575 Send(new ViewHostMsg_GetPluginInfo( | 602 Send(new ViewHostMsg_GetPluginInfo( |
| 576 routing_id_, url, page_url, mime_type, &found, plugin_info, | 603 routing_id_, url, page_url, mime_type, &found, plugin_info, |
| 577 actual_mime_type)); | 604 actual_mime_type)); |
| 578 return found; | 605 return found; |
| 579 } | 606 } |
| 580 | 607 |
| 608 bool RenderViewImpl::CanUseSocketAPIs() { |
| 609 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
| 610 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); |
| 611 if (!url.is_valid()) |
| 612 return false; |
| 613 |
| 614 return allowed_socket_origins_.find(url.host()) != |
| 615 allowed_socket_origins_.end(); |
| 616 } |
| 617 |
| 581 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 618 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
| 582 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 619 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
| 583 if (main_frame) | 620 if (main_frame) |
| 584 content::GetContentClient()->SetActiveURL(main_frame->document().url()); | 621 content::GetContentClient()->SetActiveURL(main_frame->document().url()); |
| 585 | 622 |
| 586 ObserverListBase<RenderViewObserver>::Iterator it(observers_); | 623 ObserverListBase<RenderViewObserver>::Iterator it(observers_); |
| 587 RenderViewObserver* observer; | 624 RenderViewObserver* observer; |
| 588 while ((observer = it.GetNext()) != NULL) | 625 while ((observer = it.GetNext()) != NULL) |
| 589 if (observer->OnMessageReceived(message)) | 626 if (observer->OnMessageReceived(message)) |
| 590 return true; | 627 return true; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 715 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
| 679 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 716 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
| 680 #if defined(OS_MACOSX) | 717 #if defined(OS_MACOSX) |
| 681 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 718 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 682 #endif | 719 #endif |
| 683 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 720 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 684 // TODO(viettrungluu): Move to a separate message filter. | 721 // TODO(viettrungluu): Move to a separate message filter. |
| 685 #if defined(ENABLE_FLAPPER_HACKS) | 722 #if defined(ENABLE_FLAPPER_HACKS) |
| 686 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) | 723 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) |
| 687 #endif | 724 #endif |
| 725 // TODO(dpolukhin): Move TCP/UDP to a separate message filter. |
| 726 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, |
| 727 OnTCPSocketConnectACK) |
| 728 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| 729 OnTCPSocketSSLHandshakeACK) |
| 730 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) |
| 731 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) |
| 732 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) |
| 733 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_RecvFromACK, |
| 734 OnUDPSocketRecvFromACK) |
| 735 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_SendToACK, OnUDPSocketSendToACK) |
| 688 #if defined(OS_MACOSX) | 736 #if defined(OS_MACOSX) |
| 689 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 737 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 690 #endif | 738 #endif |
| 691 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 739 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
| 692 OnSetHistoryLengthAndPrune) | 740 OnSetHistoryLengthAndPrune) |
| 693 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 741 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 694 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK) | 742 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK) |
| 695 IPC_MESSAGE_HANDLER(ViewMsg_MouseLockLost, OnMouseLockLost) | 743 IPC_MESSAGE_HANDLER(ViewMsg_MouseLockLost, OnMouseLockLost) |
| 696 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 744 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
| 697 | 745 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 } else { | 811 } else { |
| 764 // Navigate to the given URL. | 812 // Navigate to the given URL. |
| 765 WebURLRequest request(params.url); | 813 WebURLRequest request(params.url); |
| 766 | 814 |
| 767 // A session history navigation should have been accompanied by state. | 815 // A session history navigation should have been accompanied by state. |
| 768 DCHECK_EQ(params.page_id, -1); | 816 DCHECK_EQ(params.page_id, -1); |
| 769 | 817 |
| 770 if (main_frame->isViewSourceModeEnabled()) | 818 if (main_frame->isViewSourceModeEnabled()) |
| 771 request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); | 819 request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); |
| 772 | 820 |
| 773 if (params.referrer.is_valid()) { | 821 if (params.referrer.url.is_valid()) { |
| 774 if (!WebSecurityPolicy::shouldHideReferrer( | 822 WebString referrer = WebSecurityPolicy::generateReferrerHeader( |
| 775 params.url, | 823 params.referrer.policy, |
| 776 WebString::fromUTF8(params.referrer.spec()))) { | 824 params.url, |
| 777 request.setHTTPHeaderField(WebString::fromUTF8("Referer"), | 825 WebString::fromUTF8(params.referrer.url.spec())); |
| 778 WebString::fromUTF8(params.referrer.spec())); | 826 if (!referrer.isEmpty()) |
| 779 } | 827 request.setHTTPHeaderField(WebString::fromUTF8("Referer"), referrer); |
| 780 } | 828 } |
| 781 | 829 |
| 782 if (!params.extra_headers.empty()) { | 830 if (!params.extra_headers.empty()) { |
| 783 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), | 831 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), |
| 784 params.extra_headers.end(), "\n"); | 832 params.extra_headers.end(), "\n"); |
| 785 i.GetNext(); ) { | 833 i.GetNext(); ) { |
| 786 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), | 834 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), |
| 787 WebString::fromUTF8(i.values())); | 835 WebString::fromUTF8(i.values())); |
| 788 } | 836 } |
| 789 } | 837 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 // MANUAL_SUBFRAME, it will be that same transition type here. | 1183 // MANUAL_SUBFRAME, it will be that same transition type here. |
| 1136 // We don't want that, because any navigation that changes the toplevel | 1184 // We don't want that, because any navigation that changes the toplevel |
| 1137 // frame should be tracked as a toplevel navigation (this allows us to | 1185 // frame should be tracked as a toplevel navigation (this allows us to |
| 1138 // update the URL bar, etc). | 1186 // update the URL bar, etc). |
| 1139 params.transition = content::PAGE_TRANSITION_LINK; | 1187 params.transition = content::PAGE_TRANSITION_LINK; |
| 1140 } | 1188 } |
| 1141 | 1189 |
| 1142 // If we have a valid consumed client redirect source, | 1190 // If we have a valid consumed client redirect source, |
| 1143 // the page contained a client redirect (meta refresh, document.loc...), | 1191 // the page contained a client redirect (meta refresh, document.loc...), |
| 1144 // so we set the referrer and transition to match. | 1192 // so we set the referrer and transition to match. |
| 1145 if (completed_client_redirect_src_.is_valid()) { | 1193 if (completed_client_redirect_src_.url.is_valid()) { |
| 1146 DCHECK(completed_client_redirect_src_ == params.redirects[0]); | 1194 DCHECK(completed_client_redirect_src_.url == params.redirects[0]); |
| 1147 params.referrer = completed_client_redirect_src_; | 1195 params.referrer = completed_client_redirect_src_; |
| 1148 params.transition = static_cast<content::PageTransition>( | 1196 params.transition = static_cast<content::PageTransition>( |
| 1149 params.transition | content::PAGE_TRANSITION_CLIENT_REDIRECT); | 1197 params.transition | content::PAGE_TRANSITION_CLIENT_REDIRECT); |
| 1150 } else { | 1198 } else { |
| 1151 // Bug 654101: the referrer will be empty on https->http transitions. It | 1199 // Bug 654101: the referrer will be empty on https->http transitions. It |
| 1152 // would be nice if we could get the real referrer from somewhere. | 1200 // would be nice if we could get the real referrer from somewhere. |
| 1153 params.referrer = GURL( | 1201 params.referrer = Referrer(GURL( |
| 1154 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 1202 original_request.httpHeaderField(WebString::fromUTF8("Referer"))), |
| 1203 getReferrerPolicyFromRequest(original_request)); |
| 1155 } | 1204 } |
| 1156 | 1205 |
| 1157 string16 method = request.httpMethod(); | 1206 string16 method = request.httpMethod(); |
| 1158 if (EqualsASCII(method, "POST")) | 1207 if (EqualsASCII(method, "POST")) |
| 1159 params.is_post = true; | 1208 params.is_post = true; |
| 1160 | 1209 |
| 1161 // Save some histogram data so we can compute the average memory used per | 1210 // Save some histogram data so we can compute the average memory used per |
| 1162 // page load of the glyphs. | 1211 // page load of the glyphs. |
| 1163 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 1212 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
| 1164 webkit_glue::GetGlyphPageCount()); | 1213 webkit_glue::GetGlyphPageCount()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 webview()->mainFrame()->previousHistoryItem(); | 1278 webview()->mainFrame()->previousHistoryItem(); |
| 1230 if (item.isNull()) | 1279 if (item.isNull()) |
| 1231 return; | 1280 return; |
| 1232 | 1281 |
| 1233 Send(new ViewHostMsg_UpdateState( | 1282 Send(new ViewHostMsg_UpdateState( |
| 1234 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | 1283 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
| 1235 } | 1284 } |
| 1236 | 1285 |
| 1237 void RenderViewImpl::OpenURL(WebFrame* frame, | 1286 void RenderViewImpl::OpenURL(WebFrame* frame, |
| 1238 const GURL& url, | 1287 const GURL& url, |
| 1239 const GURL& referrer, | 1288 const Referrer& referrer, |
| 1240 WebNavigationPolicy policy) { | 1289 WebNavigationPolicy policy) { |
| 1241 Send(new ViewHostMsg_OpenURL( | 1290 Send(new ViewHostMsg_OpenURL( |
| 1242 routing_id_, | 1291 routing_id_, |
| 1243 url, | 1292 url, |
| 1244 referrer, | 1293 referrer, |
| 1245 NavigationPolicyToDisposition(policy), | 1294 NavigationPolicyToDisposition(policy), |
| 1246 frame->identifier())); | 1295 frame->identifier())); |
| 1247 } | 1296 } |
| 1248 | 1297 |
| 1249 // WebViewDelegate ------------------------------------------------------------ | 1298 // WebViewDelegate ------------------------------------------------------------ |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 | 2022 |
| 1974 void RenderViewImpl::loadURLExternally( | 2023 void RenderViewImpl::loadURLExternally( |
| 1975 WebFrame* frame, const WebURLRequest& request, | 2024 WebFrame* frame, const WebURLRequest& request, |
| 1976 WebNavigationPolicy policy, | 2025 WebNavigationPolicy policy, |
| 1977 const WebString& suggested_name) { | 2026 const WebString& suggested_name) { |
| 1978 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2027 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); |
| 1979 if (policy == WebKit::WebNavigationPolicyDownload) { | 2028 if (policy == WebKit::WebNavigationPolicyDownload) { |
| 1980 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, | 2029 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer, |
| 1981 suggested_name)); | 2030 suggested_name)); |
| 1982 } else { | 2031 } else { |
| 1983 OpenURL(frame, request.url(), referrer, policy); | 2032 OpenURL(frame, request.url(), |
| 2033 Referrer(referrer, getReferrerPolicyFromRequest(request)), policy); |
| 1984 } | 2034 } |
| 1985 } | 2035 } |
| 1986 | 2036 |
| 1987 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 2037 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
| 1988 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 2038 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
| 1989 const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) { | 2039 const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) { |
| 1990 // TODO(creis): Remove this when we fix OnSwapOut to not need a navigation. | 2040 // TODO(creis): Remove this when we fix OnSwapOut to not need a navigation. |
| 1991 if (is_swapped_out_) { | 2041 if (is_swapped_out_) { |
| 1992 DCHECK(request.url() == GURL("about:swappedout")); | 2042 DCHECK(request.url() == GURL("about:swappedout")); |
| 1993 return default_policy; | 2043 return default_policy; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2010 // boundaries. This is currently expected to break some script calls and | 2060 // boundaries. This is currently expected to break some script calls and |
| 2011 // navigations, such as form submissions. | 2061 // navigations, such as form submissions. |
| 2012 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2062 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 2013 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) && | 2063 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) && |
| 2014 !frame->parent() && (is_content_initiated || is_redirect)) { | 2064 !frame->parent() && (is_content_initiated || is_redirect)) { |
| 2015 WebString origin_str = frame->document().securityOrigin().toString(); | 2065 WebString origin_str = frame->document().securityOrigin().toString(); |
| 2016 GURL frame_url(origin_str.utf8().data()); | 2066 GURL frame_url(origin_str.utf8().data()); |
| 2017 // TODO(cevans): revisit whether this origin check is still necessary once | 2067 // TODO(cevans): revisit whether this origin check is still necessary once |
| 2018 // crbug.com/101395 is fixed. | 2068 // crbug.com/101395 is fixed. |
| 2019 if (frame_url.GetOrigin() != url.GetOrigin()) { | 2069 if (frame_url.GetOrigin() != url.GetOrigin()) { |
| 2020 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2070 Referrer referrer( |
| 2071 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
| 2072 getReferrerPolicyFromRequest(request)); |
| 2021 OpenURL(frame, url, referrer, default_policy); | 2073 OpenURL(frame, url, referrer, default_policy); |
| 2022 return WebKit::WebNavigationPolicyIgnore; | 2074 return WebKit::WebNavigationPolicyIgnore; |
| 2023 } | 2075 } |
| 2024 } | 2076 } |
| 2025 | 2077 |
| 2026 // If the browser is interested, then give it a chance to look at top level | 2078 // If the browser is interested, then give it a chance to look at top level |
| 2027 // navigations. | 2079 // navigations. |
| 2028 if (is_content_initiated && | 2080 if (is_content_initiated && |
| 2029 renderer_preferences_.browser_handles_top_level_requests && | 2081 renderer_preferences_.browser_handles_top_level_requests && |
| 2030 IsNonLocalTopLevelNavigation(url, frame, type)) { | 2082 IsNonLocalTopLevelNavigation(url, frame, type)) { |
| 2031 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2083 Referrer referrer( |
| 2084 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
| 2085 getReferrerPolicyFromRequest(request)); |
| 2032 // Reset these counters as the RenderView could be reused for the next | 2086 // Reset these counters as the RenderView could be reused for the next |
| 2033 // navigation. | 2087 // navigation. |
| 2034 page_id_ = -1; | 2088 page_id_ = -1; |
| 2035 last_page_id_sent_to_browser_ = -1; | 2089 last_page_id_sent_to_browser_ = -1; |
| 2036 OpenURL(frame, url, referrer, default_policy); | 2090 OpenURL(frame, url, referrer, default_policy); |
| 2037 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2091 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
| 2038 } | 2092 } |
| 2039 | 2093 |
| 2040 // Detect when we're crossing a permission-based boundary (e.g. into or out of | 2094 // Detect when we're crossing a permission-based boundary (e.g. into or out of |
| 2041 // an extension or app origin, leaving a WebUI page, etc). We only care about | 2095 // an extension or app origin, leaving a WebUI page, etc). We only care about |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2069 | 2123 |
| 2070 if (!should_fork) { | 2124 if (!should_fork) { |
| 2071 // Give the embedder a chance. | 2125 // Give the embedder a chance. |
| 2072 bool is_initial_navigation = page_id_ == -1; | 2126 bool is_initial_navigation = page_id_ == -1; |
| 2073 should_fork = content::GetContentClient()->renderer()->ShouldFork( | 2127 should_fork = content::GetContentClient()->renderer()->ShouldFork( |
| 2074 frame, url, is_content_initiated, is_initial_navigation, | 2128 frame, url, is_content_initiated, is_initial_navigation, |
| 2075 &send_referrer); | 2129 &send_referrer); |
| 2076 } | 2130 } |
| 2077 | 2131 |
| 2078 if (should_fork) { | 2132 if (should_fork) { |
| 2079 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2133 Referrer referrer( |
| 2080 OpenURL(frame, url, send_referrer ? referrer : GURL(), default_policy); | 2134 GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
| 2135 getReferrerPolicyFromRequest(request)); |
| 2136 OpenURL( |
| 2137 frame, url, send_referrer ? referrer : Referrer(), default_policy); |
| 2081 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2138 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
| 2082 } | 2139 } |
| 2083 } | 2140 } |
| 2084 | 2141 |
| 2085 // Use the frame's original request's URL rather than the document's URL for | 2142 // Use the frame's original request's URL rather than the document's URL for |
| 2086 // this check. For a popup, the document's URL may become the opener window's | 2143 // this check. For a popup, the document's URL may become the opener window's |
| 2087 // URL if the opener has called document.write. See http://crbug.com/93517. | 2144 // URL if the opener has called document.write. See http://crbug.com/93517. |
| 2088 GURL old_url(frame->dataSource()->request().url()); | 2145 GURL old_url(frame->dataSource()->request().url()); |
| 2089 | 2146 |
| 2090 // Detect when a page is "forking" a new tab that can be safely rendered in | 2147 // Detect when a page is "forking" a new tab that can be safely rendered in |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 frame->name().isNull() && | 2197 frame->name().isNull() && |
| 2141 // Another frame (with a non-empty creator) should have initiated the | 2198 // Another frame (with a non-empty creator) should have initiated the |
| 2142 // request, targeted at this frame. | 2199 // request, targeted at this frame. |
| 2143 !creator_url_.is_empty() && | 2200 !creator_url_.is_empty() && |
| 2144 is_content_initiated && | 2201 is_content_initiated && |
| 2145 default_policy == WebKit::WebNavigationPolicyCurrentTab && | 2202 default_policy == WebKit::WebNavigationPolicyCurrentTab && |
| 2146 type == WebKit::WebNavigationTypeOther; | 2203 type == WebKit::WebNavigationTypeOther; |
| 2147 | 2204 |
| 2148 if (is_fork || is_noreferrer_and_blank_target) { | 2205 if (is_fork || is_noreferrer_and_blank_target) { |
| 2149 // Open the URL via the browser, not via WebKit. | 2206 // Open the URL via the browser, not via WebKit. |
| 2150 OpenURL(frame, url, GURL(), default_policy); | 2207 OpenURL(frame, url, Referrer(), default_policy); |
| 2151 return WebKit::WebNavigationPolicyIgnore; | 2208 return WebKit::WebNavigationPolicyIgnore; |
| 2152 } | 2209 } |
| 2153 | 2210 |
| 2154 return default_policy; | 2211 return default_policy; |
| 2155 } | 2212 } |
| 2156 | 2213 |
| 2157 bool RenderViewImpl::canHandleRequest( | 2214 bool RenderViewImpl::canHandleRequest( |
| 2158 WebFrame* frame, const WebURLRequest& request) { | 2215 WebFrame* frame, const WebURLRequest& request) { |
| 2159 // We allow WebKit to think that everything can be handled even though | 2216 // We allow WebKit to think that everything can be handled even though |
| 2160 // browser-side we limit what we load. | 2217 // browser-side we limit what we load. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2238 WillPerformClientRedirect(frame, from, to, interval, fire_time)); | 2295 WillPerformClientRedirect(frame, from, to, interval, fire_time)); |
| 2239 } | 2296 } |
| 2240 | 2297 |
| 2241 void RenderViewImpl::didCancelClientRedirect(WebFrame* frame) { | 2298 void RenderViewImpl::didCancelClientRedirect(WebFrame* frame) { |
| 2242 FOR_EACH_OBSERVER( | 2299 FOR_EACH_OBSERVER( |
| 2243 RenderViewObserver, observers_, DidCancelClientRedirect(frame)); | 2300 RenderViewObserver, observers_, DidCancelClientRedirect(frame)); |
| 2244 } | 2301 } |
| 2245 | 2302 |
| 2246 void RenderViewImpl::didCompleteClientRedirect( | 2303 void RenderViewImpl::didCompleteClientRedirect( |
| 2247 WebFrame* frame, const WebURL& from) { | 2304 WebFrame* frame, const WebURL& from) { |
| 2248 if (!frame->parent()) | 2305 if (!frame->parent()) { |
| 2249 completed_client_redirect_src_ = from; | 2306 WebDataSource* ds = frame->provisionalDataSource(); |
| 2307 CHECK(ds); |
| 2308 completed_client_redirect_src_ = |
| 2309 Referrer(from, getReferrerPolicyFromRequest(ds->request())); |
| 2310 } |
| 2250 FOR_EACH_OBSERVER( | 2311 FOR_EACH_OBSERVER( |
| 2251 RenderViewObserver, observers_, DidCompleteClientRedirect(frame, from)); | 2312 RenderViewObserver, observers_, DidCompleteClientRedirect(frame, from)); |
| 2252 } | 2313 } |
| 2253 | 2314 |
| 2254 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { | 2315 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { |
| 2255 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2316 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2256 if (!document_state) { | 2317 if (!document_state) { |
| 2257 document_state = new DocumentState; | 2318 document_state = new DocumentState; |
| 2258 ds->setExtraData(document_state); | 2319 ds->setExtraData(document_state); |
| 2259 } | 2320 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 | 2430 |
| 2370 // Start time is only set after request time. | 2431 // Start time is only set after request time. |
| 2371 document_state->set_start_load_time(Time::Now()); | 2432 document_state->set_start_load_time(Time::Now()); |
| 2372 | 2433 |
| 2373 bool is_top_most = !frame->parent(); | 2434 bool is_top_most = !frame->parent(); |
| 2374 if (is_top_most) { | 2435 if (is_top_most) { |
| 2375 navigation_gesture_ = frame->isProcessingUserGesture() ? | 2436 navigation_gesture_ = frame->isProcessingUserGesture() ? |
| 2376 NavigationGestureUser : NavigationGestureAuto; | 2437 NavigationGestureUser : NavigationGestureAuto; |
| 2377 | 2438 |
| 2378 // Make sure redirect tracking state is clear for the new load. | 2439 // Make sure redirect tracking state is clear for the new load. |
| 2379 completed_client_redirect_src_ = GURL(); | 2440 completed_client_redirect_src_ = Referrer(); |
| 2380 } else if (frame->parent()->isLoading()) { | 2441 } else if (frame->parent()->isLoading()) { |
| 2381 // Take note of AUTO_SUBFRAME loads here, so that we can know how to | 2442 // Take note of AUTO_SUBFRAME loads here, so that we can know how to |
| 2382 // load an error page. See didFailProvisionalLoad. | 2443 // load an error page. See didFailProvisionalLoad. |
| 2383 document_state->navigation_state()->set_transition_type( | 2444 document_state->navigation_state()->set_transition_type( |
| 2384 content::PAGE_TRANSITION_AUTO_SUBFRAME); | 2445 content::PAGE_TRANSITION_AUTO_SUBFRAME); |
| 2385 } | 2446 } |
| 2386 | 2447 |
| 2387 FOR_EACH_OBSERVER( | 2448 FOR_EACH_OBSERVER( |
| 2388 RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); | 2449 RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); |
| 2389 | 2450 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2559 // the session history again. We do this regardless of whether this is | 2620 // the session history again. We do this regardless of whether this is |
| 2560 // a session history navigation, because if we attempted a session history | 2621 // a session history navigation, because if we attempted a session history |
| 2561 // navigation without valid HistoryItem state, WebCore will think it is a | 2622 // navigation without valid HistoryItem state, WebCore will think it is a |
| 2562 // new navigation. | 2623 // new navigation. |
| 2563 navigation_state->set_request_committed(true); | 2624 navigation_state->set_request_committed(true); |
| 2564 | 2625 |
| 2565 UpdateURL(frame); | 2626 UpdateURL(frame); |
| 2566 | 2627 |
| 2567 // If this committed load was initiated by a client redirect, we're | 2628 // If this committed load was initiated by a client redirect, we're |
| 2568 // at the last stop now, so clear it. | 2629 // at the last stop now, so clear it. |
| 2569 completed_client_redirect_src_ = GURL(); | 2630 completed_client_redirect_src_ = Referrer(); |
| 2570 | 2631 |
| 2571 // Check whether we have new encoding name. | 2632 // Check whether we have new encoding name. |
| 2572 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2633 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 2573 } | 2634 } |
| 2574 | 2635 |
| 2575 void RenderViewImpl::didClearWindowObject(WebFrame* frame) { | 2636 void RenderViewImpl::didClearWindowObject(WebFrame* frame) { |
| 2576 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2637 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2577 DidClearWindowObject(frame)); | 2638 DidClearWindowObject(frame)); |
| 2578 | 2639 |
| 2579 GURL frame_url = frame->document().url(); | 2640 GURL frame_url = frame->document().url(); |
| (...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3920 void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( | 3981 void RenderViewImpl::OnGetAllSavableResourceLinksForCurrentPage( |
| 3921 const GURL& page_url) { | 3982 const GURL& page_url) { |
| 3922 // Prepare list to storage all savable resource links. | 3983 // Prepare list to storage all savable resource links. |
| 3923 std::vector<GURL> resources_list; | 3984 std::vector<GURL> resources_list; |
| 3924 std::vector<GURL> referrers_list; | 3985 std::vector<GURL> referrers_list; |
| 3925 std::vector<GURL> frames_list; | 3986 std::vector<GURL> frames_list; |
| 3926 webkit_glue::SavableResourcesResult result(&resources_list, | 3987 webkit_glue::SavableResourcesResult result(&resources_list, |
| 3927 &referrers_list, | 3988 &referrers_list, |
| 3928 &frames_list); | 3989 &frames_list); |
| 3929 | 3990 |
| 3991 // FIXME(rdsmith): When GetAllSavableResourceLinksForCurrentPage starts to |
| 3992 // return referrers, it should also return the referrer policies. |
| 3930 if (!webkit_glue::GetAllSavableResourceLinksForCurrentPage( | 3993 if (!webkit_glue::GetAllSavableResourceLinksForCurrentPage( |
| 3931 webview(), | 3994 webview(), |
| 3932 page_url, | 3995 page_url, |
| 3933 &result, | 3996 &result, |
| 3934 chrome::GetSavableSchemes())) { | 3997 chrome::GetSavableSchemes())) { |
| 3935 // If something is wrong when collecting all savable resource links, | 3998 // If something is wrong when collecting all savable resource links, |
| 3936 // send empty list to embedder(browser) to tell it failed. | 3999 // send empty list to embedder(browser) to tell it failed. |
| 3937 referrers_list.clear(); | 4000 referrers_list.clear(); |
| 3938 resources_list.clear(); | 4001 resources_list.clear(); |
| 3939 frames_list.clear(); | 4002 frames_list.clear(); |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4707 const PP_NetAddress_Private& local_addr, | 4770 const PP_NetAddress_Private& local_addr, |
| 4708 const PP_NetAddress_Private& remote_addr) { | 4771 const PP_NetAddress_Private& remote_addr) { |
| 4709 pepper_delegate_.OnConnectTcpACK( | 4772 pepper_delegate_.OnConnectTcpACK( |
| 4710 request_id, | 4773 request_id, |
| 4711 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), | 4774 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), |
| 4712 local_addr, | 4775 local_addr, |
| 4713 remote_addr); | 4776 remote_addr); |
| 4714 } | 4777 } |
| 4715 #endif | 4778 #endif |
| 4716 | 4779 |
| 4780 void RenderViewImpl::OnTCPSocketConnectACK( |
| 4781 uint32 plugin_dispatcher_id, |
| 4782 uint32 socket_id, |
| 4783 bool succeeded, |
| 4784 const PP_NetAddress_Private& local_addr, |
| 4785 const PP_NetAddress_Private& remote_addr) { |
| 4786 pepper_delegate_.OnTCPSocketConnectACK( |
| 4787 socket_id, succeeded, local_addr, remote_addr); |
| 4788 } |
| 4789 |
| 4790 void RenderViewImpl::OnTCPSocketSSLHandshakeACK( |
| 4791 uint32 plugin_dispatcher_id, |
| 4792 uint32 socket_id, |
| 4793 bool succeeded) { |
| 4794 pepper_delegate_.OnTCPSocketSSLHandshakeACK(socket_id, succeeded); |
| 4795 } |
| 4796 |
| 4797 void RenderViewImpl::OnTCPSocketReadACK(uint32 plugin_dispatcher_id, |
| 4798 uint32 socket_id, |
| 4799 bool succeeded, |
| 4800 const std::string& data) { |
| 4801 pepper_delegate_.OnTCPSocketReadACK(socket_id, succeeded, data); |
| 4802 } |
| 4803 |
| 4804 void RenderViewImpl::OnTCPSocketWriteACK(uint32 plugin_dispatcher_id, |
| 4805 uint32 socket_id, |
| 4806 bool succeeded, |
| 4807 int32_t bytes_written) { |
| 4808 pepper_delegate_.OnTCPSocketWriteACK(socket_id, succeeded, bytes_written); |
| 4809 } |
| 4810 |
| 4811 void RenderViewImpl::OnUDPSocketBindACK(uint32 plugin_dispatcher_id, |
| 4812 uint32 socket_id, |
| 4813 bool succeeded) { |
| 4814 pepper_delegate_.OnUDPSocketBindACK(socket_id, succeeded); |
| 4815 } |
| 4816 |
| 4817 void RenderViewImpl::OnUDPSocketRecvFromACK( |
| 4818 uint32 plugin_dispatcher_id, |
| 4819 uint32 socket_id, |
| 4820 bool succeeded, |
| 4821 const std::string& data, |
| 4822 const PP_NetAddress_Private& remote_addr) { |
| 4823 pepper_delegate_.OnUDPSocketRecvFromACK(socket_id, |
| 4824 succeeded, |
| 4825 data, |
| 4826 remote_addr); |
| 4827 } |
| 4828 |
| 4829 void RenderViewImpl::OnUDPSocketSendToACK(uint32 plugin_dispatcher_id, |
| 4830 uint32 socket_id, |
| 4831 bool succeeded, |
| 4832 int32_t bytes_written) { |
| 4833 pepper_delegate_.OnUDPSocketSendToACK(socket_id, succeeded, bytes_written); |
| 4834 } |
| 4835 |
| 4717 void RenderViewImpl::OnContextMenuClosed( | 4836 void RenderViewImpl::OnContextMenuClosed( |
| 4718 const webkit_glue::CustomContextMenuContext& custom_context) { | 4837 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4719 if (custom_context.is_pepper_menu) | 4838 if (custom_context.is_pepper_menu) |
| 4720 pepper_delegate_.OnContextMenuClosed(custom_context); | 4839 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4721 else | 4840 else |
| 4722 context_menu_node_.reset(); | 4841 context_menu_node_.reset(); |
| 4723 } | 4842 } |
| 4724 | 4843 |
| 4725 void RenderViewImpl::OnEnableViewSourceMode() { | 4844 void RenderViewImpl::OnEnableViewSourceMode() { |
| 4726 if (!webview()) | 4845 if (!webview()) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4752 return !!RenderThreadImpl::current()->compositor_thread(); | 4871 return !!RenderThreadImpl::current()->compositor_thread(); |
| 4753 } | 4872 } |
| 4754 | 4873 |
| 4755 void RenderViewImpl::OnJavaBridgeInit( | 4874 void RenderViewImpl::OnJavaBridgeInit( |
| 4756 const IPC::ChannelHandle& channel_handle) { | 4875 const IPC::ChannelHandle& channel_handle) { |
| 4757 DCHECK(!java_bridge_dispatcher_.get()); | 4876 DCHECK(!java_bridge_dispatcher_.get()); |
| 4758 #if defined(ENABLE_JAVA_BRIDGE) | 4877 #if defined(ENABLE_JAVA_BRIDGE) |
| 4759 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4878 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
| 4760 #endif | 4879 #endif |
| 4761 } | 4880 } |
| OLD | NEW |