Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / storage_monitor / test_storage_monitor.h
blob8a2e4ef648bc91324d9a5428d87ecc658fc4eedb
1 // Copyright (c) 2013 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.
5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_
8 #include <string>
10 #include "chrome/browser/storage_monitor/storage_monitor.h"
12 class TestStorageMonitor : public StorageMonitor {
13 public:
14 TestStorageMonitor();
15 virtual ~TestStorageMonitor();
17 virtual void Init() OVERRIDE;
19 void MarkInitialized();
21 // Create and initialize a new TestStorageMonitor and install it
22 // in the TestingBrowserProcess. The TestingBrowserProcess owns the created
23 // TestStorageMonitor, but it is also returned for convenience. If there is
24 // no TestingBrowserProcess to own the TestStorageMonitor, it is destroyed
25 // and the return value is NULL.
26 static TestStorageMonitor* CreateAndInstall();
28 // Create and initialize a new TestStorageMonitor, and install it
29 // in the BrowserProcessImpl. (Browser tests use the production browser
30 // process implementation.) The BrowserProcessImpl owns the created
31 // TestStorageMonitor, but it is also returned for convenience.
32 static TestStorageMonitor* CreateForBrowserTests();
34 // Remove the singleton StorageMonitor from the TestingBrowserProcess.
35 static void RemoveSingleton();
37 // Synchronously initialize the current storage monitor.
38 static void SyncInitialize();
40 virtual bool GetStorageInfoForPath(
41 const base::FilePath& path,
42 StorageInfo* device_info) const OVERRIDE;
44 #if defined(OS_WIN)
45 virtual bool GetMTPStorageInfoFromDeviceId(
46 const std::string& storage_device_id,
47 base::string16* device_location,
48 base::string16* storage_object_id) const OVERRIDE;
49 #endif
51 #if defined(OS_LINUX)
52 virtual device::MediaTransferProtocolManager*
53 media_transfer_protocol_manager() OVERRIDE;
54 #endif
56 virtual Receiver* receiver() const OVERRIDE;
58 virtual void EjectDevice(
59 const std::string& device_id,
60 base::Callback<void(StorageMonitor::EjectStatus)> callback)
61 OVERRIDE;
63 const std::string& ejected_device() const { return ejected_device_; }
65 bool init_called() const { return init_called_; }
67 private:
68 // Whether TestStorageMonitor::Init() has been called for not.
69 bool init_called_;
71 // The last device to be ejected.
72 std::string ejected_device_;
74 #if defined(OS_LINUX)
75 scoped_ptr<device::MediaTransferProtocolManager>
76 media_transfer_protocol_manager_;
77 #endif
80 #endif // CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_