OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/prerender/prerender_local_predictor.h" | 5 #include "chrome/browser/prerender/prerender_local_predictor.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 return StringContainsIgnoringCase(url.spec().c_str(), "login") || | 300 return StringContainsIgnoringCase(url.spec().c_str(), "login") || |
301 StringContainsIgnoringCase(url.spec().c_str(), "signin"); | 301 StringContainsIgnoringCase(url.spec().c_str(), "signin"); |
302 } | 302 } |
303 | 303 |
304 bool IsLogOutURL(const GURL& url) { | 304 bool IsLogOutURL(const GURL& url) { |
305 return StringContainsIgnoringCase(url.spec().c_str(), "logout") || | 305 return StringContainsIgnoringCase(url.spec().c_str(), "logout") || |
306 StringContainsIgnoringCase(url.spec().c_str(), "signout"); | 306 StringContainsIgnoringCase(url.spec().c_str(), "signout"); |
307 } | 307 } |
308 | 308 |
309 int64 URLHashToInt64(const unsigned char* data) { | 309 int64 URLHashToInt64(const unsigned char* data) { |
310 COMPILE_ASSERT(kURLHashSize < sizeof(int64), url_hash_must_fit_in_int64); | 310 static_assert(kURLHashSize < sizeof(int64), "url hash must fit in int64"); |
311 int64 value = 0; | 311 int64 value = 0; |
312 memcpy(&value, data, kURLHashSize); | 312 memcpy(&value, data, kURLHashSize); |
313 return value; | 313 return value; |
314 } | 314 } |
315 | 315 |
316 int64 GetInt64URLHashForURL(const GURL& url) { | 316 int64 GetInt64URLHashForURL(const GURL& url) { |
317 COMPILE_ASSERT(kURLHashSize < sizeof(int64), url_hash_must_fit_in_int64); | 317 static_assert(kURLHashSize < sizeof(int64), "url hash must fit in int64"); |
318 scoped_ptr<crypto::SecureHash> hash( | 318 scoped_ptr<crypto::SecureHash> hash( |
319 crypto::SecureHash::Create(crypto::SecureHash::SHA256)); | 319 crypto::SecureHash::Create(crypto::SecureHash::SHA256)); |
320 int64 hash_value = 0; | 320 int64 hash_value = 0; |
321 const char* url_string = url.spec().c_str(); | 321 const char* url_string = url.spec().c_str(); |
322 hash->Update(url_string, strlen(url_string)); | 322 hash->Update(url_string, strlen(url_string)); |
323 hash->Finish(&hash_value, kURLHashSize); | 323 hash->Finish(&hash_value, kURLHashSize); |
324 return hash_value; | 324 return hash_value; |
325 } | 325 } |
326 | 326 |
327 bool URLsIdenticalIgnoringFragments(const GURL& url1, const GURL& url2) { | 327 bool URLsIdenticalIgnoringFragments(const GURL& url1, const GURL& url2) { |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 break; | 1567 break; |
1568 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: | 1568 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: |
1569 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); | 1569 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); |
1570 break; | 1570 break; |
1571 default: | 1571 default: |
1572 NOTREACHED(); | 1572 NOTREACHED(); |
1573 } | 1573 } |
1574 } | 1574 } |
1575 | 1575 |
1576 } // namespace prerender | 1576 } // namespace prerender |
OLD | NEW |