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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.h

Issue 2913733002: Add a browser test for access control for file: scheme (Closed)
Patch Set: just rebase Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 BooleanPrefMember* force_google_safe_search, 127 BooleanPrefMember* force_google_safe_search,
128 IntegerPrefMember* force_youtube_restrict, 128 IntegerPrefMember* force_youtube_restrict,
129 StringPrefMember* allowed_domains_for_apps, 129 StringPrefMember* allowed_domains_for_apps,
130 PrefService* pref_service); 130 PrefService* pref_service);
131 131
132 // Returns true if access to |path| is allowed. |profile_path| is used to 132 // Returns true if access to |path| is allowed. |profile_path| is used to
133 // locate certain paths on Chrome OS. See set_profile_path() for details. 133 // locate certain paths on Chrome OS. See set_profile_path() for details.
134 static bool IsAccessAllowed(const base::FilePath& path, 134 static bool IsAccessAllowed(const base::FilePath& path,
135 const base::FilePath& profile_path); 135 const base::FilePath& profile_path);
136 136
137 // Enables access to all files for testing purposes. This function is used
138 // to bypass the access control for file: scheme. Calling this function
139 // with false brings back the original (production) behaviors.
140 static void EnableAccessToAllFilesForTesting(bool enabled);
141
137 private: 142 private:
138 // NetworkDelegate implementation. 143 // NetworkDelegate implementation.
139 int OnBeforeURLRequest(net::URLRequest* request, 144 int OnBeforeURLRequest(net::URLRequest* request,
140 const net::CompletionCallback& callback, 145 const net::CompletionCallback& callback,
141 GURL* new_url) override; 146 GURL* new_url) override;
142 int OnBeforeStartTransaction(net::URLRequest* request, 147 int OnBeforeStartTransaction(net::URLRequest* request,
143 const net::CompletionCallback& callback, 148 const net::CompletionCallback& callback,
144 net::HttpRequestHeaders* headers) override; 149 net::HttpRequestHeaders* headers) override;
145 void OnStartTransaction(net::URLRequest* request, 150 void OnStartTransaction(net::URLRequest* request,
146 const net::HttpRequestHeaders& headers) override; 151 const net::HttpRequestHeaders& headers) override;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 223
219 // Aggregates and reports network usage. 224 // Aggregates and reports network usage.
220 data_usage::DataUseAggregator* data_use_aggregator_; 225 data_usage::DataUseAggregator* data_use_aggregator_;
221 // Controls whether network usage is reported as being off the record. 226 // Controls whether network usage is reported as being off the record.
222 bool is_data_usage_off_the_record_; 227 bool is_data_usage_off_the_record_;
223 228
224 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); 229 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
225 }; 230 };
226 231
227 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 232 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698