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

Side by Side Diff: mojo/services/network/mojo_persistent_cookie_store.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: nits + observers 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
(Empty)
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.
4
5 #ifndef MOJO_SERVICES_NETWORK_MOJO_PERSISTENT_COOKIE_STORE_H_
6 #define MOJO_SERVICES_NETWORK_MOJO_PERSISTENT_COOKIE_STORE_H_
7
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"
13
14 namespace net {
15 class SQLitePersistentCookieStore;
16 } // namespace net
17
18 namespace mojo {
19 class NetworkServiceDelegate;
20
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);
34
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;
44
45 // NetworkServiceDelegateObserver:
46 void OnIOWorkerThreadShutdown() override;
47
48 private:
49 ~MojoPersistentCookieStore() override;
50
51 void RemoveObserver();
52
53 NetworkServiceDelegate* network_service_delegate_;
54
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_;
58
59 DISALLOW_COPY_AND_ASSIGN(MojoPersistentCookieStore);
60 };
61
62 } // namespace mojo
63
64 #endif // MOJO_SERVICES_NETWORK_MOJO_PERSISTENT_COOKIE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698