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

Side by Side Diff: content/browser/download/download_item_impl.h

Issue 11740026: Pull delegate check back into IsDownloadReadyForCompletion so that if (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed test. Created 7 years, 11 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
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
11 #include "base/file_path.h" 12 #include "base/file_path.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.h" 15 #include "base/observer_list.h"
15 #include "base/time.h" 16 #include "base/time.h"
16 #include "base/timer.h" 17 #include "base/timer.h"
17 #include "content/browser/download/download_net_log_parameters.h" 18 #include "content/browser/download/download_net_log_parameters.h"
18 #include "content/browser/download/download_request_handle.h" 19 #include "content/browser/download/download_request_handle.h"
19 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
20 #include "content/public/browser/download_destination_observer.h" 21 #include "content/public/browser/download_destination_observer.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // If all pre-requisites have been met, complete download processing, i.e. do 259 // If all pre-requisites have been met, complete download processing, i.e. do
259 // internal cleanup, file rename, and potentially auto-open. (Dangerous 260 // internal cleanup, file rename, and potentially auto-open. (Dangerous
260 // downloads still may block on user acceptance after this point.) 261 // downloads still may block on user acceptance after this point.)
261 void MaybeCompleteDownload(); 262 void MaybeCompleteDownload();
262 263
263 // Called when the download is ready to complete. 264 // Called when the download is ready to complete.
264 // This may perform final rename if necessary and will eventually call 265 // This may perform final rename if necessary and will eventually call
265 // DownloadItem::Completed(). 266 // DownloadItem::Completed().
266 void OnDownloadCompleting(); 267 void OnDownloadCompleting();
267 268
268 // Called after the delegate has given the go-ahead to actually complete
269 // the download.
270 void ReadyForDownloadCompletionDone();
271
272 void OnDownloadRenamedToFinalName(DownloadInterruptReason reason, 269 void OnDownloadRenamedToFinalName(DownloadInterruptReason reason,
273 const FilePath& full_path); 270 const FilePath& full_path);
274 271
275 // Called if the embedder took over opening a download, to indicate that 272 // Called if the embedder took over opening a download, to indicate that
276 // the download has been opened. 273 // the download has been opened.
277 void DelayedDownloadOpened(bool auto_opened); 274 void DelayedDownloadOpened(bool auto_opened);
278 275
279 // Called when the entire download operation (including renaming etc) 276 // Called when the entire download operation (including renaming etc)
280 // is completed. 277 // is completed.
281 void Completed(); 278 void Completed();
282 279
283 // Helper routines ----------------------------------------------------------- 280 // Helper routines -----------------------------------------------------------
284 281
285 // Indicate that an error has occurred on the download. 282 // Indicate that an error has occurred on the download.
286 void Interrupt(DownloadInterruptReason reason); 283 void Interrupt(DownloadInterruptReason reason);
287 284
288 // Cancel the DownloadFile if we have it. 285 // Cancel the DownloadFile if we have it.
289 void CancelDownloadFile(); 286 void CancelDownloadFile();
290 287
291 // Check if a download is ready for completion. 288 // Check if a download is ready for completion. The callback provided
292 bool IsDownloadReadyForCompletion(); 289 // may be called at some point in the future if an external entity
290 // state has change s.t. this routine should be checked again.
291 bool IsDownloadReadyForCompletion(const base::Closure& state_change_notify);
293 292
294 // Call to transition state; all state transitions should go through this. 293 // Call to transition state; all state transitions should go through this.
295 void TransitionTo(DownloadInternalState new_state); 294 void TransitionTo(DownloadInternalState new_state);
296 295
297 // Set the |danger_type_| and invoke obserers if necessary. 296 // Set the |danger_type_| and invoke obserers if necessary.
298 void SetDangerType(DownloadDangerType danger_type); 297 void SetDangerType(DownloadDangerType danger_type);
299 298
300 void SetFullPath(const FilePath& new_path); 299 void SetFullPath(const FilePath& new_path);
301 300
302 // Mapping between internal and external states. 301 // Mapping between internal and external states.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 const net::BoundNetLog bound_net_log_; 467 const net::BoundNetLog bound_net_log_;
469 468
470 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; 469 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_;
471 470
472 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); 471 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl);
473 }; 472 };
474 473
475 } // namespace content 474 } // namespace content
476 475
477 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ 476 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698