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

Unified Diff: content/browser/download/save_file_resource_handler.h

Issue 2075273002: Resource requests from Save-Page-As should go through CanRequestURL checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace MarkAsUnauthorized with constructor argument. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « content/browser/download/save_file_manager.cc ('k') | content/browser/download/save_file_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698