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

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: Addressed review comments Created 8 years 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 // 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
Lei Zhang 2012/12/19 01:03:47 You should reference a bug for this.
kmadhusu 2012/12/19 21:55:55 Is it okay to specify the metabug crbug.com/144491
Lei Zhang 2012/12/19 22:35:50 Let's file a new bug. Otherwise, some people will
kmadhusu 2012/12/19 23:13:17 Done.
8 // future.
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/ref_counted.h"
18 #include "base/time.h"
Lei Zhang 2012/12/19 01:03:47 nit: move to .cc file
kmadhusu 2012/12/19 21:55:55 Done.
19
20 class Profile;
21
22 namespace extensions {
23
24 class GalleryFilePathWatcher;
Lei Zhang 2012/12/19 01:03:47 Why did this get moved out of GalleryWatchManager?
kmadhusu 2012/12/19 21:55:55 Fixed.
25
26 class GalleryWatchManager {
27 public:
28 // Returns the GalleryWatchManager for |profile|, creating it if it is not
29 // yet created.
30 static GalleryWatchManager* GetForProfile(Profile* profile);
31
32 // Returns true if an GalleryWatchManager already exists for the specified
33 // |profile|.
34 static bool HasForProfile(Profile* profile);
35
36 // Notifies about the |profile| shutdown event.
37 static void OnProfileShutdown(Profile* profile);
38
39 ~GalleryWatchManager();
Lei Zhang 2012/12/19 01:03:47 private?
kmadhusu 2012/12/19 21:55:55 Done.
40
41 // Initiates a gallery watch operation for the extension specified by
42 // the |extension_id|. |gallery_id| specifies the gallery identifier and
43 // |watch_path| specifies the absolute path of the gallery. Returns true,
44 // if the watch was set successfully.
45 bool StartGalleryWatch(uint64 gallery_id,
46 const FilePath& watch_path,
47 const std::string& extension_id);
48
49 // Cancels the gallery watch operation for the extension specified by the
50 // |extension_id|. |watch_path| specifies the gallery absolute path.
Lei Zhang 2012/12/19 01:03:47 nit: gallery absolute path -> absolute path of the
kmadhusu 2012/12/19 21:55:55 Done.
51 void StopGalleryWatch(const FilePath& watch_path,
52 const std::string& extension_id);
53
54 // Handles the extension unloaded/uninstalled/destroyed event.
55 void OnExtensionDestroyed(const std::string& extension_id);
56
57 private:
58 typedef std::map<FilePath, scoped_refptr<GalleryFilePathWatcher> > WatcherMap;
59
60 // Use GetForProfile().
61 explicit GalleryWatchManager(Profile* profile);
62
63 // Deletes the gallery watchers.
64 void DeleteAllWatchers();
65
66 // Current profile.
67 Profile* profile_;
68
69 // Map to manage the gallery file path watchers.
70 // Key: Gallery watch path.
71 // Value: GalleryFilePathWatcher*.
72 WatcherMap gallery_watchers_;
73
74 DISALLOW_COPY_AND_ASSIGN(GalleryWatchManager);
75 };
76
77 } // namespace extensions
78
79 #endif // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_GALLERY_WATCH_M ANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698