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

Side by Side Diff: net/base/network_delegate.h

Issue 10068021: Fix file access on Chrome for ChromeOS on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix net unittests Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/shell/shell_network_delegate.cc ('k') | net/base/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 NET_BASE_NETWORK_DELEGATE_H_ 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_
6 #define NET_BASE_NETWORK_DELEGATE_H_ 6 #define NET_BASE_NETWORK_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "net/base/auth.h" 14 #include "net/base/auth.h"
15 #include "net/base/completion_callback.h" 15 #include "net/base/completion_callback.h"
16 16
17 class FilePath;
17 class GURL; 18 class GURL;
18 19
19 namespace net { 20 namespace net {
20 21
21 // NOTE: Layering violations! 22 // NOTE: Layering violations!
22 // We decided to accept these violations (depending 23 // We decided to accept these violations (depending
23 // on other net/ submodules from net/base/), because otherwise NetworkDelegate 24 // on other net/ submodules from net/base/), because otherwise NetworkDelegate
24 // would have to be broken up into too many smaller interfaces targeted to each 25 // would have to be broken up into too many smaller interfaces targeted to each
25 // submodule. Also, since the lower levels in net/ may callback into higher 26 // submodule. Also, since the lower levels in net/ may callback into higher
26 // levels, we may encounter dangerous casting issues. 27 // levels, we may encounter dangerous casting issues.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const GURL& new_location); 71 const GURL& new_location);
71 void NotifyResponseStarted(URLRequest* request); 72 void NotifyResponseStarted(URLRequest* request);
72 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); 73 void NotifyRawBytesRead(const URLRequest& request, int bytes_read);
73 void NotifyCompleted(URLRequest* request, bool started); 74 void NotifyCompleted(URLRequest* request, bool started);
74 void NotifyURLRequestDestroyed(URLRequest* request); 75 void NotifyURLRequestDestroyed(URLRequest* request);
75 void NotifyPACScriptError(int line_number, const string16& error); 76 void NotifyPACScriptError(int line_number, const string16& error);
76 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, 77 AuthRequiredResponse NotifyAuthRequired(URLRequest* request,
77 const AuthChallengeInfo& auth_info, 78 const AuthChallengeInfo& auth_info,
78 const AuthCallback& callback, 79 const AuthCallback& callback,
79 AuthCredentials* credentials); 80 AuthCredentials* credentials);
80 bool NotifyReadingCookies(const URLRequest* request, 81 bool CanGetCookies(const URLRequest& request,
81 const CookieList& cookie_list); 82 const CookieList& cookie_list);
82 bool NotifySettingCookie(const URLRequest* request, 83 bool CanSetCookie(const URLRequest& request,
83 const std::string& cookie_line, 84 const std::string& cookie_line,
84 CookieOptions* options); 85 CookieOptions* options);
86 bool CanAccessFile(const URLRequest& request,
87 const FilePath& path) const;
85 88
86 private: 89 private:
87 // This is the interface for subclasses of NetworkDelegate to implement. This 90 // This is the interface for subclasses of NetworkDelegate to implement. These
88 // member functions will be called by the respective public notification 91 // member functions will be called by the respective public notification
89 // member function, which will perform basic sanity checking. 92 // member function, which will perform basic sanity checking.
90 93
91 // Called before a request is sent. Allows the delegate to rewrite the URL 94 // Called before a request is sent. Allows the delegate to rewrite the URL
92 // being fetched by modifying |new_url|. |callback| and |new_url| are valid 95 // being fetched by modifying |new_url|. |callback| and |new_url| are valid
93 // only until OnURLRequestDestroyed is called for this request. Returns a net 96 // only until OnURLRequestDestroyed is called for this request. Returns a net
94 // status code, generally either OK to continue with the request or 97 // status code, generally either OK to continue with the request or
95 // ERR_IO_PENDING if the result is not ready yet. A status code other than OK 98 // ERR_IO_PENDING if the result is not ready yet. A status code other than OK
96 // and ERR_IO_PENDING will cancel the request and report the status code as 99 // and ERR_IO_PENDING will cancel the request and report the status code as
97 // the reason. 100 // the reason.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // the same semantics as described above. 178 // the same semantics as described above.
176 virtual AuthRequiredResponse OnAuthRequired( 179 virtual AuthRequiredResponse OnAuthRequired(
177 URLRequest* request, 180 URLRequest* request,
178 const AuthChallengeInfo& auth_info, 181 const AuthChallengeInfo& auth_info,
179 const AuthCallback& callback, 182 const AuthCallback& callback,
180 AuthCredentials* credentials) = 0; 183 AuthCredentials* credentials) = 0;
181 184
182 // Called when reading cookies to allow the network delegate to block access 185 // Called when reading cookies to allow the network delegate to block access
183 // to the cookie. This method will never be invoked when 186 // to the cookie. This method will never be invoked when
184 // LOAD_DO_NOT_SEND_COOKIES is specified. 187 // LOAD_DO_NOT_SEND_COOKIES is specified.
185 virtual bool CanGetCookies(const URLRequest* request, 188 virtual bool OnCanGetCookies(const URLRequest& request,
186 const CookieList& cookie_list) = 0; 189 const CookieList& cookie_list) = 0;
187 190
188 // Called when a cookie is set to allow the network delegate to block access 191 // Called when a cookie is set to allow the network delegate to block access
189 // to the cookie. This method will never be invoked when 192 // to the cookie. This method will never be invoked when
190 // LOAD_DO_NOT_SAVE_COOKIES is specified. 193 // LOAD_DO_NOT_SAVE_COOKIES is specified.
191 virtual bool CanSetCookie(const URLRequest* request, 194 virtual bool OnCanSetCookie(const URLRequest& request,
192 const std::string& cookie_line, 195 const std::string& cookie_line,
193 CookieOptions* options) = 0; 196 CookieOptions* options) = 0;
197
198
199 // Called when a file access is attempted to allow the network delegate to
200 // allow or block access to the given file path. Returns true if access is
201 // allowed.
202 virtual bool OnCanAccessFile(const URLRequest& request,
203 const FilePath& path) const = 0;
194 204
195 }; 205 };
196 206
197 } // namespace net 207 } // namespace net
198 208
199 #endif // NET_BASE_NETWORK_DELEGATE_H_ 209 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/shell/shell_network_delegate.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698