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

Side by Side Diff: chrome/browser/download/download_request_handle.h

Issue 7112011: Change DownloadProcessHandle to be more of an encapsulated class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unneeded include file. Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_HANDLE_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_HANDLE_H_
7 #pragma once
8
9 #include <string>
10
11 class DownloadManager;
12 class ResourceDispatcherHost;
13 class TabContents;
14
15 // A handle used by the download system for operations on the URLRequest
16 // or objects conditional on it (e.g. TabContents).
17 // This class needs to be copyable, so we can pass it across threads and not
18 // worry about lifetime or const-ness.
19 class DownloadRequestHandle {
20 public:
21
Paweł Hajdan Jr. 2011/06/08 09:36:58 nit: Remove empty line.
Randy Smith (Not in Mondays) 2011/06/09 13:17:43 Done.
22 // Create a null DownloadRequestHandle; getters return null, and no
23 // actions are allowed.
24 DownloadRequestHandle();
25
26 // Note that rdh is required to be non-null.
Paweł Hajdan Jr. 2011/06/08 09:36:58 nit: |rdh|
Randy Smith (Not in Mondays) 2011/06/09 13:17:43 Done.
27 DownloadRequestHandle(ResourceDispatcherHost* rdh,
28 int child_id,
29 int render_view_id,
30 int request_id);
31
32 // These functions must be called on the UI thread.
33 TabContents* GetTabContents() const;
34 DownloadManager* GetDownloadManager() const;
35
36 // Pause or resume the matching URL request.
37 void PauseRequest();
38 void ResumeRequest();
39
40 // Cancel the request
41 void CancelRequest();
42
43 std::string DebugString() const;
44
45 private:
46 friend class DownloadFileTest;
47
48 // Some unit tests don't setup the ResourceDispatcherHost; for these
49 // tests we allow the creation of a no-op DownloadRequestHandle which
50 // returns null and no-ops the handle actions.
51 static DownloadRequestHandle GetNopDownloadRequestHandle();
52
53 // Helper functions for distinguishing special DownloadRequestHandles
54 bool IsNull() const;
55 bool IsNop() const;
56
57 // The resource dispatcher host.
58 ResourceDispatcherHost* rdh_;
59
60 // The ID of the child process that started the download.
61 int child_id_;
62
63 // The ID of the render view that started the download.
64 int render_view_id_;
65
66 // The ID associated with the request used for the download.
67 int request_id_;
68 };
69
70 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698