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

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: 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 typedef base::Callback<void( 34 typedef base::Callback<
35 net::Error, 35 void(net::Error,
36 const scoped_refptr<storage::FileSystemContext>& file_system_context, 36 const scoped_refptr<storage::FileSystemContext>& file_system_context,
37 const storage::FileSystemURL& file_system_url, 37 const storage::FileSystemURL& file_system_url,
38 const std::string& mime_type)> DelegateCallback; 38 const std::string& mime_type)> DelegateCallback;
39 39
40 DriveURLRequestJob(void* profile_id, 40 ExternalFileURLRequestJob(void* profile_id,
41 net::URLRequest* request, 41 net::URLRequest* request,
42 net::NetworkDelegate* network_delegate); 42 net::NetworkDelegate* network_delegate);
43 43
44 // net::URLRequestJob overrides: 44 // net::URLRequestJob overrides:
45 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) 45 virtual void SetExtraRequestHeaders(
46 OVERRIDE; 46 const net::HttpRequestHeaders& headers) OVERRIDE;
47 virtual void Start() OVERRIDE; 47 virtual void Start() OVERRIDE;
48 virtual void Kill() OVERRIDE; 48 virtual void Kill() OVERRIDE;
49 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; 49 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
50 virtual bool IsRedirectResponse( 50 virtual bool IsRedirectResponse(GURL* location,
51 GURL* location, int* http_status_code) OVERRIDE; 51 int* http_status_code) OVERRIDE;
52 virtual bool ReadRawData( 52 virtual bool ReadRawData(net::IOBuffer* buf,
53 net::IOBuffer* buf, int buf_size, int* bytes_read) OVERRIDE; 53 int buf_size,
54 int* bytes_read) OVERRIDE;
54 55
55 protected: 56 protected:
56 virtual ~DriveURLRequestJob(); 57 virtual ~ExternalFileURLRequestJob();
57 58
58 private: 59 private:
59 // Called from a delegete helper on the UI thread. 60 // Called from a delegete helper on the UI thread.
60 void OnDelegateResultObtained( 61 void OnDelegateResultObtained(
61 net::Error error, 62 net::Error error,
62 const scoped_refptr<storage::FileSystemContext>& file_system_context, 63 const scoped_refptr<storage::FileSystemContext>& file_system_context,
63 const storage::FileSystemURL& file_system_url, 64 const storage::FileSystemURL& file_system_url,
64 const std::string& mime_type); 65 const std::string& mime_type);
65 66
66 // Called from FileSystemBackend::GetRedirectURLForContents. 67 // Called from FileSystemBackend::GetRedirectURLForContents.
(...skipping 13 matching lines...) Expand all
80 int64 remaining_bytes_; 81 int64 remaining_bytes_;
81 82
82 scoped_refptr<storage::FileSystemContext> file_system_context_; 83 scoped_refptr<storage::FileSystemContext> file_system_context_;
83 storage::FileSystemURL file_system_url_; 84 storage::FileSystemURL file_system_url_;
84 std::string mime_type_; 85 std::string mime_type_;
85 scoped_ptr<storage::FileStreamReader> stream_reader_; 86 scoped_ptr<storage::FileStreamReader> stream_reader_;
86 GURL redirect_url_; 87 GURL redirect_url_;
87 88
88 // This should remain the last member so it'll be destroyed first and 89 // This should remain the last member so it'll be destroyed first and
89 // invalidate its weak pointers before other members are destroyed. 90 // invalidate its weak pointers before other members are destroyed.
90 base::WeakPtrFactory<DriveURLRequestJob> weak_ptr_factory_; 91 base::WeakPtrFactory<ExternalFileURLRequestJob> weak_ptr_factory_;
91 DISALLOW_COPY_AND_ASSIGN(DriveURLRequestJob); 92 DISALLOW_COPY_AND_ASSIGN(ExternalFileURLRequestJob);
92 }; 93 };
93 94
94 } // namespace drive 95 } // namespace chromeos
95 96
96 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_URL_REQUEST_JOB_H_ 97 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698