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

Side by Side Diff: net/url_request/url_request_file_job.h

Issue 10068021: Fix file access on Chrome for ChromeOS on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review changes Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_
6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 virtual bool ReadRawData(IOBuffer* buf, 39 virtual bool ReadRawData(IOBuffer* buf,
40 int buf_size, 40 int buf_size,
41 int* bytes_read) OVERRIDE; 41 int* bytes_read) OVERRIDE;
42 virtual bool IsRedirectResponse(GURL* location, 42 virtual bool IsRedirectResponse(GURL* location,
43 int* http_status_code) OVERRIDE; 43 int* http_status_code) OVERRIDE;
44 virtual Filter* SetupFilter() const OVERRIDE; 44 virtual Filter* SetupFilter() const OVERRIDE;
45 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; 45 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
46 virtual void SetExtraRequestHeaders( 46 virtual void SetExtraRequestHeaders(
47 const HttpRequestHeaders& headers) OVERRIDE; 47 const HttpRequestHeaders& headers) OVERRIDE;
48 48
49 static void AllowAccessToAllFiles();
50
49 protected: 51 protected:
50 virtual ~URLRequestFileJob(); 52 virtual ~URLRequestFileJob();
51 53
52 // The OS-specific full path name of the file 54 // The OS-specific full path name of the file
53 FilePath file_path_; 55 FilePath file_path_;
54 56
55 private: 57 private:
58 // Tests to see if access to |path| is allowed. If g_allow_file_access_ is
59 // true, then this will return true. If the NetworkDelegate associated with
60 // the |request| says it's OK, then this will also return true.
61 static bool IsFileAccessAllowed(const URLRequest& request,
62 const FilePath& path);
63
56 // Callback after fetching file info on a background thread. 64 // Callback after fetching file info on a background thread.
57 void DidResolve(bool exists, const base::PlatformFileInfo& file_info); 65 void DidResolve(bool exists, const base::PlatformFileInfo& file_info);
58 66
59 // Callback after data is asynchronously read from the file. 67 // Callback after data is asynchronously read from the file.
60 void DidRead(int result); 68 void DidRead(int result);
61 69
62 FileStream stream_; 70 FileStream stream_;
63 bool is_directory_; 71 bool is_directory_;
64 72
65 HttpByteRange byte_range_; 73 HttpByteRange byte_range_;
66 int64 remaining_bytes_; 74 int64 remaining_bytes_;
67 75
68 // The initial file metadata is fetched on a background thread. 76 // The initial file metadata is fetched on a background thread.
69 // AsyncResolver runs that task. 77 // AsyncResolver runs that task.
70 class AsyncResolver; 78 class AsyncResolver;
71 friend class AsyncResolver; 79 friend class AsyncResolver;
72 scoped_refptr<AsyncResolver> async_resolver_; 80 scoped_refptr<AsyncResolver> async_resolver_;
73 81
82 // If true, allows access to all files.
83 static bool g_allow_file_access_;
84
74 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); 85 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob);
75 }; 86 };
76 87
77 } // namespace net 88 } // namespace net
78 89
79 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ 90 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698