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

Side by Side Diff: mojo/services/network/network_service_delegate.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: Merge with ToT 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 MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ 5 #ifndef MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_
6 #define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ 6 #define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_
7 7
8 #include "base/observer_list.h"
9 #include "base/threading/thread.h"
10 #include "components/filesystem/public/interfaces/file_system.mojom.h"
8 #include "mojo/application/public/cpp/application_delegate.h" 11 #include "mojo/application/public/cpp/application_delegate.h"
9 #include "mojo/application/public/cpp/application_impl.h" 12 #include "mojo/application/public/cpp/application_impl.h"
10 #include "mojo/application/public/cpp/interface_factory.h" 13 #include "mojo/application/public/cpp/interface_factory.h"
11 #include "mojo/services/network/network_context.h" 14 #include "mojo/services/network/network_context.h"
12 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 15 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
13 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" 16 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
14 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h" 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h"
15 18
19 namespace sql {
20 class ScopedMojoFilesystemVFS;
21 }
22
23 namespace mojo {
24 class NetworkServiceDelegateObserver;
25
16 class NetworkServiceDelegate 26 class NetworkServiceDelegate
17 : public mojo::ApplicationDelegate, 27 : public mojo::ApplicationDelegate,
18 public mojo::InterfaceFactory<mojo::NetworkService>, 28 public mojo::InterfaceFactory<mojo::NetworkService>,
19 public mojo::InterfaceFactory<mojo::URLLoaderFactory> { 29 public mojo::InterfaceFactory<mojo::URLLoaderFactory>,
30 public filesystem::FileSystemClient {
20 public: 31 public:
21 NetworkServiceDelegate(); 32 NetworkServiceDelegate();
22 ~NetworkServiceDelegate() override; 33 ~NetworkServiceDelegate() override;
23 34
35 void AddObserver(NetworkServiceDelegateObserver* observer);
36 void RemoveObserver(NetworkServiceDelegateObserver* observer);
37
24 private: 38 private:
39 // Notifies all of our observers of a Shuts down our IO thread. Safe to call
40 // multiple times.
41 void EnsureIOThreadShutdown();
42
25 // mojo::ApplicationDelegate implementation. 43 // mojo::ApplicationDelegate implementation.
26 void Initialize(mojo::ApplicationImpl* app) override; 44 void Initialize(mojo::ApplicationImpl* app) override;
27 bool ConfigureIncomingConnection( 45 bool ConfigureIncomingConnection(
28 mojo::ApplicationConnection* connection) override; 46 mojo::ApplicationConnection* connection) override;
47 bool OnShellConnectionError() override;
29 void Quit() override; 48 void Quit() override;
30 49
31 // mojo::InterfaceFactory<mojo::NetworkService> implementation. 50 // mojo::InterfaceFactory<mojo::NetworkService> implementation.
32 void Create(mojo::ApplicationConnection* connection, 51 void Create(mojo::ApplicationConnection* connection,
33 mojo::InterfaceRequest<mojo::NetworkService> request) override; 52 mojo::InterfaceRequest<mojo::NetworkService> request) override;
34 53
35 // mojo::InterfaceFactory<mojo::URLLoaderFactory> implementation. 54 // mojo::InterfaceFactory<mojo::URLLoaderFactory> implementation.
36 void Create(mojo::ApplicationConnection* connection, 55 void Create(mojo::ApplicationConnection* connection,
37 mojo::InterfaceRequest<mojo::URLLoaderFactory> request) override; 56 mojo::InterfaceRequest<mojo::URLLoaderFactory> request) override;
38 57
58 // Overridden from FileSystemClient:
59 void OnFileSystemShutdown() override;
60
39 private: 61 private:
40 mojo::ApplicationImpl* app_; 62 mojo::ApplicationImpl* app_;
63
64 // Observers that want notifications that our worker thread is going away.
65 base::ObserverList<NetworkServiceDelegateObserver> observers_;
66
67 mojo::Binding<filesystem::FileSystemClient> binding_;
68
69 // A worker thread that blocks for file IO.
70 scoped_ptr<base::Thread> io_worker_thread_;
71
72 // Our connection to the filesystem service, which stores our cookies and
73 // other data.
74 filesystem::FileSystemPtr files_;
75
41 scoped_ptr<mojo::NetworkContext> context_; 76 scoped_ptr<mojo::NetworkContext> context_;
42 }; 77 };
43 78
79 } // namespace mojo
80
44 #endif // MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ 81 #endif // MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698