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_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ | 5 #ifndef COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ |
6 #define COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ | 6 #define COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ |
7 | 7 |
8 #include <map> | |
9 #include <memory> | |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "components/sessions/core/sessions_export.h" | 12 #include "components/sessions/core/sessions_export.h" |
11 | 13 |
14 namespace content { | |
15 class NavigationEntry; | |
16 } | |
17 | |
12 namespace sessions { | 18 namespace sessions { |
13 | 19 |
20 class ExtendedInfoHandler; | |
14 class SerializedNavigationEntry; | 21 class SerializedNavigationEntry; |
15 | 22 |
16 // The SerializedNavigationDriver interface allows SerializedNavigationEntry to | 23 // The SerializedNavigationDriver interface allows SerializedNavigationEntry to |
17 // obtain information from a singleton driver object. A concrete implementation | 24 // obtain information from a singleton driver object. A concrete implementation |
18 // must be provided by the driver on each platform. | 25 // must be provided by the driver on each platform. |
19 class SESSIONS_EXPORT SerializedNavigationDriver { | 26 class SESSIONS_EXPORT SerializedNavigationDriver { |
20 public: | 27 public: |
21 virtual ~SerializedNavigationDriver() {} | 28 virtual ~SerializedNavigationDriver() {} |
22 | 29 |
23 // Returns the singleton SerializedNavigationDriver. | 30 // Returns the singleton SerializedNavigationDriver. |
(...skipping 19 matching lines...) Expand all Loading... | |
43 virtual std::string GetSanitizedPageStateForPickle( | 50 virtual std::string GetSanitizedPageStateForPickle( |
44 const SerializedNavigationEntry* navigation) const = 0; | 51 const SerializedNavigationEntry* navigation) const = 0; |
45 | 52 |
46 // Sanitizes the data in the given |navigation| to be more robust against | 53 // Sanitizes the data in the given |navigation| to be more robust against |
47 // faulty data written by older versions. | 54 // faulty data written by older versions. |
48 virtual void Sanitize(SerializedNavigationEntry* navigation) const = 0; | 55 virtual void Sanitize(SerializedNavigationEntry* navigation) const = 0; |
49 | 56 |
50 // Removes the referrer from the encoded page state. | 57 // Removes the referrer from the encoded page state. |
51 virtual std::string StripReferrerFromPageState( | 58 virtual std::string StripReferrerFromPageState( |
52 const std::string& page_state) const = 0; | 59 const std::string& page_state) const = 0; |
60 | |
61 // Registers a handler that is used to read and write the extended | |
62 // info stored in SerializedNavigationEntry. | |
63 virtual void RegisterExtendedInfoHandler( | |
sky
2016/09/28 00:22:00
Can you clarify why you want to add these function
| |
64 const std::string& key, | |
65 std::unique_ptr<ExtendedInfoHandler> handler) = 0; | |
66 | |
67 using ExtendedInfoHandlerMap = | |
68 std::map<std::string, std::unique_ptr<ExtendedInfoHandler>>; | |
69 | |
70 // Returns all the registered handlers to deal with the extended info. | |
71 virtual const ExtendedInfoHandlerMap& GetAllExtendedInfoHandlers() const = 0; | |
53 }; | 72 }; |
54 | 73 |
55 } // namespace sessions | 74 } // namespace sessions |
56 | 75 |
57 #endif // COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ | 76 #endif // COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ |
OLD | NEW |