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

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

Issue 855883002: Allow universal access from file if flag is set and url is file scheme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests Created 5 years, 11 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 #include "content/browser/frame_host/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 WebPreferences prefs = rfh->GetRenderViewHost()->GetWebkitPreferences(); 122 WebPreferences prefs = rfh->GetRenderViewHost()->GetWebkitPreferences();
123 bool is_same_origin = existing_url.is_empty() || 123 bool is_same_origin = existing_url.is_empty() ||
124 // TODO(japhet): We should only permit navigations 124 // TODO(japhet): We should only permit navigations
125 // originating from about:blank to be in-page if the 125 // originating from about:blank to be in-page if the
126 // about:blank is the first document that frame loaded. 126 // about:blank is the first document that frame loaded.
127 // We don't have sufficient information to identify 127 // We don't have sufficient information to identify
128 // that case at the moment, so always allow about:blank 128 // that case at the moment, so always allow about:blank
129 // for now. 129 // for now.
130 existing_url == GURL(url::kAboutBlankURL) || 130 existing_url == GURL(url::kAboutBlankURL) ||
131 existing_url.GetOrigin() == new_url.GetOrigin() || 131 existing_url.GetOrigin() == new_url.GetOrigin() ||
132 !prefs.web_security_enabled; 132 !prefs.web_security_enabled ||
133 (prefs.allow_universal_access_from_file_urls &&
134 existing_url.SchemeIs(url::kFileScheme)) ;
Charlie Reis 2015/01/23 06:53:37 nit: No space before semicolon.
nhu 2015/01/23 13:41:12 Done.
133 if (!is_same_origin && renderer_says_in_page) 135 if (!is_same_origin && renderer_says_in_page)
134 rfh->GetProcess()->ReceivedBadMessage(); 136 rfh->GetProcess()->ReceivedBadMessage();
135 return is_same_origin && renderer_says_in_page; 137 return is_same_origin && renderer_says_in_page;
136 } 138 }
137 139
138 // Determines whether or not we should be carrying over a user agent override 140 // Determines whether or not we should be carrying over a user agent override
139 // between two NavigationEntries. 141 // between two NavigationEntries.
140 bool ShouldKeepOverride(const NavigationEntry* last_entry) { 142 bool ShouldKeepOverride(const NavigationEntry* last_entry) {
141 return last_entry && last_entry->GetIsOverridingUserAgent(); 143 return last_entry && last_entry->GetIsOverridingUserAgent();
142 } 144 }
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 } 1779 }
1778 } 1780 }
1779 } 1781 }
1780 1782
1781 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1783 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1782 const base::Callback<base::Time()>& get_timestamp_callback) { 1784 const base::Callback<base::Time()>& get_timestamp_callback) {
1783 get_timestamp_callback_ = get_timestamp_callback; 1785 get_timestamp_callback_ = get_timestamp_callback;
1784 } 1786 }
1785 1787
1786 } // namespace content 1788 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698