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

Side by Side Diff: chrome/browser/renderer_host/download_resource_handler.h

Issue 5298008: net: Add namespace net to URLRequest and URLRequestJob classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some chromeos fixes Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_
6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/timer.h" 11 #include "base/timer.h"
12 #include "chrome/browser/download/download_file.h" 12 #include "chrome/browser/download/download_file.h"
13 #include "chrome/browser/renderer_host/global_request_id.h" 13 #include "chrome/browser/renderer_host/global_request_id.h"
14 #include "chrome/browser/renderer_host/resource_handler.h" 14 #include "chrome/browser/renderer_host/resource_handler.h"
15 15
16 class DownloadFileManager; 16 class DownloadFileManager;
17 class ResourceDispatcherHost; 17 class ResourceDispatcherHost;
18 struct DownloadBuffer;
19
20 namespace net {
18 class URLRequest; 21 class URLRequest;
19 struct DownloadBuffer; 22 } // namespace net
20 23
21 // Forwards data to the download thread. 24 // Forwards data to the download thread.
22 class DownloadResourceHandler : public ResourceHandler { 25 class DownloadResourceHandler : public ResourceHandler {
23 public: 26 public:
24 DownloadResourceHandler(ResourceDispatcherHost* rdh, 27 DownloadResourceHandler(ResourceDispatcherHost* rdh,
25 int render_process_host_id, 28 int render_process_host_id,
26 int render_view_id, 29 int render_view_id,
27 int request_id, 30 int request_id,
28 const GURL& url, 31 const GURL& url,
29 DownloadFileManager* download_file_manager, 32 DownloadFileManager* download_file_manager,
30 URLRequest* request, 33 net::URLRequest* request,
31 bool save_as, 34 bool save_as,
32 const DownloadSaveInfo& save_info); 35 const DownloadSaveInfo& save_info);
33 36
34 bool OnUploadProgress(int request_id, uint64 position, uint64 size); 37 bool OnUploadProgress(int request_id, uint64 position, uint64 size);
35 38
36 // Not needed, as this event handler ought to be the final resource. 39 // Not needed, as this event handler ought to be the final resource.
37 bool OnRequestRedirected(int request_id, const GURL& url, 40 bool OnRequestRedirected(int request_id, const GURL& url,
38 ResourceResponse* response, bool* defer); 41 ResourceResponse* response, bool* defer);
39 42
40 // Send the download creation information to the download thread. 43 // Send the download creation information to the download thread.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void StartPauseTimer(); 75 void StartPauseTimer();
73 76
74 int download_id_; 77 int download_id_;
75 GlobalRequestID global_id_; 78 GlobalRequestID global_id_;
76 int render_view_id_; 79 int render_view_id_;
77 scoped_refptr<net::IOBuffer> read_buffer_; 80 scoped_refptr<net::IOBuffer> read_buffer_;
78 std::string content_disposition_; 81 std::string content_disposition_;
79 GURL url_; 82 GURL url_;
80 int64 content_length_; 83 int64 content_length_;
81 DownloadFileManager* download_file_manager_; 84 DownloadFileManager* download_file_manager_;
82 URLRequest* request_; 85 net::URLRequest* request_;
83 bool save_as_; // Request was initiated via "Save As" by the user. 86 bool save_as_; // Request was initiated via "Save As" by the user.
84 DownloadSaveInfo save_info_; 87 DownloadSaveInfo save_info_;
85 DownloadBuffer* buffer_; 88 DownloadBuffer* buffer_;
86 ResourceDispatcherHost* rdh_; 89 ResourceDispatcherHost* rdh_;
87 bool is_paused_; 90 bool is_paused_;
88 base::OneShotTimer<DownloadResourceHandler> pause_timer_; 91 base::OneShotTimer<DownloadResourceHandler> pause_timer_;
89 92
90 static const int kReadBufSize = 32768; // bytes 93 static const int kReadBufSize = 32768; // bytes
91 static const size_t kLoadsToWrite = 100; // number of data buffers queued 94 static const size_t kLoadsToWrite = 100; // number of data buffers queued
92 static const int kThrottleTimeMs = 200; // milliseconds 95 static const int kThrottleTimeMs = 200; // milliseconds
93 96
94 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); 97 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler);
95 }; 98 };
96 99
97 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ 100 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698