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

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

Issue 10232010: DownloadUrlParameters (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fixes Created 8 years, 7 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
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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "content/public/browser/download_item.h" 14 #include "content/public/browser/download_item.h"
15 #include "content/public/browser/download_manager.h" 15 #include "content/public/browser/download_manager.h"
16 #include "content/public/browser/download_url_parameters.h"
16 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
17 18
18 // Detects changes to the downloads after construction. 19 // Detects changes to the downloads after construction.
19 // Finishes when one of the following happens: 20 // Finishes when one of the following happens:
20 // - A specified number of downloads change to a terminal state (defined 21 // - A specified number of downloads change to a terminal state (defined
21 // in derived classes). 22 // in derived classes).
22 // - Specific events, such as a select file dialog. 23 // - Specific events, such as a select file dialog.
23 // Callers may either probe for the finished state, or wait on it. 24 // Callers may either probe for the finished state, or wait on it.
24 // 25 //
25 // TODO(rdsmith): Detect manager going down, remove pointer to 26 // TODO(rdsmith): Detect manager going down, remove pointer to
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 public: 249 public:
249 DownloadTestItemCreationObserver(); 250 DownloadTestItemCreationObserver();
250 251
251 void WaitForDownloadItemCreation(); 252 void WaitForDownloadItemCreation();
252 253
253 content::DownloadId download_id() const { return download_id_; } 254 content::DownloadId download_id() const { return download_id_; }
254 net::Error error() const { return error_; } 255 net::Error error() const { return error_; }
255 bool started() const { return called_back_count_ > 0; } 256 bool started() const { return called_back_count_ > 0; }
256 bool succeeded() const { return started() && (error_ == net::OK); } 257 bool succeeded() const { return started() && (error_ == net::OK); }
257 258
258 const content::DownloadManager::OnStartedCallback callback(); 259 const content::DownloadUrlParameters::OnStartedCallback callback();
259 260
260 private: 261 private:
261 friend class base::RefCountedThreadSafe<DownloadTestItemCreationObserver>; 262 friend class base::RefCountedThreadSafe<DownloadTestItemCreationObserver>;
262 263
263 ~DownloadTestItemCreationObserver(); 264 ~DownloadTestItemCreationObserver();
264 265
265 void DownloadItemCreationCallback(content::DownloadId download_id, 266 void DownloadItemCreationCallback(content::DownloadId download_id,
266 net::Error error); 267 net::Error error);
267 268
268 // The download creation information we received. 269 // The download creation information we received.
269 content::DownloadId download_id_; 270 content::DownloadId download_id_;
270 271
271 net::Error error_; 272 net::Error error_;
272 273
273 // Count of callbacks. 274 // Count of callbacks.
274 size_t called_back_count_; 275 size_t called_back_count_;
275 276
276 // We are in the message loop. 277 // We are in the message loop.
277 bool waiting_; 278 bool waiting_;
278 279
279 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); 280 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver);
280 }; 281 };
281 282
282 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ 283 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_test_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698