OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ | 5 #ifndef CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ |
6 #define CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ | 6 #define CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // DownloadManager, transition to finished. (For right now we | 59 // DownloadManager, transition to finished. (For right now we |
60 // just use a scoped_refptr<> to keep it around, but that may cause | 60 // just use a scoped_refptr<> to keep it around, but that may cause |
61 // timeouts on waiting if a DownloadManager::Shutdown() occurs which | 61 // timeouts on waiting if a DownloadManager::Shutdown() occurs which |
62 // cancels our in-progress downloads.) | 62 // cancels our in-progress downloads.) |
63 class DownloadTestObserver : public DownloadManager::Observer, | 63 class DownloadTestObserver : public DownloadManager::Observer, |
64 public DownloadItem::Observer { | 64 public DownloadItem::Observer { |
65 public: | 65 public: |
66 // Action an observer should take if a dangerous download is encountered. | 66 // Action an observer should take if a dangerous download is encountered. |
67 enum DangerousDownloadAction { | 67 enum DangerousDownloadAction { |
68 ON_DANGEROUS_DOWNLOAD_ACCEPT, // Accept the download | 68 ON_DANGEROUS_DOWNLOAD_ACCEPT, // Accept the download |
69 ON_DANGEROUS_DOWNLOAD_DENY, // Deny the download | 69 ON_DANGEROUS_DOWNLOAD_DENY, // Deny the download |
70 ON_DANGEROUS_DOWNLOAD_FAIL // Fail if a dangerous download is seen | 70 ON_DANGEROUS_DOWNLOAD_FAIL, // Fail if a dangerous download is seen |
| 71 ON_DANGEROUS_DOWNLOAD_IGNORE // Make it the callers problem. |
71 }; | 72 }; |
72 | 73 |
73 // Create an object that will be considered finished when |wait_count| | 74 // Create an object that will be considered finished when |wait_count| |
74 // download items have entered a terminal state. | 75 // download items have entered a terminal state. |
75 DownloadTestObserver(DownloadManager* download_manager, | 76 DownloadTestObserver(DownloadManager* download_manager, |
76 size_t wait_count, | 77 size_t wait_count, |
77 DangerousDownloadAction dangerous_download_action); | 78 DangerousDownloadAction dangerous_download_action); |
78 | 79 |
79 virtual ~DownloadTestObserver(); | 80 virtual ~DownloadTestObserver(); |
80 | 81 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 286 |
286 // We are in the message loop. | 287 // We are in the message loop. |
287 bool waiting_; | 288 bool waiting_; |
288 | 289 |
289 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); | 290 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); |
290 }; | 291 }; |
291 | 292 |
292 } // namespace content` | 293 } // namespace content` |
293 | 294 |
294 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ | 295 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ |
OLD | NEW |