OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/web/net/request_group_util.h" | 5 #include "ios/web/net/request_group_util.h" |
6 | 6 |
7 #include <Foundation/Foundation.h> | 7 #include <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
13 #import "net/base/mac/url_conversions.h" | 13 #import "net/base/mac/url_conversions.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." |
| 18 #endif |
| 19 |
16 namespace { | 20 namespace { |
17 // Minimum length for a request group ID. A shorter string is considered as an | 21 // Minimum length for a request group ID. A shorter string is considered as an |
18 // invalid ID. | 22 // invalid ID. |
19 const int kMinimumIDLength = 5; | 23 const int kMinimumIDLength = 5; |
20 } | 24 } |
21 | 25 |
22 namespace web { | 26 namespace web { |
23 | 27 |
24 // Generates a request-group ID used to correlate web requests with the embedder | 28 // Generates a request-group ID used to correlate web requests with the embedder |
25 // that triggered it. It is important that the return value should not be unique | 29 // that triggered it. It is important that the return value should not be unique |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return request_group_id; | 110 return request_group_id; |
107 if (application_scheme && | 111 if (application_scheme && |
108 [[request.mainDocumentURL scheme] | 112 [[request.mainDocumentURL scheme] |
109 caseInsensitiveCompare:application_scheme] == NSOrderedSame) { | 113 caseInsensitiveCompare:application_scheme] == NSOrderedSame) { |
110 return ExtractRequestGroupIDFromURL(request.mainDocumentURL); | 114 return ExtractRequestGroupIDFromURL(request.mainDocumentURL); |
111 } | 115 } |
112 return nil; | 116 return nil; |
113 } | 117 } |
114 | 118 |
115 } // namespace web | 119 } // namespace web |
OLD | NEW |