| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import "ios/web/navigation/crw_session_controller.h" | 5 #import "ios/web/navigation/crw_session_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 if (transientRewriters) { | 652 if (transientRewriters) { |
| 653 urlWasRewritten = web::BrowserURLRewriter::RewriteURLWithWriters( | 653 urlWasRewritten = web::BrowserURLRewriter::RewriteURLWithWriters( |
| 654 &loaded_url, _browserState, *transientRewriters.get()); | 654 &loaded_url, _browserState, *transientRewriters.get()); |
| 655 } | 655 } |
| 656 } | 656 } |
| 657 if (!urlWasRewritten) { | 657 if (!urlWasRewritten) { |
| 658 web::BrowserURLRewriter::GetInstance()->RewriteURLIfNecessary( | 658 web::BrowserURLRewriter::GetInstance()->RewriteURLIfNecessary( |
| 659 &loaded_url, _browserState); | 659 &loaded_url, _browserState); |
| 660 } | 660 } |
| 661 | 661 |
| 662 if (initiationType == web::NavigationInitiationType::RENDERER_INITIATED && |
| 663 loaded_url != url && web::GetWebClient()->IsAppSpecificURL(loaded_url)) { |
| 664 bool lastCommittedURLIsAppSpecific = |
| 665 self.lastCommittedItem && |
| 666 web::GetWebClient()->IsAppSpecificURL(self.lastCommittedItem->GetURL()); |
| 667 if (!lastCommittedURLIsAppSpecific) { |
| 668 // The URL should not be changed to app-specific URL if the load was |
| 669 // renderer-initiated requested by non app-specific URL. Pages with |
| 670 // app-specific urls have elevated previledges and should not be allowed |
| 671 // to open app-specific URLs. |
| 672 loaded_url = url; |
| 673 } |
| 674 } |
| 675 |
| 662 std::unique_ptr<web::NavigationItemImpl> item(new web::NavigationItemImpl()); | 676 std::unique_ptr<web::NavigationItemImpl> item(new web::NavigationItemImpl()); |
| 663 item->SetOriginalRequestURL(loaded_url); | 677 item->SetOriginalRequestURL(loaded_url); |
| 664 item->SetURL(loaded_url); | 678 item->SetURL(loaded_url); |
| 665 item->SetReferrer(referrer); | 679 item->SetReferrer(referrer); |
| 666 item->SetTransitionType(transition); | 680 item->SetTransitionType(transition); |
| 667 item->SetNavigationInitiationType(initiationType); | 681 item->SetNavigationInitiationType(initiationType); |
| 668 if (web::GetWebClient()->IsAppSpecificURL(loaded_url)) | 682 if (web::GetWebClient()->IsAppSpecificURL(loaded_url)) |
| 669 item->SetUserAgentType(web::UserAgentType::NONE); | 683 item->SetUserAgentType(web::UserAgentType::NONE); |
| 670 return item; | 684 return item; |
| 671 } | 685 } |
| 672 | 686 |
| 673 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { | 687 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { |
| 674 DCHECK_LT(index, self.items.size()); | 688 DCHECK_LT(index, self.items.size()); |
| 675 ui::PageTransition transition = self.items[index]->GetTransitionType(); | 689 ui::PageTransition transition = self.items[index]->GetTransitionType(); |
| 676 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; | 690 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; |
| 677 } | 691 } |
| 678 | 692 |
| 679 @end | 693 @end |
| OLD | NEW |