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

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: Merged to LKGR. 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 // Create a null DownloadRequestHandle: getters will return null, and
22 // all actions are no-ops.
23 // TODO(rdsmith): Ideally, actions would be forbidden rather than
24 // no-ops, to confirm that no non-testing code actually uses
25 // a null DownloadRequestHandle. But for now, we need the no-op
26 // behavior for unit tests. Long-term, this should be fixed by
27 // allowing mocking of ResourceDispatcherHost in unit tests.
28 DownloadRequestHandle();
29
30 // Note that |rdh| is required to be non-null.
31 DownloadRequestHandle(ResourceDispatcherHost* rdh,
32 int child_id,
33 int render_view_id,
34 int request_id);
35
36 // These functions must be called on the UI thread.
37 TabContents* GetTabContents() const;
38 DownloadManager* GetDownloadManager() const;
39
40 // Pause or resume the matching URL request.
41 void PauseRequest();
42 void ResumeRequest();
43
44 // Cancel the request
45 void CancelRequest();
46
47 std::string DebugString() const;
48
49 private:
50 // The resource dispatcher host.
51 ResourceDispatcherHost* rdh_;
52
53 // The ID of the child process that started the download.
54 int child_id_;
55
56 // The ID of the render view that started the download.
57 int render_view_id_;
58
59 // The ID associated with the request used for the download.
60 int request_id_;
61 };
62
63 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_HANDLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_process_handle.cc ('k') | chrome/browser/download/download_request_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698