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

Side by Side Diff: chrome/browser/media_gallery/media_gallery_database.h

Issue 9567035: Added MediaGalleryDatabase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Moved media_gallery code to chrome Created 8 years, 9 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 | chrome/browser/media_gallery/media_gallery_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_DATABASE_H_
6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_DATABASE_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/file_path.h"
11 #include "chrome/browser/media_gallery/media_gallery_database_types.h"
12 #include "sql/connection.h"
13 #include "sql/init_status.h"
14 #include "sql/meta_table.h"
15
16 namespace chrome {
17
18 // Encapsulates the SQL database that stores pre-parsed media gallery metadata
19 // for search and retrieval.
20 class MediaGalleryDatabase {
21 public:
22 MediaGalleryDatabase();
23 virtual ~MediaGalleryDatabase();
24
25 // Must call this function to complete initialization. Will return true on
26 // success. On false, no other function should be called.
27 sql::InitStatus Init(const FilePath& database_path);
28
29 // Returns the current version that we will generate media gallery databases
30 // with.
31 static int GetCurrentVersion();
32
33 // Sets the id field of the input collection_row to the generated unique
34 // key value and returns the same. On failure, returns zero.
35 int CreateCollectionRow(CollectionRow* collection_row);
36
37 // Finds the row with the specified id and fills its data into the collection
38 // pointer passed by the caller. Returns true on success.
39 bool GetCollectionRow(CollectionId id, CollectionRow* collection);
40
41 protected:
42 virtual sql::Connection& GetDB();
43
44 // Initializes an already open database.
45 sql::InitStatus InitInternal(sql::Connection* db);
46 static bool DoesCollectionsTableExist(sql::Connection* db);
47
48 private:
49 static bool CreateCollectionsTable(sql::Connection* db);
50 sql::InitStatus EnsureCurrentVersion();
51 void FillCollectionRow(const sql::Statement& statement, CollectionRow* row);
52
53 sql::Connection db_;
54 sql::MetaTable meta_table_;
55
56 DISALLOW_COPY_AND_ASSIGN(MediaGalleryDatabase);
57 };
58
59 } // namespace chrome
60
61 std::ostream& operator<<(std::ostream& out, const chrome::CollectionRow& row);
62
63 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_DATABASE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_gallery_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698