| 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 // MediaFileSystemRegistry registers pictures directories and media devices as |    5 // MediaFileSystemRegistry registers pictures directories and media devices as | 
|    6 // File API filesystems and keeps track of the path to filesystem ID mappings. |    6 // File API filesystems and keeps track of the path to filesystem ID mappings. | 
|    7  |    7  | 
|    8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |    8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 
|    9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |    9 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 
|   10  |   10  | 
|   11 #include <map> |   11 #include <map> | 
|   12 #include <string> |   12 #include <string> | 
|   13 #include <utility> |   13 #include <utility> | 
|   14 #include <vector> |   14 #include <vector> | 
|   15  |   15  | 
|   16 #include "base/basictypes.h" |   16 #include "base/basictypes.h" | 
|   17 #include "base/lazy_instance.h" |   17 #include "base/lazy_instance.h" | 
|   18 #include "base/file_path.h" |   18 #include "base/file_path.h" | 
|   19 #include "base/memory/ref_counted.h" |   19 #include "base/memory/ref_counted.h" | 
|   20 #include "base/memory/weak_ptr.h" |   20 #include "base/memory/weak_ptr.h" | 
|   21 #include "base/prefs/public/pref_change_registrar.h" |   21 #include "base/prefs/public/pref_change_registrar.h" | 
|   22 #include "base/prefs/public/pref_observer.h" |  | 
|   23 #include "base/system_monitor/system_monitor.h" |   22 #include "base/system_monitor/system_monitor.h" | 
|   24 #include "webkit/fileapi/media/mtp_device_file_system_config.h" |   23 #include "webkit/fileapi/media/mtp_device_file_system_config.h" | 
|   25  |   24  | 
|   26 class Profile; |   25 class Profile; | 
|   27  |   26  | 
|   28 namespace content { |   27 namespace content { | 
|   29 class RenderViewHost; |   28 class RenderViewHost; | 
|   30 } |   29 } | 
|   31  |   30  | 
|   32 namespace extensions { |   31 namespace extensions { | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   73 #endif |   72 #endif | 
|   74  |   73  | 
|   75   // Revoke the passed |fsid|. |   74   // Revoke the passed |fsid|. | 
|   76   virtual void RevokeFileSystem(const std::string& fsid) = 0; |   75   virtual void RevokeFileSystem(const std::string& fsid) = 0; | 
|   77 }; |   76 }; | 
|   78  |   77  | 
|   79 typedef base::Callback<void(const std::vector<MediaFileSystemInfo>&)> |   78 typedef base::Callback<void(const std::vector<MediaFileSystemInfo>&)> | 
|   80     MediaFileSystemsCallback; |   79     MediaFileSystemsCallback; | 
|   81  |   80  | 
|   82 class MediaFileSystemRegistry |   81 class MediaFileSystemRegistry | 
|   83     : public base::SystemMonitor::DevicesChangedObserver, |   82     : public base::SystemMonitor::DevicesChangedObserver { | 
|   84       public PrefObserver { |  | 
|   85  public: |   83  public: | 
|   86   // The instance is lazily created per browser process. |   84   // The instance is lazily created per browser process. | 
|   87   static MediaFileSystemRegistry* GetInstance(); |   85   static MediaFileSystemRegistry* GetInstance(); | 
|   88  |   86  | 
|   89   // Passes to |callback| the list of media filesystem IDs and paths for a |   87   // Passes to |callback| the list of media filesystem IDs and paths for a | 
|   90   // given RVH. Called on the UI thread. |   88   // given RVH. Called on the UI thread. | 
|   91   void GetMediaFileSystemsForExtension( |   89   void GetMediaFileSystemsForExtension( | 
|   92       const content::RenderViewHost* rvh, |   90       const content::RenderViewHost* rvh, | 
|   93       const extensions::Extension* extension, |   91       const extensions::Extension* extension, | 
|   94       const MediaFileSystemsCallback& callback); |   92       const MediaFileSystemsCallback& callback); | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
|  124   // ScopedMTPDeviceMapEntry. |  122   // ScopedMTPDeviceMapEntry. | 
|  125   typedef std::map<const FilePath::StringType, |  123   typedef std::map<const FilePath::StringType, | 
|  126                    base::WeakPtr<ScopedMTPDeviceMapEntry> > |  124                    base::WeakPtr<ScopedMTPDeviceMapEntry> > | 
|  127       MTPDeviceDelegateMap; |  125       MTPDeviceDelegateMap; | 
|  128 #endif |  126 #endif | 
|  129  |  127  | 
|  130   // Obtain an instance of this class via GetInstance(). |  128   // Obtain an instance of this class via GetInstance(). | 
|  131   MediaFileSystemRegistry(); |  129   MediaFileSystemRegistry(); | 
|  132   virtual ~MediaFileSystemRegistry(); |  130   virtual ~MediaFileSystemRegistry(); | 
|  133  |  131  | 
|  134   // PrefObserver implementation. |  132   void OnMediaGalleriesRememberedGalleriesChanged(PrefServiceBase* service); | 
|  135   virtual void OnPreferenceChanged(PrefServiceBase* service, |  | 
|  136                                    const std::string& pref_name) OVERRIDE; |  | 
|  137  |  133  | 
|  138 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) |  134 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) | 
|  139   // Returns ScopedMTPDeviceMapEntry object for the given |device_location|. |  135   // Returns ScopedMTPDeviceMapEntry object for the given |device_location|. | 
|  140   ScopedMTPDeviceMapEntry* GetOrCreateScopedMTPDeviceMapEntry( |  136   ScopedMTPDeviceMapEntry* GetOrCreateScopedMTPDeviceMapEntry( | 
|  141       const FilePath::StringType& device_location); |  137       const FilePath::StringType& device_location); | 
|  142  |  138  | 
|  143   // Removes the ScopedMTPDeviceMapEntry associated with the given |  139   // Removes the ScopedMTPDeviceMapEntry associated with the given | 
|  144   // |device_location|. |  140   // |device_location|. | 
|  145   void RemoveScopedMTPDeviceMapEntry( |  141   void RemoveScopedMTPDeviceMapEntry( | 
|  146       const FilePath::StringType& device_location); |  142       const FilePath::StringType& device_location); | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|  161 #endif |  157 #endif | 
|  162  |  158  | 
|  163   scoped_ptr<MediaFileSystemContext> file_system_context_; |  159   scoped_ptr<MediaFileSystemContext> file_system_context_; | 
|  164  |  160  | 
|  165   DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); |  161   DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); | 
|  166 }; |  162 }; | 
|  167  |  163  | 
|  168 }  // namespace chrome |  164 }  // namespace chrome | 
|  169  |  165  | 
|  170 #endif  // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ |  166 #endif  // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ | 
| OLD | NEW |