OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
12 | 13 |
13 namespace extensions { | 14 namespace extensions { |
14 class EventRouter; | 15 class EventRouter; |
15 } // namespace extensions | 16 } // namespace extensions |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 namespace file_system_provider { | 19 namespace file_system_provider { |
19 | 20 |
20 class RequestManager; | 21 class RequestManager; |
21 | 22 |
22 // Fake provided file system implementation. Does not communicate with target | 23 // Fake provided file system implementation. Does not communicate with target |
23 // extensions. Used for unit tests. | 24 // extensions. Used for unit tests. |
24 class FakeProvidedFileSystem : public ProvidedFileSystemInterface { | 25 class FakeProvidedFileSystem : public ProvidedFileSystemInterface { |
25 public: | 26 public: |
26 explicit FakeProvidedFileSystem( | 27 explicit FakeProvidedFileSystem( |
27 const ProvidedFileSystemInfo& file_system_info); | 28 const ProvidedFileSystemInfo& file_system_info); |
28 virtual ~FakeProvidedFileSystem(); | 29 virtual ~FakeProvidedFileSystem(); |
29 | 30 |
30 // ProvidedFileSystemInterface overrides. | 31 // ProvidedFileSystemInterface overrides. |
31 virtual bool RequestUnmount( | 32 virtual void RequestUnmount( |
32 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 33 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
33 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; | 34 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; |
34 virtual RequestManager* GetRequestManager() OVERRIDE; | 35 virtual RequestManager* GetRequestManager() OVERRIDE; |
| 36 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE; |
35 | 37 |
36 // Factory callback, to be used in Service::SetFileSystemFactory(). The | 38 // Factory callback, to be used in Service::SetFileSystemFactory(). The |
37 // |event_router| argument can be NULL. | 39 // |event_router| argument can be NULL. |
38 static ProvidedFileSystemInterface* Create( | 40 static ProvidedFileSystemInterface* Create( |
39 extensions::EventRouter* event_router, | 41 extensions::EventRouter* event_router, |
40 const ProvidedFileSystemInfo& file_system_info); | 42 const ProvidedFileSystemInfo& file_system_info); |
41 | 43 |
42 private: | 44 private: |
43 ProvidedFileSystemInfo file_system_info_; | 45 ProvidedFileSystemInfo file_system_info_; |
| 46 base::WeakPtrFactory<ProvidedFileSystemInterface> weak_ptr_factory_; |
| 47 |
44 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); | 48 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); |
45 }; | 49 }; |
46 | 50 |
47 } // namespace file_system_provider | 51 } // namespace file_system_provider |
48 } // namespace chromeos | 52 } // namespace chromeos |
49 | 53 |
50 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ | 54 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ |
OLD | NEW |