OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "chrome/browser/profiles/profile_keyed_service.h" | 14 #include "chrome/browser/profiles/profile_keyed_service.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
(...skipping 20 matching lines...) Expand all Loading... |
37 // A string which identifies the device that the gallery lives on. | 37 // A string which identifies the device that the gallery lives on. |
38 std::string identifier; | 38 std::string identifier; |
39 | 39 |
40 // The user-visible name of this gallery. | 40 // The user-visible name of this gallery. |
41 string16 display_name; | 41 string16 display_name; |
42 }; | 42 }; |
43 | 43 |
44 // A class to manage the media galleries that the user has added, explicitly or | 44 // A class to manage the media galleries that the user has added, explicitly or |
45 // otherwise. There is one registry per user profile. | 45 // otherwise. There is one registry per user profile. |
46 // TODO(estade): should MediaFileSystemRegistry be merged into this class? | 46 // TODO(estade): should MediaFileSystemRegistry be merged into this class? |
47 class MediaGalleryRegistry : public ProfileKeyedService { | 47 class MediaGalleriesPreferences : public ProfileKeyedService { |
48 public: | 48 public: |
49 explicit MediaGalleryRegistry(Profile* profile); | 49 typedef std::list<MediaGallery> MediaGalleries; |
50 virtual ~MediaGalleryRegistry(); | 50 |
| 51 explicit MediaGalleriesPreferences(Profile* profile); |
| 52 virtual ~MediaGalleriesPreferences(); |
51 | 53 |
52 // Builds |remembered_galleries_| from the persistent store. | 54 // Builds |remembered_galleries_| from the persistent store. |
53 void InitFromPrefs(); | 55 void InitFromPrefs(); |
54 | 56 |
55 // Teaches the registry about a new gallery defined by |path| (which should | 57 // Teaches the registry about a new gallery defined by |path| (which should |
56 // be a directory). | 58 // be a directory). |
57 void AddGalleryByPath(const FilePath& path); | 59 void AddGalleryByPath(const FilePath& path); |
58 | 60 |
59 // Removes the gallery identified by |id| from the store. | 61 // Removes the gallery identified by |id| from the store. |
60 void ForgetGalleryById(uint64 id); | 62 void ForgetGalleryById(uint64 id); |
61 | 63 |
62 typedef std::list<MediaGallery> MediaGalleries; | |
63 | |
64 const MediaGalleries& remembered_galleries() const { | 64 const MediaGalleries& remembered_galleries() const { |
65 return remembered_galleries_; | 65 return remembered_galleries_; |
66 } | 66 } |
67 | 67 |
68 // ProfileKeyedService implementation: | 68 // ProfileKeyedService implementation: |
69 virtual void Shutdown() OVERRIDE; | 69 virtual void Shutdown() OVERRIDE; |
70 | 70 |
71 static void RegisterUserPrefs(PrefService* prefs); | 71 static void RegisterUserPrefs(PrefService* prefs); |
72 | 72 |
73 // Returns true if the media gallery UI is turned on. | 73 // Returns true if the media gallery UI is turned on. |
74 static bool UserInteractionIsEnabled(); | 74 static bool UserInteractionIsEnabled(); |
75 | 75 |
76 private: | 76 private: |
77 // The profile that owns |this|. | 77 // The profile that owns |this|. |
78 Profile* profile_; | 78 Profile* profile_; |
79 | 79 |
80 // An in-memory cache of known galleries. | 80 // An in-memory cache of known galleries. |
81 // TODO(estade): either actually use this, or remove it. | 81 // TODO(estade): either actually use this, or remove it. |
82 MediaGalleries remembered_galleries_; | 82 MediaGalleries remembered_galleries_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(MediaGalleryRegistry); | 84 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); |
85 }; | 85 }; |
86 | 86 |
87 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_ | 87 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_ |
OLD | NEW |