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

Side by Side Diff: chrome/browser/media_gallery/media_file_system_registry.h

Issue 11573048: [Media Galleries] Move RemovableStorageInfo notifications to chrome namespace (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to head 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
OLDNEW
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/file_path.h" 17 #include "base/file_path.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/prefs/public/pref_change_registrar.h" 19 #include "base/prefs/public/pref_change_registrar.h"
20 #include "base/system_monitor/system_monitor.h"
21 #include "chrome/browser/media_gallery/transient_device_ids.h" 20 #include "chrome/browser/media_gallery/transient_device_ids.h"
21 #include "chrome/browser/system_monitor/removable_storage_notifications.h"
22 #include "webkit/fileapi/media/mtp_device_file_system_config.h" 22 #include "webkit/fileapi/media/mtp_device_file_system_config.h"
23 23
24 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 24 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
25 #include "chrome/browser/media_gallery/mtp_device_delegate_impl.h" 25 #include "chrome/browser/media_gallery/mtp_device_delegate_impl.h"
26 #endif 26 #endif
27 27
28 class Profile; 28 class Profile;
29 29
30 namespace content { 30 namespace content {
31 class RenderViewHost; 31 class RenderViewHost;
(...skipping 22 matching lines...) Expand all
54 54
55 std::string name; // JSON string, must not contain slashes. 55 std::string name; // JSON string, must not contain slashes.
56 FilePath path; 56 FilePath path;
57 std::string fsid; 57 std::string fsid;
58 }; 58 };
59 59
60 typedef base::Callback<void(const std::vector<MediaFileSystemInfo>&)> 60 typedef base::Callback<void(const std::vector<MediaFileSystemInfo>&)>
61 MediaFileSystemsCallback; 61 MediaFileSystemsCallback;
62 62
63 class MediaFileSystemRegistry 63 class MediaFileSystemRegistry
64 : public base::SystemMonitor::DevicesChangedObserver { 64 : public RemovableStorageNotifications::RemovableStorageObserver {
65 public: 65 public:
66 MediaFileSystemRegistry(); 66 MediaFileSystemRegistry();
67 virtual ~MediaFileSystemRegistry(); 67 virtual ~MediaFileSystemRegistry();
68 68
69 // Passes to |callback| the list of media filesystem IDs and paths for a 69 // Passes to |callback| the list of media filesystem IDs and paths for a
70 // given RVH. Called on the UI thread. 70 // given RVH. Called on the UI thread.
71 void GetMediaFileSystemsForExtension( 71 void GetMediaFileSystemsForExtension(
72 const content::RenderViewHost* rvh, 72 const content::RenderViewHost* rvh,
73 const extensions::Extension* extension, 73 const extensions::Extension* extension,
74 const MediaFileSystemsCallback& callback); 74 const MediaFileSystemsCallback& callback);
75 75
76 // Returns the initialized media galleries preferences for the specified 76 // Returns the initialized media galleries preferences for the specified
77 // |profile|. This method should be used instead of calling 77 // |profile|. This method should be used instead of calling
78 // MediaGalleriesPreferences directly because this method also ensures that 78 // MediaGalleriesPreferences directly because this method also ensures that
79 // currently attached removable devices are added to the preferences. 79 // currently attached removable devices are added to the preferences.
80 // Called on the UI thread. 80 // Called on the UI thread.
81 MediaGalleriesPreferences* GetPreferences(Profile* profile); 81 MediaGalleriesPreferences* GetPreferences(Profile* profile);
82 82
83 // base::SystemMonitor::DevicesChangedObserver implementation. 83 // RemovableStorageObserver implementation.
84 virtual void OnRemovableStorageAttached( 84 virtual void OnRemovableStorageAttached(
85 const std::string& id, 85 const std::string& id,
86 const string16& name, 86 const string16& name,
87 const FilePath::StringType& location) OVERRIDE; 87 const FilePath::StringType& location) OVERRIDE;
88 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE; 88 virtual void OnRemovableStorageDetached(const std::string& id) OVERRIDE;
89 89
90 size_t GetExtensionHostCountForTests() const; 90 size_t GetExtensionHostCountForTests() const;
91 91
92 std::string GetTransientIdForDeviceId(const std::string& device_id) const; 92 std::string GetTransientIdForDeviceId(const std::string& device_id) const;
93 93
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 scoped_ptr<MediaFileSystemContext> file_system_context_; 141 scoped_ptr<MediaFileSystemContext> file_system_context_;
142 142
143 TransientDeviceIds transient_device_ids_; 143 TransientDeviceIds transient_device_ids_;
144 144
145 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry); 145 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistry);
146 }; 146 };
147 147
148 } // namespace chrome 148 } // namespace chrome
149 149
150 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_ 150 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_FILE_SYSTEM_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698