Index: chrome/browser/chromeos/file_system_provider/provided_file_system.h |
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system.h b/chrome/browser/chromeos/file_system_provider/provided_file_system.h |
index 2cdf6db5e8af1647b52f8b7928a7f7162f2f5fa1..d94c51271e0bfa5282b7b1668dc5fac59c2fb3d0 100644 |
--- a/chrome/browser/chromeos/file_system_provider/provided_file_system.h |
+++ b/chrome/browser/chromeos/file_system_provider/provided_file_system.h |
@@ -31,13 +31,16 @@ namespace base { |
class FilePath; |
} // namespace base |
-namespace extensions { |
-class EventRouter; |
-} // namespace extensions |
- |
namespace chromeos { |
namespace file_system_provider { |
+// Define a policy that gets specific routers |
+template <int source = Source_Type::extension> |
+struct SourcePolicy : Source_Traits<source> { |
+ typedef typename Source_Traits<source>::EventRouterType EventRouterType; |
+ EventRouterType* Get(Profile* profile); |
+}; |
+ |
class NotificationManagerInterface; |
// Automatically calls the |update_callback| after all of the callbacks created |
@@ -73,7 +76,9 @@ class AutoUpdater : public base::RefCounted<AutoUpdater> { |
// Provided file system implementation. Forwards requests between providers and |
// clients. |
-class ProvidedFileSystem : public ProvidedFileSystemInterface { |
+template <int source = Source_Type::extension> |
+class ProvidedFileSystem : public ProvidedFileSystemInterface, |
+ public SourcePolicy<source> { |
public: |
ProvidedFileSystem(Profile* profile, |
const ProvidedFileSystemInfo& file_system_info); |
@@ -81,7 +86,8 @@ class ProvidedFileSystem : public ProvidedFileSystemInterface { |
// Sets a custom event router. Used in unit tests to mock out the real |
// extension. |
- void SetEventRouterForTesting(extensions::EventRouter* event_router); |
+ void SetEventRouterForTesting( |
+ typename SourcePolicy<source>::EventRouterType* event_router); |
// Sets a custom notification manager. It will recreate the request manager, |
// so is must be called just after creating ProvideFileSystem instance. |
@@ -232,8 +238,10 @@ class ProvidedFileSystem : public ProvidedFileSystemInterface { |
const storage::AsyncFileUtil::StatusCallback& callback, |
base::File::Error result); |
- Profile* profile_; // Not owned. |
- extensions::EventRouter* event_router_; // Not owned. May be NULL. |
+ // Not owned. |
+ Profile* profile_; |
+ // Not owned. May be NULL |
+ typename SourcePolicy<source>::EventRouterType* event_router_; |
ProvidedFileSystemInfo file_system_info_; |
scoped_ptr<NotificationManagerInterface> notification_manager_; |
scoped_ptr<RequestManager> request_manager_; |
@@ -242,8 +250,8 @@ class ProvidedFileSystem : public ProvidedFileSystemInterface { |
OpenedFiles opened_files_; |
ObserverList<ProvidedFileSystemObserver> observers_; |
- base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; |
- DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem); |
+ base::WeakPtrFactory<ProvidedFileSystem<source>> weak_ptr_factory_; |
+ DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem<source>); |
}; |
} // namespace file_system_provider |