Chromium Code Reviews| 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 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2670 | 2670 |
| 2671 void RenderFrameImpl::SetEngagementLevel(const url::Origin& origin, | 2671 void RenderFrameImpl::SetEngagementLevel(const url::Origin& origin, |
| 2672 blink::mojom::EngagementLevel level) { | 2672 blink::mojom::EngagementLevel level) { |
| 2673 // Set the engagement level on |frame_| if its origin matches the one we have | 2673 // Set the engagement level on |frame_| if its origin matches the one we have |
| 2674 // been provided with. | 2674 // been provided with. |
| 2675 if (frame_ && url::Origin(frame_->getSecurityOrigin()) == origin) { | 2675 if (frame_ && url::Origin(frame_->getSecurityOrigin()) == origin) { |
| 2676 frame_->setEngagementLevel(level); | 2676 frame_->setEngagementLevel(level); |
| 2677 return; | 2677 return; |
| 2678 } | 2678 } |
| 2679 | 2679 |
| 2680 engagement_levels_[origin] = level; | 2680 engagement_level_ = std::make_pair(origin, level); |
| 2681 } | 2681 } |
| 2682 | 2682 |
| 2683 // mojom::Frame implementation ------------------------------------------------- | 2683 // mojom::Frame implementation ------------------------------------------------- |
| 2684 | 2684 |
| 2685 void RenderFrameImpl::GetInterfaceProvider( | 2685 void RenderFrameImpl::GetInterfaceProvider( |
| 2686 service_manager::mojom::InterfaceProviderRequest request) { | 2686 service_manager::mojom::InterfaceProviderRequest request) { |
| 2687 service_manager::ServiceInfo child_info = | 2687 service_manager::ServiceInfo child_info = |
| 2688 ChildThreadImpl::current()->GetChildServiceInfo(); | 2688 ChildThreadImpl::current()->GetChildServiceInfo(); |
| 2689 service_manager::ServiceInfo browser_info = | 2689 service_manager::ServiceInfo browser_info = |
| 2690 ChildThreadImpl::current()->GetBrowserServiceInfo(); | 2690 ChildThreadImpl::current()->GetBrowserServiceInfo(); |
| (...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4784 | 4784 |
| 4785 const WebURLRequest& request = ds->getRequest(); | 4785 const WebURLRequest& request = ds->getRequest(); |
| 4786 const WebURLResponse& response = ds->response(); | 4786 const WebURLResponse& response = ds->response(); |
| 4787 | 4787 |
| 4788 DocumentState* document_state = DocumentState::FromDataSource(ds); | 4788 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 4789 NavigationStateImpl* navigation_state = | 4789 NavigationStateImpl* navigation_state = |
| 4790 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 4790 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| 4791 InternalDocumentStateData* internal_data = | 4791 InternalDocumentStateData* internal_data = |
| 4792 InternalDocumentStateData::FromDocumentState(document_state); | 4792 InternalDocumentStateData::FromDocumentState(document_state); |
| 4793 | 4793 |
| 4794 // Set the correct engagement level on the frame. | 4794 // Set the correct engagement level on the frame, and wipe the cached origin |
| 4795 EngagementLevels::iterator engagement_level = | 4795 // so this will not be reused accidentally. |
| 4796 engagement_levels_.find(url::Origin(frame_->getSecurityOrigin())); | 4796 if (url::Origin(frame_->getSecurityOrigin()) == engagement_level_.first) |
| 4797 | 4797 frame_->setEngagementLevel(engagement_level_.second); |
| 4798 if (engagement_level != engagement_levels_.end()) | 4798 engagement_level_.first = url::Origin(); |
|
nasko
2017/01/18 22:33:37
Should this be wiped out every time or just when w
dominickn
2017/01/19 00:34:51
Good point. Changed to wipe only when we used it,
| |
| 4799 frame_->setEngagementLevel(engagement_level->second); | |
| 4800 engagement_levels_.clear(); | |
| 4801 | 4799 |
| 4802 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 4800 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 4803 params.http_status_code = response.httpStatusCode(); | 4801 params.http_status_code = response.httpStatusCode(); |
| 4804 params.url_is_unreachable = ds->hasUnreachableURL(); | 4802 params.url_is_unreachable = ds->hasUnreachableURL(); |
| 4805 params.method = "GET"; | 4803 params.method = "GET"; |
| 4806 params.intended_as_new_entry = | 4804 params.intended_as_new_entry = |
| 4807 navigation_state->request_params().intended_as_new_entry; | 4805 navigation_state->request_params().intended_as_new_entry; |
| 4808 params.did_create_new_entry = commit_type == blink::WebStandardCommit; | 4806 params.did_create_new_entry = commit_type == blink::WebStandardCommit; |
| 4809 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); | 4807 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); |
| 4810 params.post_id = -1; | 4808 params.post_id = -1; |
| (...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6776 // event target. Potentially a Pepper plugin will receive the event. | 6774 // event target. Potentially a Pepper plugin will receive the event. |
| 6777 // In order to tell whether a plugin gets the last mouse event and which it | 6775 // In order to tell whether a plugin gets the last mouse event and which it |
| 6778 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6776 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6779 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6777 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6780 // |pepper_last_mouse_event_target_|. | 6778 // |pepper_last_mouse_event_target_|. |
| 6781 pepper_last_mouse_event_target_ = nullptr; | 6779 pepper_last_mouse_event_target_ = nullptr; |
| 6782 #endif | 6780 #endif |
| 6783 } | 6781 } |
| 6784 | 6782 |
| 6785 } // namespace content | 6783 } // namespace content |
| OLD | NEW |