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

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

Issue 10835016: Rename media gallery -> media galleries in pref/UI components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_
6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_
7
8 #include <list>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/file_path.h"
13 #include "base/string16.h"
14 #include "chrome/browser/profiles/profile_keyed_service.h"
15
16 namespace base {
17 class DictionaryValue;
18 }
19
20 class PrefService;
21 class Profile;
22
23 struct MediaGallery {
24 MediaGallery();
25 ~MediaGallery();
26
27 // The ID that uniquely, persistently identifies the gallery.
28 uint64 id;
29
30 // The directory where the gallery is located, relative to the base path
31 // for the device.
32 FilePath path;
33
34 // The base path of the device.
35 FilePath base_path;
36
37 // A string which identifies the device that the gallery lives on.
38 std::string identifier;
39
40 // The user-visible name of this gallery.
41 string16 display_name;
42 };
43
44 // A class to manage the media galleries that the user has added, explicitly or
45 // otherwise. There is one registry per user profile.
46 // TODO(estade): should MediaFileSystemRegistry be merged into this class?
47 class MediaGalleryRegistry : public ProfileKeyedService {
48 public:
49 explicit MediaGalleryRegistry(Profile* profile);
50 virtual ~MediaGalleryRegistry();
51
52 // Builds |remembered_galleries_| from the persistent store.
53 void InitFromPrefs();
54
55 // Teaches the registry about a new gallery defined by |path| (which should
56 // be a directory).
57 void AddGalleryByPath(const FilePath& path);
58
59 // Removes the gallery identified by |id| from the store.
60 void ForgetGalleryById(uint64 id);
61
62 typedef std::list<MediaGallery> MediaGalleries;
63
64 const MediaGalleries& remembered_galleries() const {
65 return remembered_galleries_;
66 }
67
68 // ProfileKeyedService implementation:
69 virtual void Shutdown() OVERRIDE;
70
71 static void RegisterUserPrefs(PrefService* prefs);
72
73 // Returns true if the media gallery UI is turned on.
74 static bool UserInteractionIsEnabled();
75
76 private:
77 // The profile that owns |this|.
78 Profile* profile_;
79
80 // An in-memory cache of known galleries.
81 // TODO(estade): either actually use this, or remove it.
82 MediaGalleries remembered_galleries_;
83
84 DISALLOW_COPY_AND_ASSIGN(MediaGalleryRegistry);
85 };
86
87 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698