Index: content/browser/download/save_file_resource_handler.h |
diff --git a/content/browser/download/save_file_resource_handler.h b/content/browser/download/save_file_resource_handler.h |
index 2ab8b2f7f5f54a46b0f2861a44409eca806f12e0..d518a0ac91800ef9aa95228dedf0c5aa8ea40d4d 100644 |
--- a/content/browser/download/save_file_resource_handler.h |
+++ b/content/browser/download/save_file_resource_handler.h |
@@ -25,13 +25,26 @@ class SaveFileManager; |
// Forwards data to the save thread. |
class SaveFileResourceHandler : public ResourceHandler { |
public: |
+ // Unauthorized requests are cancelled from OnWillStart callback. |
+ // |
+ // This way of handling unauthorized requests allows unified handling of all |
+ // SaveFile requests - communicating the failure to OnResponseCompleted |
+ // happens in a generic, typical way, reusing common infrastructure code |
+ // (rather than forcing an ad-hoc, Save-File-specific call to |
+ // OnResponseCompleted from ResourceDispatcherHostImpl::BeginSaveFile). |
+ enum class AuthorizationState { |
+ AUTHORIZED, |
+ NOT_AUTHORIZED, |
+ }; |
+ |
SaveFileResourceHandler(net::URLRequest* request, |
SaveItemId save_item_id, |
SavePackageId save_package_id, |
int render_process_host_id, |
int render_frame_routing_id, |
const GURL& url, |
- SaveFileManager* manager); |
+ SaveFileManager* manager, |
+ AuthorizationState authorization_state); |
~SaveFileResourceHandler() override; |
// ResourceHandler Implementation: |
@@ -85,6 +98,8 @@ class SaveFileResourceHandler : public ResourceHandler { |
int64_t content_length_; |
SaveFileManager* save_manager_; |
+ AuthorizationState authorization_state_; |
+ |
static const int kReadBufSize = 32768; // bytes |
DISALLOW_COPY_AND_ASSIGN(SaveFileResourceHandler); |