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

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor.h

Issue 16703025: [StorageMonitor] Move StorageMonitor ownership to BrowserProcessImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 5 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
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 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ 6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 }; 61 };
62 62
63 // Status codes for the result of an EjectDevice() call. 63 // Status codes for the result of an EjectDevice() call.
64 enum EjectStatus { 64 enum EjectStatus {
65 EJECT_OK, 65 EJECT_OK,
66 EJECT_IN_USE, 66 EJECT_IN_USE,
67 EJECT_NO_SUCH_DEVICE, 67 EJECT_NO_SUCH_DEVICE,
68 EJECT_FAILURE 68 EJECT_FAILURE
69 }; 69 };
70 70
71 // Returns a pointer to a created per-platform object with the StorageMonitor
72 // interface.
73 static StorageMonitor* Create();
74
71 // Returns a pointer to an object owned by the BrowserMainParts, with lifetime 75 // Returns a pointer to an object owned by the BrowserMainParts, with lifetime
Lei Zhang 2013/07/02 23:16:57 update comment
Greg Billock 2013/07/03 17:49:17 Done.
72 // somewhat shorter than a process Singleton. 76 // somewhat shorter than a process Singleton.
73 static StorageMonitor* GetInstance(); 77 static StorageMonitor* GetInstance();
74 78
79 StorageMonitor();
80 virtual ~StorageMonitor();
Lei Zhang 2013/07/02 23:16:57 nit: blank line after
Greg Billock 2013/07/03 17:49:17 Done.
75 // Ensures that the storage monitor is initialized. The provided callback, If 81 // Ensures that the storage monitor is initialized. The provided callback, If
76 // non-null, will be called when initialization is complete. If initialization 82 // non-null, will be called when initialization is complete. If initialization
77 // has already completed, this callback will be invoked within the calling 83 // has already completed, this callback will be invoked within the calling
78 // stack. Before the callback is run, calls to |GetAllAvailableStorages| and 84 // stack. Before the callback is run, calls to |GetAllAvailableStorages| and
79 // |GetStorageInfoForPath| may not return the correct results. In addition, 85 // |GetStorageInfoForPath| may not return the correct results. In addition,
80 // registered observers will not be notified on device attachment/detachment. 86 // registered observers will not be notified on device attachment/detachment.
81 // Should be invoked on the UI thread; callbacks will be run on the UI thread. 87 // Should be invoked on the UI thread; callbacks will be run on the UI thread.
82 void EnsureInitialized(base::Closure callback); 88 void EnsureInitialized(base::Closure callback);
83 89
84 // Return true if the storage monitor has already been initialized. 90 // Return true if the storage monitor has already been initialized.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const std::string& device_id, 130 const std::string& device_id,
125 base::Callback<void(EjectStatus)> callback); 131 base::Callback<void(EjectStatus)> callback);
126 132
127 protected: 133 protected:
128 friend class ::MediaGalleriesPlatformAppBrowserTest; 134 friend class ::MediaGalleriesPlatformAppBrowserTest;
129 friend class ::MediaGalleriesPrivateApiTest; 135 friend class ::MediaGalleriesPrivateApiTest;
130 friend class ::MediaGalleriesPrivateEjectApiTest; 136 friend class ::MediaGalleriesPrivateEjectApiTest;
131 friend class MediaFileSystemRegistryTest; 137 friend class MediaFileSystemRegistryTest;
132 friend class ::SystemInfoStorageApiTest; 138 friend class ::SystemInfoStorageApiTest;
133 139
134 StorageMonitor();
135 virtual ~StorageMonitor();
136
137 // Removes the existing singleton for testing.
138 // (So that a new one can be created.)
139 static void RemoveSingletonForTesting();
140
141 virtual Receiver* receiver() const; 140 virtual Receiver* receiver() const;
142 141
143 // Called to initialize the storage monitor. 142 // Called to initialize the storage monitor.
144 virtual void Init() = 0; 143 virtual void Init() = 0;
145 144
146 // Called by subclasses to mark the storage monitor as 145 // Called by subclasses to mark the storage monitor as
147 // fully initialized. Must be called on the UI thread. 146 // fully initialized. Must be called on the UI thread.
148 void MarkInitialized(); 147 void MarkInitialized();
149 148
150 private: 149 private:
(...skipping 23 matching lines...) Expand all
174 173
175 // Map of all known storage devices,including fixed and removable storages. 174 // Map of all known storage devices,including fixed and removable storages.
176 StorageMap storage_map_; 175 StorageMap storage_map_;
177 176
178 scoped_ptr<TransientDeviceIds> transient_device_ids_; 177 scoped_ptr<TransientDeviceIds> transient_device_ids_;
179 }; 178 };
180 179
181 } // namespace chrome 180 } // namespace chrome
182 181
183 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_ 182 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698