Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: ios/web/history_state_util.cc

Issue 2511993004: [ObjC ARC] Converts ios/web:core to ARC.Automatically generated ARCMigrate commitNotable issues:… (Closed)
Patch Set: s/mm/cc Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/crw_network_activity_indicator_manager.mm ('k') | ios/web/history_state_util.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "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& currentUrl, 13 bool IsHistoryStateChangeValid(const GURL& currentUrl, const GURL& toUrl) {
sdefresne 2016/11/21 15:45:00 Since it is now C++, can you rename the variables
stkhapugin 2016/11/22 14:20:58 Good idea! Done.
14 const GURL& toUrl) {
15 // 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
16 // allow the page to change the state to an invalid URL. 15 // allow the page to change the state to an invalid URL.
17 CHECK(currentUrl.is_valid()); 16 CHECK(currentUrl.is_valid());
18 CHECK(toUrl.is_valid()); 17 CHECK(toUrl.is_valid());
19 18
20 return toUrl.GetOrigin() == currentUrl.GetOrigin(); 19 return toUrl.GetOrigin() == currentUrl.GetOrigin();
21 } 20 }
22 21
23 GURL GetHistoryStateChangeUrl(const GURL& currentUrl, 22 GURL GetHistoryStateChangeUrl(const GURL& currentUrl,
24 const GURL& baseUrl, 23 const GURL& baseUrl,
25 const std::string& destination) { 24 const std::string& destination) {
26 if (!baseUrl.is_valid()) 25 if (!baseUrl.is_valid())
27 return GURL(); 26 return GURL();
28 GURL toUrl = baseUrl.Resolve(destination); 27 GURL toUrl = baseUrl.Resolve(destination);
29 28
30 if (!toUrl.is_valid() || !IsHistoryStateChangeValid(currentUrl, toUrl)) 29 if (!toUrl.is_valid() || !IsHistoryStateChangeValid(currentUrl, toUrl))
31 return GURL(); 30 return GURL();
32 31
33 return toUrl; 32 return toUrl;
34 } 33 }
35 34
36 } // namespace history_state_util 35 } // namespace history_state_util
37 } // namespace web 36 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/crw_network_activity_indicator_manager.mm ('k') | ios/web/history_state_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698