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

Side by Side Diff: chrome/browser/chromeos/fileapi/external_file_url_request_job.h

Issue 580023003: Rename the drive: scheme with the externalfile: scheme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 3 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 2014 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_CHROMEOS_DRIVE_DRIVE_URL_REQUEST_JOB_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_URL_REQUEST_JOB_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/drive/file_errors.h" 13 #include "chrome/browser/chromeos/drive/file_errors.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/http/http_byte_range.h" 15 #include "net/http/http_byte_range.h"
16 #include "net/url_request/url_request_job.h" 16 #include "net/url_request/url_request_job.h"
17 #include "storage/browser/blob/file_stream_reader.h" 17 #include "storage/browser/blob/file_stream_reader.h"
18 #include "storage/browser/fileapi/file_system_url.h" 18 #include "storage/browser/fileapi/file_system_url.h"
19 19
20 namespace net { 20 namespace net {
21 class IOBuffer; 21 class IOBuffer;
22 class NetworkDelegate; 22 class NetworkDelegate;
23 class URLRequest; 23 class URLRequest;
24 } // namespace net 24 } // namespace net
25 25
26 namespace drive { 26 namespace chromeos {
27 27
28 // DriveURLRequestJob is the gateway between network-level drive:... 28 // ExternalFileURLRequestJob is the gateway between network-level drive:...
29 // requests for drive resources and FileSystem. It exposes content URLs 29 // requests for drive resources and FileSystem. It exposes content URLs
30 // formatted as drive:<drive-file-path>. 30 // formatted as drive:<drive-file-path>.
31 // The methods should be run on IO thread. 31 // The methods should be run on IO thread.
32 class DriveURLRequestJob : public net::URLRequestJob { 32 class ExternalFileURLRequestJob : public net::URLRequestJob {
33 public: 33 public:
34 // Callback to take results from an internal helper defined in 34 // Callback to take results from an internal helper defined in
35 // drive_url_request_job.cc. 35 // drive_url_request_job.cc.
36 typedef base::Callback< 36 typedef base::Callback<
37 void(net::Error, 37 void(net::Error,
38 const scoped_refptr<storage::FileSystemContext>& file_system_context, 38 const scoped_refptr<storage::FileSystemContext>& file_system_context,
39 const storage::FileSystemURL& file_system_url, 39 const storage::FileSystemURL& file_system_url,
40 const std::string& mime_type)> HelperCallback; 40 const std::string& mime_type)> HelperCallback;
41 41
42 DriveURLRequestJob(void* profile_id, 42 ExternalFileURLRequestJob(void* profile_id,
43 net::URLRequest* request, 43 net::URLRequest* request,
44 net::NetworkDelegate* network_delegate); 44 net::NetworkDelegate* network_delegate);
45 45
46 // net::URLRequestJob overrides: 46 // net::URLRequestJob overrides:
47 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) 47 virtual void SetExtraRequestHeaders(
48 OVERRIDE; 48 const net::HttpRequestHeaders& headers) OVERRIDE;
49 virtual void Start() OVERRIDE; 49 virtual void Start() OVERRIDE;
50 virtual void Kill() OVERRIDE; 50 virtual void Kill() OVERRIDE;
51 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; 51 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
52 virtual bool IsRedirectResponse( 52 virtual bool IsRedirectResponse(GURL* location,
53 GURL* location, int* http_status_code) OVERRIDE; 53 int* http_status_code) OVERRIDE;
54 virtual bool ReadRawData( 54 virtual bool ReadRawData(net::IOBuffer* buf,
55 net::IOBuffer* buf, int buf_size, int* bytes_read) OVERRIDE; 55 int buf_size,
56 int* bytes_read) OVERRIDE;
56 57
57 protected: 58 protected:
58 virtual ~DriveURLRequestJob(); 59 virtual ~ExternalFileURLRequestJob();
59 60
60 private: 61 private:
61 // Called from an internal helper class defined in drive_url_request_job.cc, 62 // Called from an internal helper class defined in drive_url_request_job.cc,
62 // which is running on the UI thread. 63 // which is running on the UI thread.
63 void OnHelperResultObtained( 64 void OnHelperResultObtained(
64 net::Error error, 65 net::Error error,
65 const scoped_refptr<storage::FileSystemContext>& file_system_context, 66 const scoped_refptr<storage::FileSystemContext>& file_system_context,
66 const storage::FileSystemURL& file_system_url, 67 const storage::FileSystemURL& file_system_url,
67 const std::string& mime_type); 68 const std::string& mime_type);
68 69
(...skipping 14 matching lines...) Expand all
83 int64 remaining_bytes_; 84 int64 remaining_bytes_;
84 85
85 scoped_refptr<storage::FileSystemContext> file_system_context_; 86 scoped_refptr<storage::FileSystemContext> file_system_context_;
86 storage::FileSystemURL file_system_url_; 87 storage::FileSystemURL file_system_url_;
87 std::string mime_type_; 88 std::string mime_type_;
88 scoped_ptr<storage::FileStreamReader> stream_reader_; 89 scoped_ptr<storage::FileStreamReader> stream_reader_;
89 GURL redirect_url_; 90 GURL redirect_url_;
90 91
91 // This should remain the last member so it'll be destroyed first and 92 // This should remain the last member so it'll be destroyed first and
92 // invalidate its weak pointers before other members are destroyed. 93 // invalidate its weak pointers before other members are destroyed.
93 base::WeakPtrFactory<DriveURLRequestJob> weak_ptr_factory_; 94 base::WeakPtrFactory<ExternalFileURLRequestJob> weak_ptr_factory_;
94 DISALLOW_COPY_AND_ASSIGN(DriveURLRequestJob); 95 DISALLOW_COPY_AND_ASSIGN(ExternalFileURLRequestJob);
95 }; 96 };
96 97
97 } // namespace drive 98 } // namespace chromeos
98 99
99 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_URL_REQUEST_JOB_H_ 100 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698