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/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 // we compare against the last successful commit when deciding whether to swap | 1570 // we compare against the last successful commit when deciding whether to swap |
1571 // this time. | 1571 // this time. |
1572 if (SiteInstance::IsSameWebSite(browser_context, | 1572 if (SiteInstance::IsSameWebSite(browser_context, |
1573 candidate->last_successful_url(), dest_url)) { | 1573 candidate->last_successful_url(), dest_url)) { |
1574 return true; | 1574 return true; |
1575 } | 1575 } |
1576 | 1576 |
1577 // It is possible that last_successful_url() was a nonstandard scheme (for | 1577 // It is possible that last_successful_url() was a nonstandard scheme (for |
1578 // example, "about:blank"). If so, examine the replicated origin to determine | 1578 // example, "about:blank"). If so, examine the replicated origin to determine |
1579 // the site. | 1579 // the site. |
1580 if (!candidate->GetLastCommittedOrigin().unique() && | 1580 if (!candidate->GetLastCommittedOrigin().opaque() && |
1581 SiteInstance::IsSameWebSite( | 1581 SiteInstance::IsSameWebSite( |
1582 browser_context, | 1582 browser_context, |
1583 GURL(candidate->GetLastCommittedOrigin().Serialize()), dest_url)) { | 1583 GURL(candidate->GetLastCommittedOrigin().Serialize()), dest_url)) { |
1584 return true; | 1584 return true; |
1585 } | 1585 } |
1586 | 1586 |
1587 // Not same-site. | 1587 // Not same-site. |
1588 return false; | 1588 return false; |
1589 } | 1589 } |
1590 | 1590 |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 // and the frame being navigated differ, |source_instance| is set to the | 2779 // and the frame being navigated differ, |source_instance| is set to the |
2780 // SiteInstance of the initiating frame. |dest_instance| is present on session | 2780 // SiteInstance of the initiating frame. |dest_instance| is present on session |
2781 // history navigations. The two cannot be set simultaneously. | 2781 // history navigations. The two cannot be set simultaneously. |
2782 DCHECK(!source_instance || !dest_instance); | 2782 DCHECK(!source_instance || !dest_instance); |
2783 | 2783 |
2784 // Don't swap for subframes unless we are in an OOPIF-enabled mode. We can | 2784 // Don't swap for subframes unless we are in an OOPIF-enabled mode. We can |
2785 // get here in tests for subframes (e.g., NavigateFrameToURL). | 2785 // get here in tests for subframes (e.g., NavigateFrameToURL). |
2786 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) | 2786 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
2787 return false; | 2787 return false; |
2788 | 2788 |
2789 // If dest_url is a unique origin like about:blank, then the need for a swap | 2789 // If dest_url is an opaque origin like about:blank, then the need for a swap |
2790 // is determined by the source_instance or dest_instance. | 2790 // is determined by the source_instance or dest_instance. |
2791 GURL resolved_url = dest_url; | 2791 GURL resolved_url = dest_url; |
2792 if (url::Origin(resolved_url).unique()) { | 2792 if (url::Origin(resolved_url).opaque()) { |
2793 if (source_instance) { | 2793 if (source_instance) { |
2794 resolved_url = source_instance->GetSiteURL(); | 2794 resolved_url = source_instance->GetSiteURL(); |
2795 } else if (dest_instance) { | 2795 } else if (dest_instance) { |
2796 resolved_url = dest_instance->GetSiteURL(); | 2796 resolved_url = dest_instance->GetSiteURL(); |
2797 } else { | 2797 } else { |
2798 // If there is no SiteInstance this unique origin can be associated with, | 2798 // If there is no SiteInstance this opaque origin can be associated with, |
2799 // there are two cases: | 2799 // there are two cases: |
2800 // (1) If there was a server redirect, allow a process swap. Normally, | 2800 // (1) If there was a server redirect, allow a process swap. Normally, |
2801 // redirects to data: or about: URLs are disallowed as | 2801 // redirects to data: or about: URLs are disallowed as |
2802 // net::ERR_UNSAFE_REDIRECT. However, extensions can still redirect | 2802 // net::ERR_UNSAFE_REDIRECT. However, extensions can still redirect |
2803 // arbitary requests to those URLs using the chrome.webRequest or | 2803 // arbitary requests to those URLs using the chrome.webRequest or |
2804 // chrome.declarativeWebRequest API, which will end up here (for an | 2804 // chrome.declarativeWebRequest API, which will end up here (for an |
2805 // example, see ExtensionWebRequestApiTest.WebRequestDeclarative1). It's | 2805 // example, see ExtensionWebRequestApiTest.WebRequestDeclarative1). It's |
2806 // safest to swap processes for those redirects if we are in an | 2806 // safest to swap processes for those redirects if we are in an |
2807 // appropriate OOPIF-enabled mode. | 2807 // appropriate OOPIF-enabled mode. |
2808 // | 2808 // |
(...skipping 25 matching lines...) Expand all Loading... |
2834 ->is_hidden() != delegate_->IsHidden()) { | 2834 ->is_hidden() != delegate_->IsHidden()) { |
2835 if (delegate_->IsHidden()) { | 2835 if (delegate_->IsHidden()) { |
2836 view->Hide(); | 2836 view->Hide(); |
2837 } else { | 2837 } else { |
2838 view->Show(); | 2838 view->Show(); |
2839 } | 2839 } |
2840 } | 2840 } |
2841 } | 2841 } |
2842 | 2842 |
2843 } // namespace content | 2843 } // namespace content |
OLD | NEW |