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

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

Issue 1439953006: Reland: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address David's comment Created 5 years, 1 month 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 2014 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_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_
6 #define CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_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"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 ExternalFileURLRequestJob(void* profile_id, 56 ExternalFileURLRequestJob(void* profile_id,
57 net::URLRequest* request, 57 net::URLRequest* request,
58 net::NetworkDelegate* network_delegate); 58 net::NetworkDelegate* network_delegate);
59 59
60 // net::URLRequestJob overrides: 60 // net::URLRequestJob overrides:
61 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; 61 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
62 void Start() override; 62 void Start() override;
63 void Kill() override; 63 void Kill() override;
64 bool GetMimeType(std::string* mime_type) const override; 64 bool GetMimeType(std::string* mime_type) const override;
65 bool IsRedirectResponse(GURL* location, int* http_status_code) override; 65 bool IsRedirectResponse(GURL* location, int* http_status_code) override;
66 bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override; 66 int ReadRawData(net::IOBuffer* buf, int buf_size) override;
67 67
68 protected: 68 protected:
69 ~ExternalFileURLRequestJob() override; 69 ~ExternalFileURLRequestJob() override;
70 70
71 private: 71 private:
72 // Helper method to start the job. Should be called asynchronously because
73 // NotifyStartError() is not legal to call synchronously in
74 // URLRequestJob::Start().
75 void StartAsync();
76
72 // Called from an internal helper class defined in drive_url_request_job.cc, 77 // Called from an internal helper class defined in drive_url_request_job.cc,
73 // which is running on the UI thread. 78 // which is running on the UI thread.
74 void OnHelperResultObtained( 79 void OnHelperResultObtained(
75 net::Error error, 80 net::Error error,
76 const scoped_refptr<storage::FileSystemContext>& file_system_context, 81 const scoped_refptr<storage::FileSystemContext>& file_system_context,
77 scoped_ptr<IsolatedFileSystemScope> isolated_file_system_scope, 82 scoped_ptr<IsolatedFileSystemScope> isolated_file_system_scope,
78 const storage::FileSystemURL& file_system_url, 83 const storage::FileSystemURL& file_system_url,
79 const std::string& mime_type); 84 const std::string& mime_type);
80 85
81 // Called from FileSystemBackend::GetRedirectURLForContents. 86 // Called from FileSystemBackend::GetRedirectURLForContents.
82 void OnRedirectURLObtained(const GURL& redirect_url); 87 void OnRedirectURLObtained(const GURL& redirect_url);
83 88
84 // Called from DriveURLRequestJob::OnFileInfoObtained. 89 // Called from DriveURLRequestJob::OnFileInfoObtained.
85 void OnFileInfoObtained(base::File::Error result, 90 void OnFileInfoObtained(base::File::Error result,
86 const base::File::Info& file_info); 91 const base::File::Info& file_info);
87 92
88 // Called when DriveFileStreamReader::Read is completed. 93 // Called when DriveFileStreamReader::Read is completed.
89 void OnReadCompleted(int read_result); 94 void OnReadCompleted(int read_result);
90 95
91 void* const profile_id_; 96 void* const profile_id_;
92 97
93 // The range of the file to be returned. 98 // The range of the file to be returned.
99 net::Error range_parse_result_;
94 net::HttpByteRange byte_range_; 100 net::HttpByteRange byte_range_;
95 int64 remaining_bytes_; 101 int64 remaining_bytes_;
96 102
97 scoped_refptr<storage::FileSystemContext> file_system_context_; 103 scoped_refptr<storage::FileSystemContext> file_system_context_;
98 scoped_ptr<IsolatedFileSystemScope> isolated_file_system_scope_; 104 scoped_ptr<IsolatedFileSystemScope> isolated_file_system_scope_;
99 storage::FileSystemURL file_system_url_; 105 storage::FileSystemURL file_system_url_;
100 std::string mime_type_; 106 std::string mime_type_;
101 scoped_ptr<storage::FileStreamReader> stream_reader_; 107 scoped_ptr<storage::FileStreamReader> stream_reader_;
102 GURL redirect_url_; 108 GURL redirect_url_;
103 109
104 // This should remain the last member so it'll be destroyed first and 110 // This should remain the last member so it'll be destroyed first and
105 // invalidate its weak pointers before other members are destroyed. 111 // invalidate its weak pointers before other members are destroyed.
106 base::WeakPtrFactory<ExternalFileURLRequestJob> weak_ptr_factory_; 112 base::WeakPtrFactory<ExternalFileURLRequestJob> weak_ptr_factory_;
107 DISALLOW_COPY_AND_ASSIGN(ExternalFileURLRequestJob); 113 DISALLOW_COPY_AND_ASSIGN(ExternalFileURLRequestJob);
108 }; 114 };
109 115
110 } // namespace chromeos 116 } // namespace chromeos
111 117
112 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_ 118 #endif // CHROME_BROWSER_CHROMEOS_FILEAPI_EXTERNAL_FILE_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698