OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_DRIVER_H_ | 5 #ifndef COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_DRIVER_H_ |
6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_DRIVER_H_ | 6 #define COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_DRIVER_H_ |
7 | 7 |
8 #include "components/sessions/core/serialized_navigation_driver.h" | 8 #include "components/sessions/core/serialized_navigation_driver.h" |
9 | 9 |
| 10 #include <map> |
| 11 #include <memory> |
| 12 #include <string> |
| 13 |
| 14 #include "base/macros.h" |
| 15 #include "components/sessions/content/extended_info_handler.h" |
10 #include "components/sessions/core/sessions_export.h" | 16 #include "components/sessions/core/sessions_export.h" |
11 | 17 |
12 namespace base { | 18 namespace base { |
13 template <typename T> struct DefaultSingletonTraits; | 19 template <typename T> struct DefaultSingletonTraits; |
14 } | 20 } |
15 | 21 |
16 namespace sessions { | 22 namespace sessions { |
17 | 23 |
18 // Provides an implementation of SerializedNavigationDriver that is backed by | 24 // Provides an implementation of SerializedNavigationDriver that is backed by |
19 // content classes. | 25 // content classes. |
(...skipping 11 matching lines...) Expand all Loading... |
31 bool MapReferrerPolicyToOldValues(int referrer_policy, | 37 bool MapReferrerPolicyToOldValues(int referrer_policy, |
32 int* mapped_referrer_policy) const override; | 38 int* mapped_referrer_policy) const override; |
33 bool MapReferrerPolicyToNewValues(int referrer_policy, | 39 bool MapReferrerPolicyToNewValues(int referrer_policy, |
34 int* mapped_referrer_policy) const override; | 40 int* mapped_referrer_policy) const override; |
35 std::string GetSanitizedPageStateForPickle( | 41 std::string GetSanitizedPageStateForPickle( |
36 const SerializedNavigationEntry* navigation) const override; | 42 const SerializedNavigationEntry* navigation) const override; |
37 void Sanitize(SerializedNavigationEntry* navigation) const override; | 43 void Sanitize(SerializedNavigationEntry* navigation) const override; |
38 std::string StripReferrerFromPageState( | 44 std::string StripReferrerFromPageState( |
39 const std::string& page_state) const override; | 45 const std::string& page_state) const override; |
40 | 46 |
| 47 // Registers a handler that is used to read and write the extended |
| 48 // info stored in SerializedNavigationEntry. As part of serialization |key| |
| 49 // is written to disk, as such once a handler is registered it should always |
| 50 // be registered to the same key. |
| 51 void RegisterExtendedInfoHandler( |
| 52 const std::string& key, |
| 53 std::unique_ptr<ExtendedInfoHandler> handler); |
| 54 |
| 55 using ExtendedInfoHandlerMap = |
| 56 std::map<std::string, std::unique_ptr<ExtendedInfoHandler>>; |
| 57 |
| 58 // Returns all the registered handlers to deal with the extended info. |
| 59 const ExtendedInfoHandlerMap& GetAllExtendedInfoHandlers() const; |
| 60 |
41 private: | 61 private: |
42 ContentSerializedNavigationDriver(); | 62 ContentSerializedNavigationDriver(); |
43 friend struct base::DefaultSingletonTraits<ContentSerializedNavigationDriver>; | 63 friend struct base::DefaultSingletonTraits<ContentSerializedNavigationDriver>; |
| 64 |
| 65 ExtendedInfoHandlerMap extended_info_handler_map_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(ContentSerializedNavigationDriver); |
44 }; | 68 }; |
45 | 69 |
46 } // namespace sessions | 70 } // namespace sessions |
47 | 71 |
48 #endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_DRIVER_H_ | 72 #endif // COMPONENTS_SESSIONS_CONTENT_CONTENT_SERIALIZED_NAVIGATION_DRIVER_H_ |
OLD | NEW |