add flags for future skia api change
[chromium-blink-merge.git] / components / sessions / core / serialized_navigation_driver.h
blob0cf5963621582b27d931a55940e425dd5108b77a
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_
6 #define COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_
8 #include <string>
10 #include "components/sessions/sessions_export.h"
12 namespace sessions {
13 class SerializedNavigationEntry;
15 // The SerializedNavigationDriver interface allows SerializedNavigationEntry to
16 // obtain information from a singleton driver object. A concrete implementation
17 // must be provided by the driver on each platform.
18 class SESSIONS_EXPORT_PRIVATE SerializedNavigationDriver {
19 public:
20 virtual ~SerializedNavigationDriver() {}
22 // Returns the singleton SerializedNavigationDriver.
23 static SerializedNavigationDriver* Get();
25 // Returns the default referrer policy.
26 virtual int GetDefaultReferrerPolicy() const = 0;
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;
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;
40 // Returns a sanitized version of the given |navigation|'s encoded_page_state
41 // suitable for writing to disk.
42 virtual std::string GetSanitizedPageStateForPickle(
43 const SerializedNavigationEntry* navigation) const = 0;
45 // Sanitizes the data in the given |navigation| to be more robust against
46 // faulty data written by older versions.
47 virtual void Sanitize(SerializedNavigationEntry* navigation) const = 0;
49 // Removes the referrer from the encoded page state.
50 virtual std::string StripReferrerFromPageState(
51 const std::string& page_state) const = 0;
54 } // namespace sessions
56 #endif // COMPONENTS_SESSIONS_CORE_SERIALIZED_NAVIGATION_DRIVER_H_