Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 2424913003: Avoid unnecessary URL parsing for GURL comparisons in //content (Closed)
Patch Set: rebase on dependent PS Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 WebPreferences prefs = rfh->GetRenderViewHost()->GetWebkitPreferences(); 1456 WebPreferences prefs = rfh->GetRenderViewHost()->GetWebkitPreferences();
1457 const url::Origin& committed_origin = 1457 const url::Origin& committed_origin =
1458 rfhi->frame_tree_node()->current_origin(); 1458 rfhi->frame_tree_node()->current_origin();
1459 bool is_same_origin = last_committed_url.is_empty() || 1459 bool is_same_origin = last_committed_url.is_empty() ||
1460 // TODO(japhet): We should only permit navigations 1460 // TODO(japhet): We should only permit navigations
1461 // originating from about:blank to be in-page if the 1461 // originating from about:blank to be in-page if the
1462 // about:blank is the first document that frame loaded. 1462 // about:blank is the first document that frame loaded.
1463 // We don't have sufficient information to identify 1463 // We don't have sufficient information to identify
1464 // that case at the moment, so always allow about:blank 1464 // that case at the moment, so always allow about:blank
1465 // for now. 1465 // for now.
1466 last_committed_url == GURL(url::kAboutBlankURL) || 1466 last_committed_url == url::kAboutBlankURL ||
1467 last_committed_url.GetOrigin() == url.GetOrigin() || 1467 last_committed_url.GetOrigin() == url.GetOrigin() ||
1468 committed_origin == origin || 1468 committed_origin == origin ||
1469 !prefs.web_security_enabled || 1469 !prefs.web_security_enabled ||
1470 (prefs.allow_universal_access_from_file_urls && 1470 (prefs.allow_universal_access_from_file_urls &&
1471 committed_origin.scheme() == url::kFileScheme); 1471 committed_origin.scheme() == url::kFileScheme);
1472 if (!is_same_origin && renderer_says_in_page) { 1472 if (!is_same_origin && renderer_says_in_page) {
1473 bad_message::ReceivedBadMessage(rfh->GetProcess(), 1473 bad_message::ReceivedBadMessage(rfh->GetProcess(),
1474 bad_message::NC_IN_PAGE_NAVIGATION); 1474 bad_message::NC_IN_PAGE_NAVIGATION);
1475 } 1475 }
1476 return is_same_origin && renderer_says_in_page; 1476 return is_same_origin && renderer_says_in_page;
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 } 2089 }
2090 } 2090 }
2091 } 2091 }
2092 2092
2093 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2093 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2094 const base::Callback<base::Time()>& get_timestamp_callback) { 2094 const base::Callback<base::Time()>& get_timestamp_callback) {
2095 get_timestamp_callback_ = get_timestamp_callback; 2095 get_timestamp_callback_ = get_timestamp_callback;
2096 } 2096 }
2097 2097
2098 } // namespace content 2098 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_node.cc ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698