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

Side by Side Diff: chrome/browser/history/download_database.h

Issue 7793003: Revert 98656 - Make a new integer field in sql::MetaTable (a per-profile db) containing a counter... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « chrome/browser/download/download_util.h ('k') | chrome/browser/history/download_database.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_HISTORY_DOWNLOAD_DATABASE_H_ 5 #ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_ 6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/history/history_types.h" 9 #include "chrome/browser/history/history_types.h"
10 #include "sql/meta_table.h"
11 10
12 struct DownloadPersistentStoreInfo; 11 struct DownloadPersistentStoreInfo;
13 class FilePath; 12 class FilePath;
14 13
15 namespace sql { 14 namespace sql {
16 class Connection; 15 class Connection;
17 } 16 }
18 17
19 namespace history { 18 namespace history {
20 19
21 // Maintains a table of downloads. 20 // Maintains a table of downloads.
22 class DownloadDatabase { 21 class DownloadDatabase {
23 public: 22 public:
24 // Must call InitDownloadTable before using any other functions. 23 // Must call InitDownloadTable before using any other functions.
25 DownloadDatabase(); 24 DownloadDatabase();
26 virtual ~DownloadDatabase(); 25 virtual ~DownloadDatabase();
27 26
28 int next_download_id() const { return next_id_; }
29
30 // Get all the downloads from the database. 27 // Get all the downloads from the database.
31 void QueryDownloads(std::vector<DownloadPersistentStoreInfo>* results); 28 void QueryDownloads(std::vector<DownloadPersistentStoreInfo>* results);
32 29
33 // Update the state of one download. Returns true if successful. 30 // Update the state of one download. Returns true if successful.
34 bool UpdateDownload(int64 received_bytes, int32 state, DownloadID db_handle); 31 bool UpdateDownload(int64 received_bytes, int32 state, DownloadID db_handle);
35 32
36 // Update the path of one download. Returns true if successful. 33 // Update the path of one download. Returns true if successful.
37 bool UpdateDownloadPath(const FilePath& path, DownloadID db_handle); 34 bool UpdateDownloadPath(const FilePath& path, DownloadID db_handle);
38 35
39 // Fixes state of the download entries. Sometimes entries with IN_PROGRESS 36 // Fixes state of the download entries. Sometimes entries with IN_PROGRESS
(...skipping 19 matching lines...) Expand all
59 virtual sql::Connection& GetDB() = 0; 56 virtual sql::Connection& GetDB() = 0;
60 57
61 // Creates the downloads table if needed. 58 // Creates the downloads table if needed.
62 bool InitDownloadTable(); 59 bool InitDownloadTable();
63 60
64 // Used to quickly clear the downloads. First you would drop it, then you 61 // Used to quickly clear the downloads. First you would drop it, then you
65 // would re-initialize it. 62 // would re-initialize it.
66 bool DropDownloadTable(); 63 bool DropDownloadTable();
67 64
68 private: 65 private:
69 int next_id_;
70 sql::MetaTable meta_table_;
71
72 DISALLOW_COPY_AND_ASSIGN(DownloadDatabase); 66 DISALLOW_COPY_AND_ASSIGN(DownloadDatabase);
73 }; 67 };
74 68
75 } // namespace history 69 } // namespace history
76 70
77 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_ 71 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | chrome/browser/history/download_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698