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 "content/common/url_schemes.h" | 5 #include "content/common/url_schemes.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // accidental creation of data races in the program. Add*Scheme aren't | 72 // accidental creation of data races in the program. Add*Scheme aren't |
73 // threadsafe so must be called when GURL isn't used on any other thread. This | 73 // threadsafe so must be called when GURL isn't used on any other thread. This |
74 // is really easy to mess up, so we say that all calls to Add*Scheme in Chrome | 74 // is really easy to mess up, so we say that all calls to Add*Scheme in Chrome |
75 // must be inside this function. | 75 // must be inside this function. |
76 if (lock_schemes) | 76 if (lock_schemes) |
77 url::LockSchemeRegistries(); | 77 url::LockSchemeRegistries(); |
78 | 78 |
79 // Combine the default savable schemes with the additional ones given. | 79 // Combine the default savable schemes with the additional ones given. |
80 delete savable_schemes; | 80 delete savable_schemes; |
81 savable_schemes = new std::vector<std::string>; | 81 savable_schemes = new std::vector<std::string>; |
82 for (auto& default_scheme : kDefaultSavableSchemes) | 82 for (auto* default_scheme : kDefaultSavableSchemes) |
83 savable_schemes->push_back(default_scheme); | 83 savable_schemes->push_back(default_scheme); |
84 savable_schemes->insert(savable_schemes->end(), | 84 savable_schemes->insert(savable_schemes->end(), |
85 schemes.savable_schemes.begin(), | 85 schemes.savable_schemes.begin(), |
86 schemes.savable_schemes.end()); | 86 schemes.savable_schemes.end()); |
87 | 87 |
88 delete service_worker_schemes; | 88 delete service_worker_schemes; |
89 service_worker_schemes = new std::vector<std::string>; | 89 service_worker_schemes = new std::vector<std::string>; |
90 *service_worker_schemes = std::move(schemes.service_worker_schemes); | 90 *service_worker_schemes = std::move(schemes.service_worker_schemes); |
91 | 91 |
92 delete secure_origins; | 92 delete secure_origins; |
93 secure_origins = new std::vector<GURL>; | 93 secure_origins = new std::vector<GURL>; |
94 *secure_origins = std::move(schemes.secure_origins); | 94 *secure_origins = std::move(schemes.secure_origins); |
95 } | 95 } |
96 | 96 |
97 const std::vector<std::string>& GetSavableSchemes() { | 97 const std::vector<std::string>& GetSavableSchemes() { |
98 return *savable_schemes; | 98 return *savable_schemes; |
99 } | 99 } |
100 | 100 |
101 const std::vector<GURL>& GetSecureOrigins() { | 101 const std::vector<GURL>& GetSecureOrigins() { |
102 return *secure_origins; | 102 return *secure_origins; |
103 } | 103 } |
104 | 104 |
105 const std::vector<std::string>& GetServiceWorkerSchemes() { | 105 const std::vector<std::string>& GetServiceWorkerSchemes() { |
106 return *service_worker_schemes; | 106 return *service_worker_schemes; |
107 } | 107 } |
108 | 108 |
109 } // namespace content | 109 } // namespace content |
OLD | NEW |