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

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

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

Powered by Google App Engine
This is Rietveld 408576698