OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3556 blink::WebLocalFrame* frame, | 3556 blink::WebLocalFrame* frame, |
3557 unsigned identifier, | 3557 unsigned identifier, |
3558 blink::WebURLRequest& request, | 3558 blink::WebURLRequest& request, |
3559 const blink::WebURLResponse& redirect_response) { | 3559 const blink::WebURLResponse& redirect_response) { |
3560 DCHECK(!frame_ || frame_ == frame); | 3560 DCHECK(!frame_ || frame_ == frame); |
3561 // The request my be empty during tests. | 3561 // The request my be empty during tests. |
3562 if (request.url().isEmpty()) | 3562 if (request.url().isEmpty()) |
3563 return; | 3563 return; |
3564 | 3564 |
3565 // Set the first party for cookies url if it has not been set yet (new | 3565 // Set the first party for cookies url if it has not been set yet (new |
3566 // requests). For redirects, it is updated by WebURLLoaderImpl. | 3566 // requests). This value will be updated during redirects, consistent with |
| 3567 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 |
3567 if (request.firstPartyForCookies().isEmpty()) { | 3568 if (request.firstPartyForCookies().isEmpty()) { |
3568 if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) { | 3569 if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) { |
3569 request.setFirstPartyForCookies(request.url()); | 3570 request.setFirstPartyForCookies(request.url()); |
3570 } else { | 3571 } else { |
3571 // TODO(nasko): When the top-level frame is remote, there is no document. | 3572 // TODO(nasko): When the top-level frame is remote, there is no document. |
3572 // This is broken and should be fixed to propagate the first party. | 3573 // This is broken and should be fixed to propagate the first party. |
3573 WebFrame* top = frame->top(); | 3574 WebFrame* top = frame->top(); |
3574 if (top->isWebLocalFrame()) { | 3575 if (top->isWebLocalFrame()) { |
3575 request.setFirstPartyForCookies( | 3576 request.setFirstPartyForCookies( |
3576 frame->top()->document().firstPartyForCookies()); | 3577 frame->top()->document().firstPartyForCookies()); |
3577 } | 3578 } |
3578 } | 3579 } |
| 3580 |
| 3581 // If we need to set the first party, then we need to set the request's |
| 3582 // initiator as well; it will not be updated during redirects. |
| 3583 request.setRequestorOrigin(frame->document().securityOrigin()); |
3579 } | 3584 } |
3580 | 3585 |
3581 WebDataSource* provisional_data_source = frame->provisionalDataSource(); | 3586 WebDataSource* provisional_data_source = frame->provisionalDataSource(); |
3582 WebDataSource* data_source = | 3587 WebDataSource* data_source = |
3583 provisional_data_source ? provisional_data_source : frame->dataSource(); | 3588 provisional_data_source ? provisional_data_source : frame->dataSource(); |
3584 | 3589 |
3585 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 3590 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
3586 DCHECK(document_state); | 3591 DCHECK(document_state); |
3587 InternalDocumentStateData* internal_data = | 3592 InternalDocumentStateData* internal_data = |
3588 InternalDocumentStateData::FromDocumentState(document_state); | 3593 InternalDocumentStateData::FromDocumentState(document_state); |
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5718 media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5723 media::ConvertToSwitchOutputDeviceCB(web_callbacks); |
5719 scoped_refptr<media::AudioOutputDevice> device = | 5724 scoped_refptr<media::AudioOutputDevice> device = |
5720 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5725 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), |
5721 security_origin); | 5726 security_origin); |
5722 media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5727 media::OutputDeviceStatus status = device->GetDeviceStatus(); |
5723 device->Stop(); | 5728 device->Stop(); |
5724 callback.Run(status); | 5729 callback.Run(status); |
5725 } | 5730 } |
5726 | 5731 |
5727 } // namespace content | 5732 } // namespace content |
OLD | NEW |