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

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: Merge 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
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_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 {
18
19 class CONTENT_EXPORT MediaGalleryDatabase {
20 public:
21 MediaGalleryDatabase();
22 virtual ~MediaGalleryDatabase();
23
24 // Must call this function to complete initialization. Will return true on
25 // success. On false, no other function should be called.
26 sql::InitStatus Init(const FilePath& database_path);
27
28 // Returns the current version that we will generate media gallery databases
29 // with.
30 static int GetCurrentVersion();
31
32 // Sets the id field of the input collection_row to the generated unique
33 // key value and returns the same. On failure, returns zero.
34 int CreateCollectionRow(CollectionRow* collection_row);
35
36 // Finds the row with the specified id and fills its data into the collection
37 // pointer passed by the caller. Returns true on success.
38 bool GetCollectionRow(CollectionId id, CollectionRow* collection);
39
vandebo (ex-Chrome) 2012/03/07 23:28:31 We'll also need something to update a row, but tha
tpayne 2012/03/08 00:04:50 Yes, that will come later.
40 protected:
vandebo (ex-Chrome) 2012/03/07 23:28:31 I think these can be private - There are no plans
tpayne 2012/03/08 00:04:50 It is inherited by the test code.
41 virtual sql::Connection& GetDB();
42
43 // Initializes an already open database.
44 sql::InitStatus InitInternal(sql::Connection* db);
45 static bool DoesCollectionsTableExist(sql::Connection* db);
46
47 private:
48 static bool CreateCollectionsTable(sql::Connection* db);
49 sql::InitStatus EnsureCurrentVersion();
50 void FillCollectionRow(const sql::Statement& statement, CollectionRow* row);
51
52 sql::Connection db_;
53 sql::MetaTable meta_table_;
54
55 DISALLOW_COPY_AND_ASSIGN(MediaGalleryDatabase);
56 };
57
58 } // namespace media_gallery
59
60 std::ostream& operator<<(std::ostream& out,
61 const media_gallery::CollectionRow& row);
62
63 #endif // CONTENT_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698