| Index: chrome/browser/history/download_database.h
|
| diff --git a/chrome/browser/history/download_database.h b/chrome/browser/history/download_database.h
|
| index d8ceda9c3e014dcae6eae2969c2c9f44cea99cd1..8aaec99fd971305c22f9a74de1740136089f1042 100644
|
| --- a/chrome/browser/history/download_database.h
|
| +++ b/chrome/browser/history/download_database.h
|
| @@ -8,6 +8,7 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/threading/platform_thread.h"
|
| #include "sql/meta_table.h"
|
|
|
| @@ -22,6 +23,24 @@ struct DownloadRow;
|
| // Maintains a table of downloads.
|
| class DownloadDatabase {
|
| public:
|
| + // Visible outside of download_database.cc only for testing.
|
| + static const int kStateInvalid;
|
| + static const int kStateInProgress;
|
| + static const int kStateComplete;
|
| + static const int kStateCancelled;
|
| + static const int kStateBug140687;
|
| + static const int kStateInterrupted;
|
| +
|
| + static const int kDangerTypeInvalid;
|
| + static const int kDangerTypeNotDangerous;
|
| + static const int kDangerTypeDangerousFile;
|
| + static const int kDangerTypeDangerousUrl;
|
| + static const int kDangerTypeDangerousContent;
|
| + static const int kDangerTypeMaybeDangerousContent;
|
| + static const int kDangerTypeUncommonContent;
|
| + static const int kDangerTypeUserValidated;
|
| + static const int kDangerTypeDangerousHost;
|
| +
|
| // The value of |db_handle| indicating that the associated DownloadItem is not
|
| // yet persisted.
|
| static const int64 kUninitializedHandle;
|
| @@ -41,12 +60,6 @@ class DownloadDatabase {
|
| // to select the row in the database table to update.
|
| bool UpdateDownload(const DownloadRow& data);
|
|
|
| - // Fixes state of the download entries. Sometimes entries with IN_PROGRESS
|
| - // state are not updated during browser shutdown (particularly when crashing).
|
| - // On the next start such entries are considered canceled. This functions
|
| - // fixes such entries.
|
| - bool CleanUpInProgressEntries();
|
| -
|
| // Create a new database entry for one download and return its primary db id.
|
| int64 CreateDownload(const DownloadRow& info);
|
|
|
| @@ -79,6 +92,13 @@ class DownloadDatabase {
|
| bool DropDownloadTable();
|
|
|
| private:
|
| + // Fixes state of the download entries. Sometimes entries with IN_PROGRESS
|
| + // state are not updated during browser shutdown (particularly when crashing).
|
| + // On the next start such entries are considered interrupted with
|
| + // interrupt reason |DOWNLOAD_INTERRUPT_REASON_CRASH|. This functions
|
| + // fixes such entries.
|
| + void CleanUpInProgressEntries();
|
| +
|
| bool EnsureColumnExists(const std::string& name, const std::string& type);
|
|
|
| bool owning_thread_set_;
|
| @@ -87,6 +107,8 @@ class DownloadDatabase {
|
| int next_id_;
|
| int next_db_handle_;
|
|
|
| + base::WeakPtrFactory<DownloadDatabase> weak_ptr_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DownloadDatabase);
|
| };
|
|
|
|
|