| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 #import "ios/web/history_state_util.h" | 5 #include "ios/web/history_state_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
| 9 | 9 |
| 10 namespace web { | 10 namespace web { |
| 11 namespace history_state_util { | 11 namespace history_state_util { |
| 12 | 12 |
| 13 bool IsHistoryStateChangeValid(const GURL& current_url, const GURL& to_url) { | 13 bool IsHistoryStateChangeValid(const GURL& current_url, const GURL& to_url) { |
| 14 // These two checks are very important to the security of the page. We cannot | 14 // These two checks are very important to the security of the page. We cannot |
| 15 // allow the page to change the state to an invalid URL. | 15 // allow the page to change the state to an invalid URL. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 27 GURL to_url = base_url.Resolve(destination); | 27 GURL to_url = base_url.Resolve(destination); |
| 28 | 28 |
| 29 if (!to_url.is_valid() || !IsHistoryStateChangeValid(current_url, to_url)) | 29 if (!to_url.is_valid() || !IsHistoryStateChangeValid(current_url, to_url)) |
| 30 return GURL(); | 30 return GURL(); |
| 31 | 31 |
| 32 return to_url; | 32 return to_url; |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace history_state_util | 35 } // namespace history_state_util |
| 36 } // namespace web | 36 } // namespace web |
| OLD | NEW |