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