| 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 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 | 2677 |
| 2678 void RenderFrameImpl::SetEngagementLevel(const url::Origin& origin, | 2678 void RenderFrameImpl::SetEngagementLevel(const url::Origin& origin, |
| 2679 blink::mojom::EngagementLevel level) { | 2679 blink::mojom::EngagementLevel level) { |
| 2680 // Set the engagement level on |frame_| if its origin matches the one we have | 2680 // Set the engagement level on |frame_| if its origin matches the one we have |
| 2681 // been provided with. | 2681 // been provided with. |
| 2682 if (frame_ && url::Origin(frame_->getSecurityOrigin()) == origin) { | 2682 if (frame_ && url::Origin(frame_->getSecurityOrigin()) == origin) { |
| 2683 frame_->setEngagementLevel(level); | 2683 frame_->setEngagementLevel(level); |
| 2684 return; | 2684 return; |
| 2685 } | 2685 } |
| 2686 | 2686 |
| 2687 engagement_levels_[origin] = level; | 2687 engagement_level_ = std::make_pair(origin, level); |
| 2688 } | 2688 } |
| 2689 | 2689 |
| 2690 // mojom::Frame implementation ------------------------------------------------- | 2690 // mojom::Frame implementation ------------------------------------------------- |
| 2691 | 2691 |
| 2692 void RenderFrameImpl::GetInterfaceProvider( | 2692 void RenderFrameImpl::GetInterfaceProvider( |
| 2693 service_manager::mojom::InterfaceProviderRequest request) { | 2693 service_manager::mojom::InterfaceProviderRequest request) { |
| 2694 service_manager::ServiceInfo child_info = | 2694 service_manager::ServiceInfo child_info = |
| 2695 ChildThreadImpl::current()->GetChildServiceInfo(); | 2695 ChildThreadImpl::current()->GetChildServiceInfo(); |
| 2696 service_manager::ServiceInfo browser_info = | 2696 service_manager::ServiceInfo browser_info = |
| 2697 ChildThreadImpl::current()->GetBrowserServiceInfo(); | 2697 ChildThreadImpl::current()->GetBrowserServiceInfo(); |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4819 | 4819 |
| 4820 const WebURLRequest& request = ds->getRequest(); | 4820 const WebURLRequest& request = ds->getRequest(); |
| 4821 const WebURLResponse& response = ds->response(); | 4821 const WebURLResponse& response = ds->response(); |
| 4822 | 4822 |
| 4823 DocumentState* document_state = DocumentState::FromDataSource(ds); | 4823 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 4824 NavigationStateImpl* navigation_state = | 4824 NavigationStateImpl* navigation_state = |
| 4825 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 4825 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| 4826 InternalDocumentStateData* internal_data = | 4826 InternalDocumentStateData* internal_data = |
| 4827 InternalDocumentStateData::FromDocumentState(document_state); | 4827 InternalDocumentStateData::FromDocumentState(document_state); |
| 4828 | 4828 |
| 4829 // Set the correct engagement level on the frame. | 4829 // Set the correct engagement level on the frame, and wipe the cached origin |
| 4830 EngagementLevels::iterator engagement_level = | 4830 // so this will not be reused accidentally. |
| 4831 engagement_levels_.find(url::Origin(frame_->getSecurityOrigin())); | 4831 if (url::Origin(frame_->getSecurityOrigin()) == engagement_level_.first) { |
| 4832 | 4832 frame_->setEngagementLevel(engagement_level_.second); |
| 4833 if (engagement_level != engagement_levels_.end()) | 4833 engagement_level_.first = url::Origin(); |
| 4834 frame_->setEngagementLevel(engagement_level->second); | 4834 } |
| 4835 engagement_levels_.clear(); | |
| 4836 | 4835 |
| 4837 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 4836 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 4838 params.http_status_code = response.httpStatusCode(); | 4837 params.http_status_code = response.httpStatusCode(); |
| 4839 params.url_is_unreachable = ds->hasUnreachableURL(); | 4838 params.url_is_unreachable = ds->hasUnreachableURL(); |
| 4840 params.method = "GET"; | 4839 params.method = "GET"; |
| 4841 params.intended_as_new_entry = | 4840 params.intended_as_new_entry = |
| 4842 navigation_state->request_params().intended_as_new_entry; | 4841 navigation_state->request_params().intended_as_new_entry; |
| 4843 params.did_create_new_entry = commit_type == blink::WebStandardCommit; | 4842 params.did_create_new_entry = commit_type == blink::WebStandardCommit; |
| 4844 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); | 4843 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); |
| 4845 params.post_id = -1; | 4844 params.post_id = -1; |
| (...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6874 // event target. Potentially a Pepper plugin will receive the event. | 6873 // event target. Potentially a Pepper plugin will receive the event. |
| 6875 // In order to tell whether a plugin gets the last mouse event and which it | 6874 // In order to tell whether a plugin gets the last mouse event and which it |
| 6876 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6875 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6877 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6876 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6878 // |pepper_last_mouse_event_target_|. | 6877 // |pepper_last_mouse_event_target_|. |
| 6879 pepper_last_mouse_event_target_ = nullptr; | 6878 pepper_last_mouse_event_target_ = nullptr; |
| 6880 #endif | 6879 #endif |
| 6881 } | 6880 } |
| 6882 | 6881 |
| 6883 } // namespace content | 6882 } // namespace content |
| OLD | NEW |