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_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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 DownloadItemImpl(DownloadItemImplDelegate* delegate, | 37 DownloadItemImpl(DownloadItemImplDelegate* delegate, |
38 content::DownloadId download_id, | 38 content::DownloadId download_id, |
39 const content::DownloadPersistentStoreInfo& info, | 39 const content::DownloadPersistentStoreInfo& info, |
40 const net::BoundNetLog& bound_net_log); | 40 const net::BoundNetLog& bound_net_log); |
41 | 41 |
42 // Constructing for a regular download. | 42 // Constructing for a regular download. |
43 // |bound_net_log| is constructed externally for our use. | 43 // |bound_net_log| is constructed externally for our use. |
44 DownloadItemImpl(DownloadItemImplDelegate* delegate, | 44 DownloadItemImpl(DownloadItemImplDelegate* delegate, |
45 const DownloadCreateInfo& info, | 45 const DownloadCreateInfo& info, |
46 scoped_ptr<DownloadRequestHandleInterface> request_handle, | 46 scoped_ptr<DownloadRequestHandleInterface> request_handle, |
47 bool is_otr, | |
48 const net::BoundNetLog& bound_net_log); | 47 const net::BoundNetLog& bound_net_log); |
49 | 48 |
50 // Constructing for the "Save Page As..." feature: | 49 // Constructing for the "Save Page As..." feature: |
51 // |bound_net_log| is constructed externally for our use. | 50 // |bound_net_log| is constructed externally for our use. |
52 DownloadItemImpl(DownloadItemImplDelegate* delegate, | 51 DownloadItemImpl(DownloadItemImplDelegate* delegate, |
53 const FilePath& path, | 52 const FilePath& path, |
54 const GURL& url, | 53 const GURL& url, |
55 bool is_otr, | |
56 content::DownloadId download_id, | 54 content::DownloadId download_id, |
57 const std::string& mime_type, | 55 const std::string& mime_type, |
58 const net::BoundNetLog& bound_net_log); | 56 const net::BoundNetLog& bound_net_log); |
59 | 57 |
60 virtual ~DownloadItemImpl(); | 58 virtual ~DownloadItemImpl(); |
61 | 59 |
62 // Implementation functions (not part of the DownloadItem interface). | 60 // Implementation functions (not part of the DownloadItem interface). |
63 | 61 |
64 // Called when the target path has been determined. |target_path| is the | 62 // Called when the target path has been determined. |target_path| is the |
65 // suggested target path. |disposition| indicates how the target path should | 63 // suggested target path. |disposition| indicates how the target path should |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 virtual void SetOpenWhenComplete(bool open) OVERRIDE; | 172 virtual void SetOpenWhenComplete(bool open) OVERRIDE; |
175 virtual bool GetFileExternallyRemoved() const OVERRIDE; | 173 virtual bool GetFileExternallyRemoved() const OVERRIDE; |
176 virtual SafetyState GetSafetyState() const OVERRIDE; | 174 virtual SafetyState GetSafetyState() const OVERRIDE; |
177 virtual content::DownloadDangerType GetDangerType() const OVERRIDE; | 175 virtual content::DownloadDangerType GetDangerType() const OVERRIDE; |
178 virtual bool IsDangerous() const OVERRIDE; | 176 virtual bool IsDangerous() const OVERRIDE; |
179 virtual bool GetAutoOpened() OVERRIDE; | 177 virtual bool GetAutoOpened() OVERRIDE; |
180 virtual FilePath GetTargetName() const OVERRIDE; | 178 virtual FilePath GetTargetName() const OVERRIDE; |
181 virtual const FilePath& GetForcedFilePath() const OVERRIDE; | 179 virtual const FilePath& GetForcedFilePath() const OVERRIDE; |
182 virtual bool HasUserGesture() const OVERRIDE; | 180 virtual bool HasUserGesture() const OVERRIDE; |
183 virtual content::PageTransition GetTransitionType() const OVERRIDE; | 181 virtual content::PageTransition GetTransitionType() const OVERRIDE; |
184 virtual bool IsOtr() const OVERRIDE; | |
185 virtual bool IsTemporary() const OVERRIDE; | 182 virtual bool IsTemporary() const OVERRIDE; |
186 virtual void SetIsTemporary(bool temporary) OVERRIDE; | 183 virtual void SetIsTemporary(bool temporary) OVERRIDE; |
187 virtual void SetOpened(bool opened) OVERRIDE; | 184 virtual void SetOpened(bool opened) OVERRIDE; |
188 virtual bool GetOpened() const OVERRIDE; | 185 virtual bool GetOpened() const OVERRIDE; |
189 virtual const std::string& GetLastModifiedTime() const OVERRIDE; | 186 virtual const std::string& GetLastModifiedTime() const OVERRIDE; |
190 virtual const std::string& GetETag() const OVERRIDE; | 187 virtual const std::string& GetETag() const OVERRIDE; |
191 virtual content::DownloadInterruptReason GetLastReason() const OVERRIDE; | 188 virtual content::DownloadInterruptReason GetLastReason() const OVERRIDE; |
192 virtual content::DownloadPersistentStoreInfo | 189 virtual content::DownloadPersistentStoreInfo |
193 GetPersistentStoreInfo() const OVERRIDE; | 190 GetPersistentStoreInfo() const OVERRIDE; |
194 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; | 191 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // (executable files are typically considered dangerous). | 373 // (executable files are typically considered dangerous). |
377 SafetyState safety_state_; | 374 SafetyState safety_state_; |
378 | 375 |
379 // True if the download was auto-opened. We set this rather than using | 376 // True if the download was auto-opened. We set this rather than using |
380 // an observer as it's frequently possible for the download to be auto opened | 377 // an observer as it's frequently possible for the download to be auto opened |
381 // before the observer is added. | 378 // before the observer is added. |
382 bool auto_opened_; | 379 bool auto_opened_; |
383 | 380 |
384 bool is_persisted_; | 381 bool is_persisted_; |
385 | 382 |
386 // True if the download was initiated in an incognito window. | |
387 bool is_otr_; | |
388 | |
389 // True if the item was downloaded temporarily. | 383 // True if the item was downloaded temporarily. |
390 bool is_temporary_; | 384 bool is_temporary_; |
391 | 385 |
392 // True if we've saved all the data for the download. | 386 // True if we've saved all the data for the download. |
393 bool all_data_saved_; | 387 bool all_data_saved_; |
394 | 388 |
395 // Did the user open the item either directly or indirectly (such as by | 389 // Did the user open the item either directly or indirectly (such as by |
396 // setting always open files of this type)? The shelf also sets this field | 390 // setting always open files of this type)? The shelf also sets this field |
397 // when the user closes the shelf before the item has been opened but should | 391 // when the user closes the shelf before the item has been opened but should |
398 // be treated as though the user opened it. | 392 // be treated as though the user opened it. |
399 bool opened_; | 393 bool opened_; |
400 | 394 |
401 // Do we actually open downloads when requested? For testing purposes only. | 395 // Do we actually open downloads when requested? For testing purposes only. |
402 bool open_enabled_; | 396 bool open_enabled_; |
403 | 397 |
404 // Did the delegate delay calling Complete on this download? | 398 // Did the delegate delay calling Complete on this download? |
405 bool delegate_delayed_complete_; | 399 bool delegate_delayed_complete_; |
406 | 400 |
407 // Net log to use for this download. | 401 // Net log to use for this download. |
408 const net::BoundNetLog bound_net_log_; | 402 const net::BoundNetLog bound_net_log_; |
409 | 403 |
410 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 404 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
411 | 405 |
412 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 406 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
413 }; | 407 }; |
414 | 408 |
415 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 409 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |