1 // Copyright 2012 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.
4 
5 #ifndef IOS_WEB_HISTORY_STATE_UTIL_H_
6 #define IOS_WEB_HISTORY_STATE_UTIL_H_
7 
8 #include <string>
9 
10 class GURL;
11 
12 namespace web {
13 namespace history_state_util {
14 
15 // Checks if toUrl is a valid argument to history.pushState() or
16 // history.replaceState() given the current URL.
17 bool IsHistoryStateChangeValid(const GURL& currentUrl,
18                                const GURL& toUrl);
19 
20 // Generates the appropriate full URL for a history.pushState() or
21 // history.replaceState() transition from currentURL to destination, resolved
22 // against baseURL. |destination| may be a relative URL. Will return an invalid
23 // URL if the resolved destination, or the transition, is not valid.
24 GURL GetHistoryStateChangeUrl(const GURL& currentUrl,
25                               const GURL& baseUrl,
26                               const std::string& destination);
27 
28 }  // namespace history_state_util
29 }  // namespace web
30 
31 #endif  // IOS_WEB_HISTORY_STATE_UTIL_H_
32