- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / api / media_galleries_private / media_galleries_private_event_router.h
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 events for the private Chrome extensions media galleries API. This
6 // is temporary and will be moved to a permanent, public place in the near
7 // future. This class object lives on the UI thread.
8
9 #ifndef CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PRIVATE_EVENT_ROUTER_H_
10 #define CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PRIVATE_EVENT_ROUTER_H_
11
12 #include <set>
13 #include <string>
14
15 #include "base/basictypes.h"
16 #include "base/compiler_specific.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h"
19 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
20 #include "chrome/browser/storage_monitor/removable_storage_observer.h"
21
22 class Profile;
23
24 namespace base {
25 class ListValue;
26 }
27
28 namespace extensions {
29
30 class MediaGalleriesPrivateEventRouter
31     : public RemovableStorageObserver,
32       public base::SupportsWeakPtr<MediaGalleriesPrivateEventRouter> {
33  public:
34   explicit MediaGalleriesPrivateEventRouter(Profile* profile);
35   virtual ~MediaGalleriesPrivateEventRouter();
36
37   // Gallery changed event handler.
38   void OnGalleryChanged(MediaGalleryPrefId gallery_id,
39                         const std::set<std::string>& extension_ids);
40
41  private:
42   // RemovableStorageObserver implementation.
43   virtual void OnRemovableStorageAttached(const StorageInfo& info) OVERRIDE;
44   virtual void OnRemovableStorageDetached(const StorageInfo& info) OVERRIDE;
45
46   void DispatchEvent(const std::string& event_name,
47                      scoped_ptr<base::ListValue> event_args);
48
49   // Current profile.
50   Profile* profile_;
51
52   DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateEventRouter);
53 };
54
55 }  // namespace extensions
56
57 #endif  // CHROME_BROWSER_EXTENSIONS_API_MEDIA_GALLERIES_PRIVATE_MEDIA_GALLERIES_PRIVATE_EVENT_ROUTER_H_