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 <string> | 8 #include <string> |
9 | 9 |
10 #include "components/sessions/sessions_export.h" | 10 #include "components/sessions/sessions_export.h" |
11 | 11 |
12 namespace sessions { | 12 namespace sessions { |
13 class SerializedNavigationEntry; | 13 class SerializedNavigationEntry; |
14 | 14 |
15 // The SerializedNavigationDriver interface allows SerializedNavigationEntry to | 15 // The SerializedNavigationDriver interface allows SerializedNavigationEntry to |
16 // obtain information from a singleton driver object. A concrete implementation | 16 // obtain information from a singleton driver object. A concrete implementation |
17 // must be provided by the driver on each platform. | 17 // must be provided by the driver on each platform. |
18 class SESSIONS_EXPORT_PRIVATE SerializedNavigationDriver { | 18 class SESSIONS_EXPORT_PRIVATE SerializedNavigationDriver { |
19 public: | 19 public: |
20 virtual ~SerializedNavigationDriver() {} | 20 virtual ~SerializedNavigationDriver() {} |
21 | 21 |
22 // Returns the singleton SerializedNavigationDriver. | 22 // Returns the singleton SerializedNavigationDriver. |
23 static SerializedNavigationDriver* Get(); | 23 static SerializedNavigationDriver* Get(); |
24 | 24 |
25 // Returns the default referrer policy. | 25 // Returns the default referrer policy. |
26 virtual int GetDefaultReferrerPolicy() const = 0; | 26 virtual int GetDefaultReferrerPolicy() const = 0; |
27 | 27 |
| 28 // Maps current referrer policies to old values to work around |
| 29 // crbug.com/450589. Returns false if the referrer should be stripped. |
| 30 virtual bool MapReferrerPolicyToOldValues( |
| 31 int referrer_policy, |
| 32 int* mapped_referrer_policy) const = 0; |
| 33 |
| 34 // Sanitizes a referrer policy that might either be in the old or the new |
| 35 // format. Returns false if the referrer should be stripped. |
| 36 virtual bool MapReferrerPolicyToNewValues( |
| 37 int referrer_policy, |
| 38 int* mapped_referrer_policy) const = 0; |
| 39 |
28 // Returns a sanitized version of the given |navigation|'s encoded_page_state | 40 // Returns a sanitized version of the given |navigation|'s encoded_page_state |
29 // suitable for writing to disk. | 41 // suitable for writing to disk. |
30 virtual std::string GetSanitizedPageStateForPickle( | 42 virtual std::string GetSanitizedPageStateForPickle( |
31 const SerializedNavigationEntry* navigation) const = 0; | 43 const SerializedNavigationEntry* navigation) const = 0; |
32 | 44 |
33 // Sanitizes the data in the given |navigation| to be more robust against | 45 // Sanitizes the data in the given |navigation| to be more robust against |
34 // faulty data written by older versions. | 46 // faulty data written by older versions. |
35 virtual void Sanitize(SerializedNavigationEntry* navigation) const = 0; | 47 virtual void Sanitize(SerializedNavigationEntry* navigation) const = 0; |
36 }; | 48 }; |
37 | 49 |
38 } // namespace sessions | 50 } // namespace sessions |
39 | 51 |
40 #endif // COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ | 52 #endif // COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_ |
OLD | NEW |