Update broken references to image assets
[chromium-blink-merge.git] / mojo / services / network / mojo_persistent_cookie_store.h
blob66e9e880ab8c5f7ec0b546cf1520d503df73e1ce
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
3 // found in the LICENSE file.
5 #ifndef MOJO_SERVICES_NETWORK_MOJO_PERSISTENT_COOKIE_STORE_H_
6 #define MOJO_SERVICES_NETWORK_MOJO_PERSISTENT_COOKIE_STORE_H_
8 #include "base/files/file_path.h"
9 #include "base/sequenced_task_runner.h"
10 #include "mojo/services/network/network_service_delegate_observer.h"
11 #include "net/cookies/cookie_monster.h"
12 #include "net/extras/sqlite/cookie_crypto_delegate.h"
14 namespace net {
15 class SQLitePersistentCookieStore;
16 } // namespace net
18 namespace mojo {
19 class NetworkServiceDelegate;
21 // A PersistentCookieStore that listens to NetworkContext's and tries to
22 // gracefully shutdown when our ApplicationConnection is about to be closed.
23 class MojoPersistentCookieStore
24 : public net::CookieMonster::PersistentCookieStore,
25 public NetworkServiceDelegateObserver {
26 public:
27 MojoPersistentCookieStore(
28 NetworkServiceDelegate* network_service_delegate,
29 const base::FilePath& path,
30 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner,
31 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
32 bool restore_old_session_cookies,
33 net::CookieCryptoDelegate* crypto_delegate);
35 // CookieMonster::PersistentCookieStore:
36 void Load(const LoadedCallback& loaded_callback) override;
37 void LoadCookiesForKey(const std::string& key,
38 const LoadedCallback& callback) override;
39 void AddCookie(const net::CanonicalCookie& cc) override;
40 void UpdateCookieAccessTime(const net::CanonicalCookie& cc) override;
41 void DeleteCookie(const net::CanonicalCookie& cc) override;
42 void SetForceKeepSessionState() override;
43 void Flush(const base::Closure& callback) override;
45 // NetworkServiceDelegateObserver:
46 void OnIOWorkerThreadShutdown() override;
48 private:
49 ~MojoPersistentCookieStore() override;
51 void RemoveObserver();
53 NetworkServiceDelegate* network_service_delegate_;
55 // We own the |sql_cookie_store_| that we proxy for. We delete this during
56 // OnIOWorkerThreadShutdown().
57 scoped_refptr<net::SQLitePersistentCookieStore> sql_cookie_store_;
59 DISALLOW_COPY_AND_ASSIGN(MojoPersistentCookieStore);
62 } // namespace mojo
64 #endif // MOJO_SERVICES_NETWORK_MOJO_PERSISTENT_COOKIE_STORE_H_