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

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: Fix windows compile 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 history databases with.
Lei Zhang 2012/03/07 01:41:42 history -> media gallery.
tpayne 2012/03/07 18:04:03 Done.
29 static int GetCurrentVersion();
30
31 // Sets the id_ field of the input collection_row to the generated unique
Lei Zhang 2012/03/07 01:41:42 id_ -> id
tpayne 2012/03/07 18:04:03 Done.
32 // key value and returns the same. On failure, returns zero.
Lei Zhang 2012/03/07 01:41:42 What does it return on success?
tpayne 2012/03/07 18:04:03 The new value of row->id. See "and returns the sam
33 int CreateCollectionRow(CollectionRow* collection_row);
34
35 // Finds the row with the specified id and fills its data into the collection
36 // pointer passed by the caller. Returns true on success.
37 bool GetCollectionRow(CollectionId id, CollectionRow* collection);
38
39 protected:
40 virtual sql::Connection& GetDB();
41
42 // Initializes an already open database.
43 sql::InitStatus InitInternal(sql::Connection* db);
44 static bool DoesCollectionsTableExist(sql::Connection* db);
45
46 private:
47 sql::Connection db_;
Lei Zhang 2012/03/07 01:41:42 Methods before data members.
tpayne 2012/03/07 18:04:03 Done.
48 sql::MetaTable meta_table_;
49 static bool CreateCollectionsTable(sql::Connection* db);
50 sql::InitStatus EnsureCurrentVersion();
51 void FillCollectionRow(const sql::Statement& s, CollectionRow* i);
52
53 DISALLOW_COPY_AND_ASSIGN(MediaGalleryDatabase);
54 };
55
56 } // namespace media_gallery
57
58 std::ostream& operator<<(std::ostream& out,
59 const media_gallery::CollectionRow& row);
60
61 #endif // CONTENT_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698