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

Side by Side Diff: components/filesystem/file_system_app.h

Issue 1231493002: mandoline filesystem: Save cookie data to the mojo:filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT for jam's core services patch. Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ 5 #ifndef COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_
6 #define COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ 6 #define COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/filesystem/directory_impl.h"
9 #include "components/filesystem/file_system_impl.h" 10 #include "components/filesystem/file_system_impl.h"
10 #include "components/filesystem/public/interfaces/file_system.mojom.h" 11 #include "components/filesystem/public/interfaces/file_system.mojom.h"
11 #include "mojo/application/public/cpp/application_delegate.h" 12 #include "mojo/application/public/cpp/application_delegate.h"
12 #include "mojo/application/public/cpp/interface_factory.h" 13 #include "mojo/application/public/cpp/interface_factory.h"
13 14
15 namespace mojo {
16 class ApplicationImpl;
17 }
18
14 namespace filesystem { 19 namespace filesystem {
15 20
16 class FileSystemApp : public mojo::ApplicationDelegate, 21 class FileSystemApp : public mojo::ApplicationDelegate,
17 public mojo::InterfaceFactory<FileSystem> { 22 public mojo::InterfaceFactory<FileSystem> {
18 public: 23 public:
19 FileSystemApp(); 24 FileSystemApp();
20 ~FileSystemApp() override; 25 ~FileSystemApp() override;
21 26
27 // Called by individual FileSystem objects to register lifetime events.
28 void RegisterDirectoryToClient(DirectoryImpl* directory,
29 FileSystemClientPtr client);
30
22 private: 31 private:
32 // We set the DirectoryImpl's error handler to this function. When we
33 // actually take a
jam 2015/07/13 15:48:33 nit: rest of comment?
34 void OnDirectoryConnectionError(DirectoryImpl* directory);
35
23 // |ApplicationDelegate| override: 36 // |ApplicationDelegate| override:
37 void Initialize(mojo::ApplicationImpl* app) override;
24 bool ConfigureIncomingConnection( 38 bool ConfigureIncomingConnection(
25 mojo::ApplicationConnection* connection) override; 39 mojo::ApplicationConnection* connection) override;
40 bool OnShellConnectionError() override;
26 41
27 // |InterfaceFactory<Files>| implementation: 42 // |InterfaceFactory<Files>| implementation:
28 void Create(mojo::ApplicationConnection* connection, 43 void Create(mojo::ApplicationConnection* connection,
29 mojo::InterfaceRequest<FileSystem> request) override; 44 mojo::InterfaceRequest<FileSystem> request) override;
30 45
46 // Use a vector to work around map not letting us use FileSystemClientPtr as
47 // a value in a std::map. The move constructors are to allow us to deal with
48 // FileSystemClientPtr inside a vector.
49 struct Client {
50 Client(DirectoryImpl* directory, FileSystemClientPtr fs_client);
51 Client(Client&& rhs);
52 ~Client();
53
54 Client& operator=(Client&& rhs);
55
56 DirectoryImpl* directory_;
57 FileSystemClientPtr fs_client_;
58 };
59 std::vector<Client> client_mapping_;
60
61 mojo::ApplicationImpl* app_;
62
63 // Set to true when our shell connection is closed. On connection error, we
64 // then broadcast a notification to all FileSystemClients that they should
65 // shut down. Once the final one does, then we QuitNow().
66 bool in_shutdown_;
67
31 DISALLOW_COPY_AND_ASSIGN(FileSystemApp); 68 DISALLOW_COPY_AND_ASSIGN(FileSystemApp);
32 }; 69 };
33 70
34 } // namespace filesystem 71 } // namespace filesystem
35 72
36 #endif // COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_ 73 #endif // COMPONENTS_FILESYSTEM_FILE_SYSTEM_APP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698