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

Side by Side Diff: chrome/browser/extensions/api/media_galleries_private/gallery_watch_manager.h

Issue 11535008: Implement mediaGalleriesPrivate api to notify extensions about gallery changed events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable SetupGalleryWatch browser test on ChromeOS Created 7 years, 11 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 | chrome/browser/extensions/api/media_galleries_private/gallery_watch_manager.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 // Manages all the gallery file watchers for the associated profile. This class
6 // lives on the file thread. This class is instantiated per profile. This
7 // is temporary and will be moved to a permanent, public place in the near
8 // future. Please refer to crbug.com/166950 for more details.
9
10 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_MANA GER_H_
11 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_MANA GER_H_
12
13 #include <map>
14 #include <string>
15
16 #include "base/file_path.h"
17 #include "base/memory/weak_ptr.h"
18 #include "chrome/browser/media_gallery/media_galleries_preferences.h"
19
20 namespace extensions {
21
22 class MediaGalleriesPrivateEventRouter;
23
24 class GalleryWatchManager {
25 public:
26 // Returns the GalleryWatchManager for |profile_id|, creating it if it is not
27 // yet created.
28 static GalleryWatchManager* GetForProfile(void* profile_id);
29
30 // Returns true if an GalleryWatchManager already exists for the specified
31 // |profile_id|.
32 static bool HasForProfile(void* profile_id);
33
34 // Notifies about the profile shutdown event.
35 static void OnProfileShutdown(void* profile_id);
36
37 // Initiates a gallery watch operation for the extension specified by
38 // the |extension_id|. |gallery_id| specifies the gallery identifier and
39 // |watch_path| specifies the absolute path of the gallery. Returns true,
40 // if the watch was set successfully.
41 bool StartGalleryWatch(
42 chrome::MediaGalleryPrefId gallery_id,
43 const FilePath& watch_path,
44 const std::string& extension_id,
45 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router);
46
47 // Cancels the gallery watch operation for the extension specified by the
48 // |extension_id|. |watch_path| specifies the absolute path of the gallery.
49 void StopGalleryWatch(const FilePath& watch_path,
50 const std::string& extension_id);
51
52 // Handles the extension unloaded/uninstalled/destroyed event.
53 void OnExtensionDestroyed(const std::string& extension_id);
54
55 private:
56 class GalleryFilePathWatcher;
57 typedef std::map<FilePath, GalleryFilePathWatcher* > WatcherMap;
58
59 // Use GetForProfile().
60 GalleryWatchManager();
61 ~GalleryWatchManager();
62
63 // Deletes the gallery watchers.
64 void DeleteAllWatchers();
65
66 // Removes the GalleryFilePathWatcher entry associated with the given
67 // |watch_path|.
68 void RemoveGalleryFilePathWatcherEntry(const FilePath& watch_path);
69
70 // Map to manage the gallery file path watchers.
71 // Key: Gallery watch path.
72 // Value: GalleryFilePathWatcher*.
73 WatcherMap gallery_watchers_;
74
75 DISALLOW_COPY_AND_ASSIGN(GalleryWatchManager);
76 };
77
78 } // namespace extensions
79
80 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_M ANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/media_galleries_private/gallery_watch_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698