summaryrefslogtreecommitdiffstats
path: root/ios/web/history_state_util.h
blob: 7914c6d0d617969bde0102f193cff30b3c94d831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IOS_WEB_HISTORY_STATE_UTIL_H_
#define IOS_WEB_HISTORY_STATE_UTIL_H_

#include <string>

class GURL;

namespace web {
namespace history_state_util {

// Checks if toUrl is a valid argument to history.pushState() or
// history.replaceState() given the current URL.
bool IsHistoryStateChangeValid(const GURL& currentUrl,
                               const GURL& toUrl);

// Generates the appropriate full URL for a history.pushState() or
// history.replaceState() transition from currentURL to destination, resolved
// against baseURL. |destination| may be a relative URL. Will return an invalid
// URL if the resolved destination, or the transition, is not valid.
GURL GetHistoryStateChangeUrl(const GURL& currentUrl,
                              const GURL& baseUrl,
                              const std::string& destination);

}  // namespace history_state_util
}  // namespace web

#endif  // IOS_WEB_HISTORY_STATE_UTIL_H_